Openssl header not found -- error - linux

I need to compile a libwebsocket library for my ARM target which requires openssl for its functioning.
I am getting following error when i build latest libwebsocket at the time of, cmake ...
But openssl is installed here
whereis openssl
openssl: /usr/bin/openssl /usr/bin/X11/openssl /usr/share/man/man1/openssl.1ssl.gz
=================================== Error ================
-- Looking for 4 include files stdlib.h, ..., float.h - found
-- Found ZLIB: /usr/lib/arm-linux-gnueabihf/libz.so (found version "1.2.7")
ZLib include dirs: /usr/include
ZLib libraries: /usr/lib/arm-linux-gnueabihf/libz.so
Compiling with SSL support
CMake Error at /usr/local/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:97 (message):
Could NOT find OpenSSL, try to set the path to OpenSSL root folder in the
system variable OPENSSL_ROOT_DIR (missing: OPENSSL_LIBRARIES
OPENSSL_INCLUDE_DIR)
Call Stack (most recent call first):
/usr/local/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:291 (_FPHSA_FAILURE_MESSAGE)
/usr/local/share/cmake-2.8/Modules/FindOpenSSL.cmake:313 (find_package_handle_standard_args)
CMakeLists.txt:436 (find_package)
-- Configuring incomplete, errors occurred!
======================================= openssl is here ========================
ignite#ignite:~/sbox2/rootfs/rfs-raspbian_2/home/pi/libwebsockets/build$ whereis openssl
openssl: /usr/bin/openssl /usr/bin/X11/openssl /usr/share/man/man1/openssl.1ssl.gz
actually i have, source tarball from here. it have configure script to make & make install
http://www.openssl.org/source/
openssl-1.0.1e.tar.gz
So with this (openssl-1.0.1e.tar.gz) will be the right package to get --> openssl-dev or openssl-devel --- so that i can resolve this error ?

So with this (openssl-1.0.1e.tar.gz) will be the right package to get --> openssl-dev or openssl-devel --- so that i can resolve this error ?
The openssl-dev packages are for development on the host machine (which is probably x86 or x64 family). You need a cross compiled library for the target (and not the host). So openssl-dev will probably not solve your problem.
Are you targeting a generic ARM processor, iOS, or Android? If the former, you will need an arm cross-toolchain with paths set appropriately. I'm not aware of a good tutorial on cross compiling the library (and I've suffered it in the past).
There are some prebuilt configurations for generic cross compiling. Open Configure and config, and look at some of the triples. (OpenSSL does not use Automake and friends).
If iOS or Android, the OpenSSL wiki has some examples of cross compiling for the platforms. See, for example, FIPS Library and Android. The setenv-android.sh script is most important because it set paths, sysroot and toolchains. Once paths and toolschains are set, the rest is easy.
If you are targeting a generic ARM, then you could use the Android setenv-android.sh as a starting point for your generic build. Once you complete the build, then point OPENSSL_ROOT_DIR into the install directory for ARM.

Related

Buildroot: cmake can't find my compiler to build a CMake project if I install cmake on my host

