[bug] Failure to cross-compile OpenSSL for QNX
Environment details
Operating system: Ubuntu 22 04 GCC: 10.5.0 Conan: 1.59.0 Python: 3.10.12 Cmake: 3.28.1
Steps to reproduce
- Download and install QNX SDP toolchain into local system.
- Source SDP toolchain and capture environment variables
- Add environment variables to QNX Conan profile.
- Execute Conan install for cross-compile, using build/host profiles.
Conan profile build (x86_64)
[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=10
compiler.libcxx=libstdc++11
build_type=Release
[options]
[build_requires]
[env]
Conan profile host (QNX ARMv8)
[settings]
os=Neutrino
os.version=7.1
compiler=qcc
compiler.version=8.3
compiler.libcxx=cxx
arch=armv8
build_type=Release
[options]
[build_requires]
[env]
CC=qcc
CFLAGS="-Vgcc_ntoaarch64le -Y_cxx -D_QNX_SOURCE"
CXXFLAGS="-Vgcc_ntoaarch64le -Y_cxx -D_QNX_SOURCE"
CXX=q++
MAKEFLAGS=-I/home/mhadley4/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/target/qnx7/usr/include
PATH=/home/mhadley4/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/host/linux/x86_64/usr/bin:/home/mhadley4/.qnx/bin:/home/mhadley4/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/jre/bin:/home/mhadley4/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/host/common/bin:/home/mhadley4/.local/bin:/home/mhadley4/.local/bin:/home/mhadley4/.local/bin:/home/mhadley4/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
PYTHONDONTWRITEBYTECODE=1
QNX_CONFIGURATION_EXCLUSIVE=/home/mhadley4/.qnx
QNX_CONFIGURATION=/home/mhadley4/.qnx
QNX_HOST=/home/mhadley4/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/host/linux/x86_64
QNX_TARGET=/home/mhadley4/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/target/qnx7
[buildenv]
Simple Conan Install Command
conan install openssl/3.2.1@ -pr:h=conan-profile-host -pr:b=conan-profile-build --build -r conancenter
Results in Error
"cc: Can't specify -P, -C, -E, -c or -S with -o and have multiple files"
Doing the exact same process for many other Yocto based SDK toolchains, they can all build OpenSSL. I have no clue where to go from here, not much to go on from the Internet. Any assistance would be appreciated. Thanks
Logs
Configuration (profile_host):
[settings]
arch=armv8
build_type=Debug
compiler=qcc
compiler.libcxx=cxx
compiler.version=8.3
jlr_platform_target=cccm
os=Neutrino
os.version=7.1
[options]
[build_requires]
[env]
CC=qcc
CFLAGS=-Vgcc_ntoaarch64le -Y_cxx -D_QNX_SOURCE
CXX=q++
CXXFLAGS=-Vgcc_ntoaarch64le -Y_cxx -D_QNX_SOURCE
MAKEFLAGS=-I/root/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/target/qnx7/usr/include
PATH=/root/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/host/linux/x86_64/usr/bin:/root/.qnx/bin:/root/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/jre/bin:/root/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/host/common/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
PYTHONDONTWRITEBYTECODE=1
QNX_CONFIGURATION=/root/.qnx
QNX_CONFIGURATION_EXCLUSIVE=/root/.qnx
QNX_HOST=/root/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/host/linux/x86_64
QNX_TARGET=/root/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/target/qnx7
[conf]
tools.cmake.cmaketoolchain:system_name=QNX
Configuration (profile_build):
[settings]
arch=x86_64
arch_build=x86_64
build_type=Release
compiler=gcc
compiler.libcxx=libstdc++11
compiler.version=11
jlr_platform_target=x86_64
os=Linux
os_build=Linux
[options]
[build_requires]
[env]
openssl/3.2.1: Retrieving from server 'conancenter'
openssl/3.2.1: Trying with 'conancenter'...
Downloading conanmanifest.txt
Downloading conanfile.py
Downloading conan_export.tgz
openssl/3.2.1: Downloaded recipe revision 0
zlib/1.3.1: Retrieving from server 'conancenter'
zlib/1.3.1: Trying with 'conancenter'...
Downloading conanmanifest.txt
Downloading conanfile.py
Downloading conan_export.tgz
zlib/1.3.1: Downloaded recipe revision 0
zlib/1.3.1: Forced build from source
openssl/3.2.1: Forced build from source
Version ranges solved
zlib/* versions found in 'conancenter' remote
Version range '>=1.2.11 <2' required by 'openssl/3.2.1' resolved to 'zlib/1.3.1' in remote 'conancenter'
Installing package: openssl/3.2.1
Requirements
openssl/3.2.1 from 'conancenter' - Downloaded
zlib/1.3.1 from 'conancenter' - Downloaded
Packages
openssl/3.2.1:97251b3c4ffb4424af2be180c1c97471dab66360 - Build
zlib/1.3.1:4db21118e429c251335f35fd1e6bdd64269d69af - Build
Cross-build from 'Linux:x86_64' to 'Neutrino:armv8'
Installing (downloading, building) binaries...
Downloading conan_sources.tgz
zlib/1.3.1: Configuring sources in /root/.conan/data/zlib/1.3.1///source/src
zlib/1.3.1:
zlib/1.3.1: Copying sources to build folder
zlib/1.3.1: Building your package in /root/.conan/data/zlib/1.3.1///build/4db21118e429c251335f35fd1e6bdd64269d69af
zlib/1.3.1: Generator txt created conanbuildinfo.txt
zlib/1.3.1: Calling generate()
zlib/1.3.1: Preset 'debug' added to CMakePresets.json. Invoke it manually using 'cmake --preset debug'
zlib/1.3.1: If your CMake version is not compatible with CMakePresets (<3.19) call cmake like: 'cmake
lflags => add(""),
shared_cflag => "-fPIC",
},
); openssl/3.2.1: Aggregating env generators openssl/3.2.1: Calling build() openssl/3.2.1: apply_conandata_patches(): No patches defined in conandata Configuring OpenSSL version 3.2.1 for target conan-Debug-Neutrino-armv8-qcc-8.3 Using os-specific seed configuration Created configdata.pm Running configdata.pm Created Makefile.in Created Makefile Created include/openssl/configuration.h
*** OpenSSL has been successfully configured ***
*** If you encounter a problem while building, please open an *** *** issue on GitHub https://github.com/openssl/openssl/issues *** *** and include the output from the following command: ***
*** perl configdata.pm --dump ***
*** (If you are new to OpenSSL, you might want to consult the *** *** 'Troubleshooting' section in the INSTALL.md file first) ***
perl "-I." "-Iutil/perl" "-Mconfigdata" "-MOpenSSL::paramnames" "util/dofile.pl" "-oMakefile" crypto/params_idx.c.in > crypto/params_idx.c perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/crypto/bn_conf.h.in > include/crypto/bn_conf.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/crypto/dso_conf.h.in > include/crypto/dso_conf.h perl "-I." "-Iutil/perl" "-Mconfigdata" "-MOpenSSL::paramnames" "util/dofile.pl" "-oMakefile" include/internal/param_names.h.in > include/internal/param_names.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/asn1.h.in > include/openssl/asn1.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/asn1t.h.in > include/openssl/asn1t.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/bio.h.in > include/openssl/bio.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/cmp.h.in > include/openssl/cmp.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/cms.h.in > include/openssl/cms.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/conf.h.in > include/openssl/conf.h perl "-I." "-Iutil/perl" "-Mconfigdata" "-MOpenSSL::paramnames" "util/dofile.pl" "-oMakefile" include/openssl/core_names.h.in > include/openssl/core_names.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/crmf.h.in > include/openssl/crmf.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/crypto.h.in > include/openssl/crypto.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/ct.h.in > include/openssl/ct.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/err.h.in > include/openssl/err.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/ess.h.in > include/openssl/ess.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/fipskey.h.in > include/openssl/fipskey.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/lhash.h.in > include/openssl/lhash.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/ocsp.h.in > include/openssl/ocsp.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/opensslv.h.in > include/openssl/opensslv.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/pkcs12.h.in > include/openssl/pkcs12.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/pkcs7.h.in > include/openssl/pkcs7.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/safestack.h.in > include/openssl/safestack.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/srp.h.in > include/openssl/srp.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/ssl.h.in > include/openssl/ssl.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/ui.h.in > include/openssl/ui.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/x509.h.in > include/openssl/x509.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/x509_vfy.h.in > include/openssl/x509_vfy.h perl "-I." "-Mconfigdata" "util/dofile.pl" "-oMakefile" include/openssl/x509v3.h.in > include/openssl/x509v3.h make depend && make build_sw make[1]: Entering directory '/root/.conan/data/openssl/3.2.1///build/97251b3c4ffb4424af2be180c1c97471dab66360/src' make[1]: Leaving directory '/root/.conan/data/openssl/3.2.1///build/97251b3c4ffb4424af2be180c1c97471dab66360/src' make[1]: Entering directory '/root/.conan/data/openssl/3.2.1///build/97251b3c4ffb4424af2be180c1c97471dab66360/src' qcc -I. -Iinclude -Iapps/include -fPIC -g -Vgcc_ntoaarch64le -Y_cxx -D_QNX_SOURCE -fPIC -g -fPIC -DOPENSSLDIR=""/root/.conan/data/openssl/3.2.1///package/97251b3c4ffb4424af2be180c1c97471dab66360/res"" -DENGINESDIR=""//lib/engines-3"" -DMODULESDIR=""//lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DZLIB -I/root/.conan/data/zlib/1.3.1///package/4db21118e429c251335f35fd1e6bdd64269d69af/include -DOPENSSL_TLS_SECURITY_LEVEL=2 -MMD -MF apps/lib/libapps-lib-app_libctx.d.tmp -MT apps/lib/libapps-lib-app_libctx.o -c -o apps/lib/libapps-lib-app_libctx.o apps/lib/app_libctx.c qcc -I. -Iinclude -Iapps/include -fPIC -g -Vgcc_ntoaarch64le -Y_cxx -D_QNX_SOURCE -fPIC -g -fPIC -DOPENSSLDIR=""/root/.conan/data/openssl/3.2.1///package/97251b3c4ffb4424af2be180c1c97471dab66360/res"" -DENGINESDIR=""//lib/engines-3"" -DMODULESDIR=""//lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DZLIB -I/root/.conan/data/zlib/1.3.1///package/4db21118e429c251335f35fd1e6bdd64269d69af/include -DOPENSSL_TLS_SECURITY_LEVEL=2 -MMD -MF apps/lib/libapps-lib-app_params.d.tmp -MT apps/lib/libapps-lib-app_params.o -c -o apps/lib/libapps-lib-app_params.o apps/lib/app_params.c qcc -I. -Iinclude -Iapps/include -fPIC -g -Vgcc_ntoaarch64le -Y_cxx -D_QNX_SOURCE -fPIC -g -fPIC -DOPENSSLDIR=""/root/.conan/data/openssl/3.2.1///package/97251b3c4ffb4424af2be180c1c97471dab66360/res"" -DENGINESDIR=""//lib/engines-3"" -DMODULESDIR=""//lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DZLIB -I/root/.conan/data/zlib/1.3.1///package/4db21118e429c251335f35fd1e6bdd64269d69af/include -DOPENSSL_TLS_SECURITY_LEVEL=2 -MMD -MF apps/lib/libapps-lib-app_provider.d.tmp -MT apps/lib/libapps-lib-app_provider.o -c -o apps/lib/libapps-lib-app_provider.o apps/lib/app_provider.c qcc -I. -Iinclude -Iapps/include -fPIC -g -Vgcc_ntoaarch64le -Y_cxx -D_QNX_SOURCE -fPIC -g -fPIC -DOPENSSLDIR=""/root/.conan/data/openssl/3.2.1///package/97251b3c4ffb4424af2be180c1c97471dab66360/res"" -DENGINESDIR=""//lib/engines-3"" -DMODULESDIR=""//lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DZLIB -I/root/.conan/data/zlib/1.3.1///package/4db21118e429c251335f35fd1e6bdd64269d69af/include -DOPENSSL_TLS_SECURITY_LEVEL=2 -MMD -MF apps/lib/libapps-lib-app_rand.d.tmp -MT apps/lib/libapps-lib-app_rand.o -c -o apps/lib/libapps-lib-app_rand.o apps/lib/app_rand.c qcc -I. -Iinclude -Iapps/include -fPIC -g -Vgcc_ntoaarch64le -Y_cxx -D_QNX_SOURCE -fPIC -g -fPIC -DOPENSSLDIR=""/root/.conan/data/openssl/3.2.1///package/97251b3c4ffb4424af2be180c1c97471dab66360/res"" -DENGINESDIR=""//lib/engines-3"" -DMODULESDIR=""//lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DZLIB -I/root/.conan/data/zlib/1.3.1///package/4db21118e429c251335f35fd1e6bdd64269d69af/include -DOPENSSL_TLS_SECURITY_LEVEL=2 -MMD -MF apps/lib/libapps-lib-app_x509.d.tmp -MT apps/lib/libapps-lib-app_x509.o -c -o apps/lib/libapps-lib-app_x509.o apps/lib/app_x509.c qcc -I. -Iinclude -Iapps/include -fPIC -g -Vgcc_ntoaarch64le -Y_cxx -D_QNX_SOURCE -fPIC -g -fPIC -DOPENSSLDIR=""/root/.conan/data/openssl/3.2.1///package/97251b3c4ffb4424af2be180c1c97471dab66360/res"" -DENGINESDIR=""//lib/engines-3"" -DMODULESDIR=""//lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DZLIB -I/root/.conan/data/zlib/1.3.1///package/4db21118e429c251335f35fd1e6bdd64269d69af/include -DOPENSSL_TLS_SECURITY_LEVEL=2 -MMD -MF apps/lib/libapps-lib-apps.d.tmp -MT apps/lib/libapps-lib-apps.o -c -o apps/lib/libapps-lib-apps.o apps/lib/apps.c qcc -I. -Iinclude -Iapps/include -fPIC -g -Vgcc_ntoaarch64le -Y_cxx -D_QNX_SOURCE -fPIC -g -fPIC -DOPENSSLDIR=""/root/.conan/data/openssl/3.2.1///package/97251b3c4ffb4424af2be180c1c97471dab66360/res"" -DENGINESDIR=""//lib/engines-3"" -DMODULESDIR=""//lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DZLIB -I/root/.conan/data/zlib/1.3.1///package/4db21118e429c251335f35fd1e6bdd64269d69af/include -DOPENSSL_TLS_SECURITY_LEVEL=2 -MMD -MF apps/lib/libapps-lib-apps_opt_printf.d.tmp -MT apps/lib/libapps-lib-apps_opt_printf.o -c -o apps/lib/libapps-lib-apps_opt_printf.o apps/lib/apps_opt_printf.c qcc -I. -Iinclude -Iapps/include -fPIC -g -Vgcc_ntoaarch64le -Y_cxx -D_QNX_SOURCE -fPIC -g -fPIC -DOPENSSLDIR=""/root/.conan/data/openssl/3.2.1///package/97251b3c4ffb4424af2be180c1c97471dab66360/res"" -DENGINESDIR=""//lib/engines-3"" -DMODULESDIR=""//lib/ossl-modules"" -DOPENSSL_BUILDING_OPENSSL -DZLIB -I/root/.conan/data/zlib/1.3.1///package/4db21118e429c251335f35fd1e6bdd64269d69af/include -DOPENSSL_TLS_SECURITY_LEVEL=2 -MMD -MF apps/lib/libapps-lib-apps_ui.d.tmp -MT apps/lib/libapps-lib-apps_ui.o -c -o apps/lib/libapps-lib-apps_ui.o apps/lib/apps_ui.c cc: Can't specify -P, -C, -E, -c or -S with -o and have multiple files cc: Can't specify -P, -C, -E, -c or -S with -o and have multiple files cc: Can't specify -P, -C, -E, -c or -S with -o and have multiple files cc: Can't specify -P, -C, -E, -c or -S with -o and have multiple files cc: Can't specify -P, -C, -E, -c or -S with -o and have multiple files cc: Can't specify -P, -C, -E, -c or -S with -o and have multiple files cc: Can't specify -P, -C, -E, -c or -S with -o and have multiple files Makefile:3886: recipe for target 'apps/lib/libapps-lib-apps_opt_printf.o' failed make[1]: *** [apps/lib/libapps-lib-apps_opt_printf.o] Error 1 make[1]: *** Waiting for unfinished jobs.... Makefile:3838: recipe for target 'apps/lib/libapps-lib-app_libctx.o' failed make[1]: *** [apps/lib/libapps-lib-app_libctx.o] Error 1 cc: Can't specify -P, -C, -E, -c or -S with -o and have multiple files Makefile:3846: recipe for target 'apps/lib/libapps-lib-app_params.o' failed make[1]: *** [apps/lib/libapps-lib-app_params.o] Error 1 Makefile:3878: recipe for target 'apps/lib/libapps-lib-apps.o' failed make[1]: *** [apps/lib/libapps-lib-apps.o] Error 1 Makefile:3894: recipe for target 'apps/lib/libapps-lib-apps_ui.o' failed make[1]: *** [apps/lib/libapps-lib-apps_ui.o] Error 1 Makefile:3870: recipe for target 'apps/lib/libapps-lib-app_x509.o' failed make[1]: *** [apps/lib/libapps-lib-app_x509.o] Error 1 Makefile:3854: recipe for target 'apps/lib/libapps-lib-app_provider.o' failed make[1]: *** [apps/lib/libapps-lib-app_provider.o] Error 1 Makefile:3862: recipe for target 'apps/lib/libapps-lib-app_rand.o' failed make[1]: *** [apps/lib/libapps-lib-app_rand.o] Error 1 make[1]: Leaving directory '/root/.conan/data/openssl/3.2.1///build/97251b3c4ffb4424af2be180c1c97471dab66360/src' Makefile:2315: recipe for target 'build_sw' failed make: *** [build_sw] Error 2 openssl/3.2.1: openssl/3.2.1: ERROR: Package '97251b3c4ffb4424af2be180c1c97471dab66360' build failed openssl/3.2.1: WARN: Build folder /root/.conan/data/openssl/3.2.1//_/build/97251b3c4ffb4424af2be180c1c97471dab66360/build-debug ERROR: openssl/3.2.1: Error in build() method, line 534 self._make() while calling '_make', line 526 self._run_make() while calling '_run_make', line 503 self.run(" ".join(command), env="conanbuild") ConanException: Error 2 while executing make -j8
Hi @MikeyH84
Thanks for your report.
Unfortunately, I don't have qcc to test it here.
Download and install QNX SDP toolchain into local system.
Is there a free download available? Do you have a link?
But maybe some hint that could be related: [env] is deprecated in favor of [buildenv]. Only [buildenv] is 2.0-ready, so this is the recommended way. It is possible that some recipes in ConanCenter do only follow [buildenv] but no longer [env]. Check https://docs.conan.io/1/reference/profiles.html#buildenv
Doing the exact same process for many other Yocto based SDK toolchains
What does this mean? Are you able to build many other Conan packages from ConanCenter with this same configuration?
A good way to quickly check if things work is using conan new hello/0.1 -m=cmake_lib or -m=autotools_lib to have out of the box templates that should work with conan create . -pr:b=mybuild -pr:h=myhost. Does your profiles configuration work fine for these templates?
Hi @memsharded,
sorry for the late reply, was trying some things out.
So cross-compiling with QNX in Conan, from what little information I can find online, seems that Conan profiles are not enough on their own. Even though I've put the QNX source'd environment variables into the profiles.
I think CMake error cc: Can't specify -P, -C, -E, -c or -S with -o and have multiple files is just indicating that CMake was configured badly, and whatever compile commands were attempted are broken.
I was able to get past this error by adding a QNX toolchain representing the TARGET.
You're idea of building helloworld was good, as it found I needed the QNX toolchain.
I also added the Conan profile section buildenv as per your advice.
I have been running tests attempting to build helloworld, protobuf, and openssl, all using the same profiles and toolchains:
Conan create/install commands
conan create . \
-pr:h=conan-profile-host \
-pr:b=conan-profile-build
conan install protobuf/3.21.12@ \
-pr:h=conan-profile-host \
-pr:b=conan-profile-build \
--build \
-r conancenter
conan install openssl/3.2.1@ \
--options openssl:no_async=True \
-pr:h=conan-profile-host \
-pr:b=conan-profile-build \
--build \
-r conancenter
Conan build profile
[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=10
compiler.libcxx=libstdc++11
build_type=Debug
[options]
[build_requires]
[env]
Conan host profile
[settings]
os.version=7.1
compiler=qcc
compiler.version=8.3
compiler.libcxx=cxx
arch=armv8
build_type=Debug
[options]
[build_requires]
[env]
CONAN_CMAKE_TOOLCHAIN_FILE=/home/mhadley4/.conan/data/ci/0.0.189/jlr/qnx-profiles-test-part-2-1-ge342fa7/package/d3058fa461095e3b567f10d3a72b4fac1de53cda/toolchain/qcc-armv8.cmake
MAKEFLAGS=-I/home/mhadley4/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/target/qnx7/usr/include
PATH=/usr/bin:/home/mhadley4/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/host/linux/x86_64/usr/bin:/home/mhadley4/.qnx/bin:/home/mhadley4/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/jre/bin:/home/mhadley4/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/host/common/bin:/home/mhadley4/work/gcp/obg/obg-shared/build/host/linux/x86_64/usr/bin:/home/mhadley4/.qnx/bin:/home/mhadley4/work/gcp/obg/obg-shared/build/jre/bin:/home/mhadley4/work/gcp/obg/obg-shared/build/host/common/bin:/home/mhadley4/work/gcp/obg/obg-shared/build/host/linux/x86_64/usr/bin:/home/mhadley4/.qnx/bin:/home/mhadley4/work/gcp/obg/obg-shared/build/jre/bin:/home/mhadley4/work/gcp/obg/obg-shared/build/host/common/bin:/home/mhadley4/.local/bin:/home/mhadley4/.local/bin:/home/mhadley4/.local/bin:/home/mhadley4/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
QNX_HOST=/home/mhadley4/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/host/linux/x86_64
QNX_TARGET=/home/mhadley4/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/target/qnx7
[conf]
tools.build.compiler_executables:system_name={'c': 'qcc', 'cpp': 'q++'}
tools.build.cflags:system_name=['-Vgcc_ntoaarch64le', '-Y_cxx']
tools.build.cxxflags:system_name=['-Vgcc_ntoaarch64le', '-Y_cxx']
tools.cmake.cmaketoolchain:user_toolchain=['/home/mhadley4/.conan/data/ci/0.0.189/jlr/qnx-profiles-test-part-2-1-ge342fa7/package/d3058fa461095e3b567f10d3a72b4fac1de53cda/toolchain/qcc-armv8.cmake']
[buildenv]
CONAN_CMAKE_TOOLCHAIN_FILE=/home/mhadley4/.conan/data/ci/0.0.189/jlr/qnx-profiles-test-part-2-1-ge342fa7/package/d3058fa461095e3b567f10d3a72b4fac1de53cda/toolchain/qcc-armv8.cmake
MAKEFLAGS=-I/home/mhadley4/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/target/qnx7/usr/include
PATH=/usr/bin:/home/mhadley4/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/host/linux/x86_64/usr/bin:/home/mhadley4/.qnx/bin:/home/mhadley4/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/jre/bin:/home/mhadley4/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/host/common/bin:/home/mhadley4/work/gcp/obg/obg-shared/build/host/linux/x86_64/usr/bin:/home/mhadley4/.qnx/bin:/home/mhadley4/work/gcp/obg/obg-shared/build/jre/bin:/home/mhadley4/work/gcp/obg/obg-shared/build/host/common/bin:/home/mhadley4/work/gcp/obg/obg-shared/build/host/linux/x86_64/usr/bin:/home/mhadley4/.qnx/bin:/home/mhadley4/work/gcp/obg/obg-shared/build/jre/bin:/home/mhadley4/work/gcp/obg/obg-shared/build/host/common/bin:/home/mhadley4/.local/bin:/home/mhadley4/.local/bin:/home/mhadley4/.local/bin:/home/mhadley4/.local/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/snap/bin
QNX_HOST=/home/mhadley4/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/host/linux/x86_64
QNX_TARGET=/home/mhadley4/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/target/qnx7
CMake QNX target toolchain (aarch64le)
if("$ENV{QNX_HOST}" STREQUAL "")
message(FATAL_ERROR "QNX_HOST environment variable not found. Please set the variable to your host's build tools")
endif()
if("$ENV{QNX_TARGET}" STREQUAL "")
message(FATAL_ERROR "QNX_TARGET environment variable not found. Please set the variable to the QNX target location")
endif()
set(QNX_HOST "$ENV{QNX_HOST}")
set(QNX_TARGET "$ENV{QNX_TARGET}")
set(CMAKE_SYSTEM_PROCESSOR "aarch64")
set(CMAKE_SYSTEM_NAME QNX)
set(CMAKE_SYSTEM_VERSION 7.1.0)
set(QNX_HOST_BIN "${QNX_HOST}/usr/bin")
set(QNX_FLAGS
" \
-fsigned-char -fstack-protector-all -D_QNX_SOURCE -DVARIANT_le \
-DBUILDENV_qss -Vgcc_ntoaarch64le -Wall -Wformat -Wformat-security \
-Werror=format-security -Y_cxx -D_FORTIFY_SOURCE=2 \
")
set(CMAKE_MAKE_PROGRAM
"${QNX_HOST_BIN}/make"
CACHE PATH "QNX Make Program")
set(CMAKE_SH
"${QNX_HOST_BIN}/sh"
CACHE PATH "QNX shell Program")
set(CMAKE_AR
"${QNX_HOST_BIN}/nto${CMAKE_SYSTEM_PROCESSOR}-ar"
CACHE PATH "QNX ar Program")
set(CMAKE_LD
"${QNX_HOST_BIN}/nto${CMAKE_SYSTEM_PROCESSOR}-ld"
CACHE PATH "QNX ar Program")
set(CMAKE_RANLIB
"${QNX_HOST_BIN}/nto${CMAKE_SYSTEM_PROCESSOR}-ranlib"
CACHE PATH "QNX ranlib Program")
set(CMAKE_NM
"${QNX_HOST_BIN}/nto${CMAKE_SYSTEM_PROCESSOR}-nm"
CACHE PATH "QNX nm Program")
set(CMAKE_OBJCOPY
"${QNX_HOST_BIN}/nto${CMAKE_SYSTEM_PROCESSOR}-objcopy"
CACHE PATH "QNX objcopy Program")
set(CMAKE_OBJDUMP
"${QNX_HOST_BIN}/nto${CMAKE_SYSTEM_PROCESSOR}-objdump"
CACHE PATH "QNX objdump Program")
set(CMAKE_LINKER
"${QNX_HOST_BIN}/nto${CMAKE_SYSTEM_PROCESSOR}-ld"
CACHE PATH "QNX Linker Program")
set(CMAKE_STRIP
"${QNX_HOST_BIN}/nto${CMAKE_SYSTEM_PROCESSOR}-strip"
CACHE PATH "QNX Strip Program")
set(CMAKE_C_COMPILER ${QNX_HOST_BIN}/qcc)
set(CMAKE_C_FLAGS_INIT "${QNX_FLAGS}")
set(CMAKE_C_FLAGS_DEBUG_INIT "-O0 -g")
set(CMAKE_C_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
set(CMAKE_C_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
set(CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "-O2 -DNDEBUG -g")
set(CMAKE_CXX_COMPILER ${QNX_HOST_BIN}/q++)
set(CMAKE_CXX_FLAGS "${QNX_FLAGS}")
set(CMAKE_CXX_FLAGS_DEBUG_INIT "-O0 -g")
set(CMAKE_CXX_FLAGS_MINSIZEREL_INIT "-Os -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELEASE_INIT "-O3 -DNDEBUG")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO_INIT "-O2 -DNDEBUG -g")
set(CMAKE_C_STANDARD_DEFAULT "11")
set(CMAKE_C90_STANDARD_COMPILE_OPTION "--std-c89")
set(CMAKE_C90_EXTENSION_COMPILE_OPTION "--std-sdcc89")
set(CMAKE_C99_STANDARD_COMPILE_OPTION "--std-c99")
set(CMAKE_C99_EXTENSION_COMPILE_OPTION "--std-sdcc99")
set(CMAKE_C11_STANDARD_COMPILE_OPTION "--std-c11")
set(CMAKE_C11_EXTENSION_COMPILE_OPTION "--std-sdcc11")
set(CMAKE_CXX_STANDARD_DEFAULT "11")
set(CMAKE_CXX11_STANDARD_COMPILE_OPTION "-std=c++11")
set(CMAKE_CXX11_EXTENSION_COMPILE_OPTION "-std=gnu++11")
set(CMAKE_CXX11_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_CXX14_STANDARD_COMPILE_OPTION "-std=c++14")
set(CMAKE_CXX14_EXTENSION_COMPILE_OPTION "-std=gnu++14")
set(CMAKE_CXX14_STANDARD__HAS_FULL_SUPPORT ON)
set(CMAKE_CXX17_STANDARD_COMPILE_OPTION "-std=c++17")
set(CMAKE_CXX17_EXTENSION_COMPILE_OPTION "-std=gnu++17")
set(CMAKE_CXX17_STANDARD__HAS_FULL_SUPPORT OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie")
set(CMAKE_INCLUDE_SYSTEM_FLAG_C "-isystem ")
set(CMAKE_INCLUDE_SYSTEM_FLAG_CXX "-isystem ")
set(CMAKE_FIND_ROOT_PATH ${QNX_TARGET};${QNX_TARGET}/aarch64le)
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
Results
This combination succesfully builds both helloworld and Protobuf for QNX. OpenSSL fails with the following error:
${LDCMD:-cc} -fPIC -g -fPIC -g -fPIC -L/root/.conan/data/zlib/1.3.1/_/_/package/4db21118e429c251335f35fd1e6bdd64269d69af/lib \
-o util/quicserver \
util/quicserver-bin-quicserver.o \
libssl.a libcrypto.a -lz -lsocket -latomic
The linker cannot find -lsocket
See full log if required - log.txt
Deep dive
Comparing a successful x86_64 OpenSSL build and unsuccessful QNX build:
x86_64
${LDCMD:-gcc} -pthread -m64 -m64 -fPIC -g -Wa,--noexecstack -m64 -fPIC -g -fPIC -L/root/.conan/data/zlib/1.3.1/_/_/package/75e99b627c196b65c439728670655ec3c366b334/lib -m64 -m64 \
-o util/quicserver \
util/quicserver-bin-quicserver.o \
libssl.a libcrypto.a -lz -ldl -pthread
QNX
${LDCMD:-cc} -fPIC -g -fPIC -g -fPIC -L/root/.conan/data/zlib/1.3.1/_/_/package/4db21118e429c251335f35fd1e6bdd64269d69af/lib \
-o util/quicserver \
util/quicserver-bin-quicserver.o \
libssl.a libcrypto.a -lz -lsocket -latomic
Note the only major difference is x86_64 does not append -lsocket to the linker.
Can see the OpenSSL Conan recipe doing so here
Just to clarify, socket is part of the QNX SDP I am using
find . -name *socket*
./host/linux/x86_64/usr/lib/python3.8/lib-dynload/_socket.cpython-38-x86_64-linux-gnu.so
./host/linux/x86_64/usr/lib/python3.8/socketserver.py
./host/linux/x86_64/usr/lib/python3.8/socket.py
./host/linux/x86_64/usr/lib/python3.8/__pycache__/socketserver.cpython-38.pyc
./host/linux/x86_64/usr/lib/python3.8/__pycache__/socketserver.cpython-38.opt-1.pyc
./host/linux/x86_64/usr/lib/python3.8/__pycache__/socket.cpython-38.opt-2.pyc
./host/linux/x86_64/usr/lib/python3.8/__pycache__/socket.cpython-38.pyc
./host/linux/x86_64/usr/lib/python3.8/__pycache__/socketserver.cpython-38.opt-2.pyc
./host/linux/x86_64/usr/lib/python3.8/__pycache__/socket.cpython-38.opt-1.pyc
./target/qnx7/usr/lib/python3.8/socketserver.py
./target/qnx7/usr/lib/python3.8/socket.py
./target/qnx7/usr/include/pcap/socket.h
./target/qnx7/usr/include/pcap/can_socketcan.h
./target/qnx7/usr/include/fs/f3s_socket.h
./target/qnx7/usr/include/sys/socketvar.h
./target/qnx7/usr/include/sys/socket.h
./target/qnx7/x86_64/lib/libsocket.so
./target/qnx7/x86_64/lib/libsocketS.a
./target/qnx7/x86_64/lib/libsocket.so.3.sym
./target/qnx7/x86_64/lib/libsocket.a
./target/qnx7/x86_64/lib/libsocket.so.3
./target/qnx7/x86_64/usr/lib/python3.8/lib-dynload/_socket.cpython-38.so
./target/qnx7/x86_64/usr/lib/python3.8/lib-dynload/_socket.cpython-38.so.sym
./target/qnx7/aarch64le/lib/libsocket.so
./target/qnx7/aarch64le/lib/libsocketS.a
./target/qnx7/aarch64le/lib/libsocket.so.3.sym
./target/qnx7/aarch64le/lib/libsocket.a
./target/qnx7/aarch64le/lib/libsocket.so.3
./target/qnx7/aarch64le/usr/lib/python3.8/lib-dynload/_socket.cpython-38.so
./target/qnx7/aarch64le/usr/lib/python3.8/lib-dynload/_socket.cpython-38.so.sym
@memsharded I think I need to pass the CMake toolchain to OpenSSL. Am I doing that correctly in my profile? Its almost like the OpenSSL does not know about my QNX toolchain containing the CMake QNX_TARGET variable.
Thanks
Hi, I am facing issue related openssl cross compiling. @memsharded [https://github.com/conan-io/conan-center-index/issues/24968]
Hi @vineethabc - thanks for providing additional details.
I think I need to pass the CMake toolchain to OpenSSL
OpenSSL uses its own build system, which is not CMake - so I suspect the recipe itself may need to be fixed to support QNX. We do not have a QNX SDP available to test, so we rely on community contributors for this. I think upstream OpenSSL actually doesn't currently support QNX, as per:
- https://github.com/openssl/openssl/pull/5756/files
- https://github.com/openssl/openssl/issues/22257
If it has even worked with the Conan Center recipe, it's due to community contributions.
-lsocket should be correct in QNX
Based on the logs you have provided:
${LDCMD:-cc} -fPIC -g -fPIC -g -fPIC -L/root/.conan/data/zlib/1.3.1/_/_/package/4db21118e429c251335f35fd1e6bdd64269d69af/lib \
-o util/quicserver \
util/quicserver-bin-quicserver.o \
libssl.a libcrypto.a -lz -lsocket -latomic
/usr/bin/ld: skipping incompatible /root/.conan/data/zlib/1.3.1/_/_/package/4db21118e429c251335f35fd1e6bdd64269d69af/lib/libz.a when searching for -lz
/usr/bin/ld: cannot find -lsocket: No such file or directory
The issue seems to be that it is using /usr/bin/ld - which is probably not correct and it should be using a file from the QNX SDK instead.
So I think the recipe needs to be changed, at the very least so that it tries to use qcc as the compiler.
If I remember correctly, as an alternative, QNX does come with OpenSSL https://www.qnx.com/developers/docs/7.1/index.html#com.qnx.doc.core_networking/topic/security_OpenSSL.html
So you may choose to tell Conan to assumpe it is a system library: https://docs.conan.io/2/reference/config_files/profiles.html#platform-requires
in your profile:
[platform_requires]
openssl/3.2.1
for a lot of recipes this should "just work" - but let us know if that is not the case!