conan-io / conan

Conan - The open-source C and C++ package manager
https://conan.io
MIT License
7.97k stars 952 forks source link

[bug] Failure to cross-compile OpenSSL for QNX #15752

Open MikeyH84 opened 4 months ago

MikeyH84 commented 4 months ago

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

  1. Download and install QNX SDP toolchain into local system.
  2. Source SDP toolchain and capture environment variables
  3. Add environment variables to QNX Conan profile.
  4. 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 conansources.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 -G "Unix Makefiles" -DCMAKE_TOOLCHAINFILE=/root/.conan/data/zlib/1.3.1//_/build/4db21118e429c251335f35fd1e6bdd64269d69af/build/Debug/generators/conan_toolchain.cmake -DCMAKE_POLICY_DEFAULT_CMP0091=NEW -DCMAKE_BUILD_TYPE=Debug' zlib/1.3.1: Aggregating env generators zlib/1.3.1: Calling build() zlib/1.3.1: Apply patch (conan): separate static/shared builds, disable debug suffix zlib/1.3.1: CMake command: cmake -G "Unix Makefiles" -DCMAKE_TOOLCHAINFILE="/root/.conan/data/zlib/1.3.1//_/build/4db21118e429c251335f35fd1e6bdd64269d69af/build/Debug/generators/conan_toolchain.cmake" -DCMAKE_INSTALLPREFIX="/root/.conan/data/zlib/1.3.1//_/package/4db21118e429c251335f35fd1e6bdd64269d69af" -DCMAKE_POLICY_DEFAULT_CMP0091="NEW" -DCMAKE_BUILDTYPE="Debug" "/root/.conan/data/zlib/1.3.1///build/4db21118e429c251335f35fd1e6bdd64269d69af/src" -- Using Conan toolchain: /root/.conan/data/zlib/1.3.1//_/build/4db21118e429c251335f35fd1e6bdd64269d69af/build/Debug/generators/conan_toolchain.cmake -- Conan toolchain: Setting CMAKE_POSITION_INDEPENDENT_CODE=ON (options.fPIC) -- Conan toolchain: Setting BUILD_SHARED_LIBS = OFF -- The C compiler identification is QCC 8.3.0 -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working C compiler: /root/.conan/data/qnx-sdp-vdc-armv8/701/jlr/prd/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/host/linux/x86_64/usr/bin/qcc - skipped -- Detecting C compile features -- Detecting C compile features - done -- Looking for sys/types.h -- Looking for sys/types.h - found -- Looking for stdint.h -- Looking for stdint.h - found -- Looking for stddef.h -- Looking for stddef.h - found -- Check size of off64_t -- Check size of off64t - done -- Looking for fseeko -- Looking for fseeko - found -- Looking for unistd.h -- Looking for unistd.h - found -- Renaming -- /root/.conan/data/zlib/1.3.1//_/build/4db21118e429c251335f35fd1e6bdd64269d69af/src/zconf.h -- to 'zconf.h.included' because this file is included with zlib -- but CMake generates it automatically in the build directory. -- Configuring done -- Generating done CMake Warning: Manually-specified variables were not used by the project: CMAKE_POLICY_DEFAULTCMP0091 -- Build files have been written to: /root/.conan/data/zlib/1.3.1///build/4db21118e429c251335f35fd1e6bdd64269d69af/build/Debug zlib/1.3.1: CMake command: cmake --build "/root/.conan/data/zlib/1.3.1///build/4db21118e429c251335f35fd1e6bdd64269d69af/build/Debug" '--' '-j8' [ 18%] Building C object CMakeFiles/zlib.dir/compress.c.o [ 18%] Building C object CMakeFiles/zlib.dir/deflate.c.o [ 18%] Building C object CMakeFiles/zlib.dir/adler32.c.o [ 25%] Building C object CMakeFiles/zlib.dir/crc32.c.o [ 31%] Building C object CMakeFiles/zlib.dir/gzread.c.o [ 37%] Building C object CMakeFiles/zlib.dir/gzclose.c.o [ 43%] Building C object CMakeFiles/zlib.dir/gzwrite.c.o [ 50%] Building C object CMakeFiles/zlib.dir/gzlib.c.o [ 56%] Building C object CMakeFiles/zlib.dir/inflate.c.o [ 62%] Building C object CMakeFiles/zlib.dir/infback.c.o [ 68%] Building C object CMakeFiles/zlib.dir/inftrees.c.o [ 75%] Building C object CMakeFiles/zlib.dir/inffast.c.o [ 81%] Building C object CMakeFiles/zlib.dir/zutil.c.o [ 87%] Building C object CMakeFiles/zlib.dir/trees.c.o [ 93%] Building C object CMakeFiles/zlib.dir/uncompr.c.o [100%] Linking C static library libz.a [100%] Built target zlib zlib/1.3.1: Package '4db21118e429c251335f35fd1e6bdd64269d69af' built zlib/1.3.1: Build folder /root/.conan/data/zlib/1.3.1///build/4db21118e429c251335f35fd1e6bdd64269d69af/build/Debug zlib/1.3.1: Generated conaninfo.txt zlib/1.3.1: Generated conanbuildinfo.txt zlib/1.3.1: Generating the package zlib/1.3.1: Package folder /root/.conan/data/zlib/1.3.1///package/4db21118e429c251335f35fd1e6bdd64269d69af zlib/1.3.1: Calling package() zlib/1.3.1: CMake command: cmake --install "/root/.conan/data/zlib/1.3.1///build/4db21118e429c251335f35fd1e6bdd64269d69af/build/Debug" --prefix "/root/.conan/data/zlib/1.3.1///package/4db21118e429c251335f35fd1e6bdd64269d69af" -- Install configuration: "Debug" -- Installing: /root/.conan/data/zlib/1.3.1///package/4db21118e429c251335f35fd1e6bdd64269d69af/lib/libz.a -- Installing: /root/.conan/data/zlib/1.3.1///package/4db21118e429c251335f35fd1e6bdd64269d69af/include/zconf.h -- Installing: /root/.conan/data/zlib/1.3.1///package/4db21118e429c251335f35fd1e6bdd64269d69af/include/zlib.h zlib/1.3.1 package(): Packaged 1 file: LICENSE zlib/1.3.1 package(): Packaged 2 '.h' files: zconf.h, zlib.h zlib/1.3.1 package(): Packaged 1 '.a' file: libz.a zlib/1.3.1: Package '4db21118e429c251335f35fd1e6bdd64269d69af' created zlib/1.3.1: Created package revision 8940d3de1cda38dd98a1c6acf0dd56ad openssl/3.2.1: Configuring sources in /root/.conan/data/openssl/3.2.1///source/src openssl/3.2.1: openssl/3.2.1: Copying sources to build folder openssl/3.2.1: Building your package in /root/.conan/data/openssl/3.2.1//_/build/97251b3c4ffb4424af2be180c1c97471dab66360 openssl/3.2.1: Generator txt created conanbuildinfo.txt openssl/3.2.1: Calling generate() openssl/3.2.1: using target: conan-Debug-Neutrino-armv8-qcc-8.3 -> BASE_unix openssl/3.2.1: my %targets = ( "conan-Debug-Neutrino-armv8-qcc-8.3" => { inherit_from => [ "BASE_unix" ], cflags => add("-fPIC -g"), cxxflags => add("-fPIC -g"),

    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 _buildsw 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_QNXSOURCE -fPIC -g -fPIC -DOPENSSLDIR="\"/root/.conan/data/openssl/3.2.1//_/package/97251b3c4ffb4424af2be180c1c97471dab66360/res\"" -DENGINESDIR="\"//lib/engines-3\"" -DMODULESDIR="\"//lib/ossl-modules\"" -DOPENSSL_BUILDINGOPENSSL -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_QNXSOURCE -fPIC -g -fPIC -DOPENSSLDIR="\"/root/.conan/data/openssl/3.2.1//_/package/97251b3c4ffb4424af2be180c1c97471dab66360/res\"" -DENGINESDIR="\"//lib/engines-3\"" -DMODULESDIR="\"//lib/ossl-modules\"" -DOPENSSL_BUILDINGOPENSSL -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_QNXSOURCE -fPIC -g -fPIC -DOPENSSLDIR="\"/root/.conan/data/openssl/3.2.1//_/package/97251b3c4ffb4424af2be180c1c97471dab66360/res\"" -DENGINESDIR="\"//lib/engines-3\"" -DMODULESDIR="\"//lib/ossl-modules\"" -DOPENSSL_BUILDINGOPENSSL -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_QNXSOURCE -fPIC -g -fPIC -DOPENSSLDIR="\"/root/.conan/data/openssl/3.2.1//_/package/97251b3c4ffb4424af2be180c1c97471dab66360/res\"" -DENGINESDIR="\"//lib/engines-3\"" -DMODULESDIR="\"//lib/ossl-modules\"" -DOPENSSL_BUILDINGOPENSSL -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_QNXSOURCE -fPIC -g -fPIC -DOPENSSLDIR="\"/root/.conan/data/openssl/3.2.1//_/package/97251b3c4ffb4424af2be180c1c97471dab66360/res\"" -DENGINESDIR="\"//lib/engines-3\"" -DMODULESDIR="\"//lib/ossl-modules\"" -DOPENSSL_BUILDINGOPENSSL -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_QNXSOURCE -fPIC -g -fPIC -DOPENSSLDIR="\"/root/.conan/data/openssl/3.2.1//_/package/97251b3c4ffb4424af2be180c1c97471dab66360/res\"" -DENGINESDIR="\"//lib/engines-3\"" -DMODULESDIR="\"//lib/ossl-modules\"" -DOPENSSL_BUILDINGOPENSSL -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_QNXSOURCE -fPIC -g -fPIC -DOPENSSLDIR="\"/root/.conan/data/openssl/3.2.1//_/package/97251b3c4ffb4424af2be180c1c97471dab66360/res\"" -DENGINESDIR="\"//lib/engines-3\"" -DMODULESDIR="\"//lib/ossl-modules\"" -DOPENSSL_BUILDINGOPENSSL -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_QNXSOURCE -fPIC -g -fPIC -DOPENSSLDIR="\"/root/.conan/data/openssl/3.2.1//_/package/97251b3c4ffb4424af2be180c1c97471dab66360/res\"" -DENGINESDIR="\"//lib/engines-3\"" -DMODULESDIR="\"//lib/ossl-modules\"" -DOPENSSL_BUILDINGOPENSSL -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-apprand.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: [buildsw] 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

memsharded commented 4 months ago

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?

MikeyH84 commented 3 months ago

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