Running on Ubuntu 22.04 as my host build machine.
If I install cmake with sudo apt update then sudo apt install cmake or sudo apt install catkin (since catkin includes cmake), my Buildroot build using cmake no longer can find my compiler. Why?
After running make in my buildroot project, the compiler is unknown:
-- The C compiler identification is unknown
-- The CXX compiler identification is unknown
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - failed
-- Check for working C compiler: /home/gabriel/dev/repos/my_repo/output/my_board/host/bin/ccache
-- Check for working C compiler: /home/gabriel/dev/repos/my_repo/output/my_board/host/bin/ccache - broken
CMake Error at /usr/share/cmake-3.22/Modules/CMakeTestCCompiler.cmake:69 (message):
The C compiler
"/home/gabriel/dev/repos/my_repo/output/my_board/host/bin/ccache"
is not able to compile a simple test program.
It fails with the following output:
...
So, uninstalling cmake from my host via sudo apt remove cmake removes this problem, but then I get a new error when I run make in my Buildroot project:
CMake Error at CMakeLists.txt:8 (find_package):
By not providing "FindTinyXML2.cmake" in CMAKE_MODULE_PATH this project has
asked CMake to find a package configuration file provided by "TinyXML2",
but CMake did not find one.
Could not find a package configuration file provided by "TinyXML2" with any
of the following names:
TinyXML2Config.cmake
tinyxml2-config.cmake
Add the installation prefix of "TinyXML2" to CMAKE_PREFIX_PATH or set
"TinyXML2_DIR" to a directory containing one of the above files. If
"TinyXML2" provides a separate development package or SDK, be sure it has
been installed.
...but at least it can find my compiler now. Here is the output just prior to the error above, showing it now can find my gcc-11 "C compiler" and g++-11 "CXX compiler":
-- The C compiler identification is GNU 11.3.0
-- The CXX compiler identification is GNU 11.3.0
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /home/gabriel/dev/repos/my_repo/output/my_board/host/bin/ccache - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /home/gabriel/dev/repos/my_repo/output/my_board/host/bin/ccache - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Using CATKIN_DEVEL_PREFIX: /home/gabriel/dev/repos/my_repo/output/my_board/build/host-rospack-2.6.2/devel
-- Using CMAKE_PREFIX_PATH: /home/gabriel/dev/repos/my_repo/output/my_board/host//opt/ros/indigo/;/home/gabriel/dev/repos/my_repo/output/my_board/host/usr
-- This workspace overlays: /home/gabriel/dev/repos/my_repo/output/my_board/host//opt/ros/indigo/
-- Found PythonInterp: /home/gabriel/dev/repos/my_repo/output/my_board/host/usr/bin/python (found version "3.8.2")
-- Using PYTHON_EXECUTABLE: /home/gabriel/dev/repos/my_repo/output/my_board/host/usr/bin/python
-- Using default Python package layout
-- Using empy: /usr/bin/empy
-- Using CATKIN_ENABLE_TESTING: ON
-- Call enable_testing()
-- Using CATKIN_TEST_RESULTS_DIR: /home/gabriel/dev/repos/my_repo/output/my_board/build/host-rospack-2.6.2/test_results
-- Found gtest: gtests will be built
CMake Warning at /home/gabriel/dev/repos/my_repo/output/my_board/host/opt/ros/indigo/share/catkin/cmake/test/nosetests.cmake:96 (message):
nosetests not found, Python tests can not be run (try installing package
'python3-nose')
Call Stack (most recent call first):
/home/gabriel/dev/repos/my_repo/output/my_board/host/opt/ros/indigo/share/catkin/cmake/all.cmake:147 (include)
/home/gabriel/dev/repos/my_repo/output/my_board/host/opt/ros/indigo/share/catkin/cmake/catkinConfig.cmake:20 (include)
CMakeLists.txt:4 (find_package)
-- catkin 0.6.19
-- Found Boost: /usr/lib/x86_64-linux-gnu/cmake/Boost-1.74.0/BoostConfig.cmake (found version "1.74.0") found components: filesystem program_options system
-- Found PythonLibs: /home/gabriel/dev/repos/my_repo/output/my_board/host/usr/lib/libpython3.8.so (found suitable version "3.8.2", minimum required is "3.8")
What's going on here? I expect it to find my compiler in both cases, but it won't if I have cmake locally installed, and I expect it to find the tinyxml2 package, but it won't, even though tinyxml2 is locally installed, as I explain here.
ros-cmake-modules contains FindTinyXML2.cmake and FindTinyXML.cmake modules. Have you installed the ros-cmake-modules package with sudo apt install ros-cmake-modules ?
Your CMAKE_PREFIX_PATH is /home/gabriel/dev/repos/my_repo/output/my_board/host//opt/ros/indigo/ and the operating system of your host build machine is Ubuntu 22.04. Ubuntu version and ROS version are co-dependent, so you have to choose a pair. ROS Noetic is the version of ROS that is compatible with Ubuntu 22.04.
You might be able to get ROS Indigo to work in Ubuntu 18.04 if you install it from source, but you'll most likely run into issues. This is because ROS distros target a specific Ubuntu version (or sometimes 2 versions). If you use a different Ubuntu version, most dependencies will have different versions as well and this will most likely lead to annoying issues. For Ubuntu 18.04, you're better off running ROS Melodic. source
In a comment to this answer you wrote that your current build system is on Ubuntu 18.04 which is going to be end of life in April, so you're moving to Ubuntu 22.04. ROS Noetic is the version of ROS that is compatible with Ubuntu 22.04 or alternatively you can install ROS 2 Humble on Ubuntu 22.04 instead of Noetic by following the instructions at Ubuntu (Debian) ROS 2 Documentation: Humble documentation.

How to fix error: Cygwin gcc cannot be used with --compiler=mingw32

I'm trying to install this project: https://github.com/drufat/triangle. Unfortunatly, I get the following error:
error: Cygwin gcc cannot be used with --compiler=mingw32
I'm using the lastest version of gcc for Cygwin on Windows 7 64 bit and I'm trying to install that project for python 3.7.1. It's seems to come from my distutil configuration. My distutils.cfg file contains:
[build]
compiler=mingw32
I tried that solution but it doens't helped:
https://stackoverflow.com/a/16740123/5075502
The gcc options to build for MinGW64 is no longer supported by the regular cygqin compiler gcc, aka x86_64-pc-cygwin-gcc. Instead, you should also install the mingw64-x86_64-gcc-core package which provides the GCC for Win64 toolchain (C, OpenMP). This will also install other packages (through dependencies) which provide compatible binutils, headers, libraries, and runtime.
In your Makefile or compiler command line, replace gcc with x86_64-w64-mingw32-gcc. This will allow you to compile and link executables which do not depend on the cygwin1.dll.
A similar problem occured. I fixed it by changing mingw32 by gcc like #phd said.

how to remove openssl library dependencies

when i try to execute the Linux executable on other fresh machine my program gives an error for dependency of OpenSSL.
For running my program smoothly it requires libssl.so and libcrypto.so preloaded.
How can i remove this dependency using make file or any other solution on Linux
It seems that you linked your executable with OpenSSL libraries dynamically. So your executable needs libcrypto.so and libssl.so. You have two ways:
OpenSSL is pretty widely distributed in Linux environment and most probably is pre-installed on the Linux you are running your executable on. So the problem may be in the required version of the libraries - your executable may be compiled with e.g. OpenSSL 1.0.1 and Linus has 0.9.8. Or the problem could be with the path of the libraries. In RadHat OpenSSL libraries are in /lib64 by default. So you need either to build your application with the same or compatible version of OpenSSL as present on Linux where you run or provide the correct path by setting LD_LIBRARY_PATH
You can link your executable static with OpenSSL libraries:
gcc -lsome_dynamic_lib code.c libcrypto.a libssl.a

Building Pango with Cairo support

I'm attempting to build a new version of wireshark 1.10 on a RHEL5 box with the intent of making an RPM so that customers that I support can install it. Possibly others if I can find a place to host it.
WS1.10 depends on GTK+ as well as several other libraries that aren't supported by the available rpm packages. Therefore, I have to build them by hand. GTK+ needs pango(1.24.5) with cairo(1.8.8) support.
After having built and installed a newer version of cairo from source, a ./configure of pango gives the following error
checking for CAIRO... yes
checking which cairo font backends could be used... none
configure: Disabling cairo support
and then at the end ./configure displays
configuration:
backends: X
I can verify that Cairo is installed by looking at the pkg_config in my /usr/local/lib.
I've even taken a look at the pango config.log. But I don't see anything that is any different then the messages I copypasta'ed above.
What are some places I should be looking to figure out a less terse error message? I'm kind of at a loss troubleshooting this.
I encountered this issue today and solved it by installing HARFBUZZ, which is mentioned in the README file of Pango. After installation of Harfbuzz we have access to FreeType. So follow this procedure:
Build and install FreeType
Build and install fontconfig
Build and install Cairo (after ./configure please make sure freetype and fontconfig are found)
Build and install Harfbuzz
Build and install Pango
In case of you still have problems even though you are following the guideline of Xiao Jia, take care to look into config.log. It will help you to find out why the package does not find particular components on your system. In my case the fontconfig-devel and freetype-devel package from default repository of my distro was too old.
I could manage it by installing the whole stack into a location outside of /usr (not that difficult as it sounds) by adding configuration file to /etc/ld.so.conf.d and a environment expanding script to /etc/profile.d.

Problems building libcurl 7.21.2 on Ubuntu 11.10 (Hiphop)

I'm following this Hiphop installation guide:
https://github.com/facebook/hiphop-php/wiki/Building-and-installing-on-ubuntu-10.10
And when I try to make it, I get the following errors:
../lib/.libs/libcurl.so: undefined reference to `SSLv2_client_method'
I've found this Server Fault ticket, but the merged change from the linked Github pull request didn't seem to fix the problem.
https://superuser.com/questions/339932/compiling-curl-with-hiphop-for-php-patch
I'm running Ubuntu 11.10, but I doubt that's the issue.
Thanks for any help you can provide!
EDIT: Adding Hiphop Cmake errors:
Here are errors when I just try to cmake . while ignoring the libcurl problems:
CMake Error at CMake/HPHPFindLibs.cmake:90 (message):
Custom libcurl is required with the HipHop patch
Call Stack (most recent call first):
CMake/HPHPSetup.cmake:46 (include)
src/CMakeLists.txt:18 (include)
Ubuntu 11.10 uses OpenSSL v1.0. OpenSSL v1.0 has (finally!) disabled SSLv2 support entirely.
Curl can build against nosslv2 OpenSSL starting from 7.21.5.
You can port the changes in 7.21.5 that allow such builds back to your custom libcurl. Alternatively, you can build a private version of OpenSSL that includes SSLv2 support, and link your custom libcurl against it.
I had the same problem on 11.10.
#n.m was exactly right on this problem....
I inserted the following lines of code:
#ifdef OPENSSL_NO_SSL2
failf(data, "openSSL was compiled without SSLv2 support");
return CURLE_SSL_CONNECT_ERROR;
#endif
after line 1462
Please find these lines of code here : github.com/bagder/curl/commit/26b487a5d6ed9da5bc8e4a134a88d3125884b852
in curl/lib/ssluse.c
recompiled and built...
Seems to work now!

Resources