Open SamsonBox opened 3 years ago
I can cross-compile libbacktrace from macOS to iOS. Are you sure that your profiles are properly written? Or maybe it could be a conan issue, rather than recipe issue. Your suggestion seems to be a workaround, quite specific to your profiles. Are you able to cross-build others CCI recipes based on autotools with your profiles (I guess not: https://github.com/conan-io/conan-center-index/issues/6839 and https://github.com/conan-io/conan-center-index/issues/6838).
Might be related to https://github.com/conan-io/conan/issues/8290 /cc @madebr
Please post the build.log
.
I think the problem is (as you probably have found out), that autotools does not realize it is cross building because the build triplet == host triplet. Running the test executable fails.
You're hitting a bug/missing feature in conan in that its gnu triplets are limited. I have opened https://github.com/conan-io/conan/issues/8290 in the past. Reading the conversation again, I think/hope it will be possible with conan 2.0.
Until conan 2.0, I don't know how to cleanly fix this, other then temporarily carrying a patch for libbacktrace.
Your suggestion to get the host triplet from the environment is a hack that is not acceptable. It would have to be applied to all recipes using autotools, which does not scale.
@madebr here is the config.log
. A build.log is not avalable
In the log you will see, that the test excecutable can not be started :
configure:3023: ./conftest
source_subfolder/configure: line 3025: ./conftest: No such file or directory
You are probably right. The fix will not scale. The fix needs to be done in the conan Autotool integration. But taking the CROSS_COMPILE-variable is not that bad, as it is commonly used in a cross compile environment.
Any update on this? I have the same issue trying to cross compile for Android from Windows.
Cross compiling this package is not possible because the auto-tools cross compile check fails. In this scenario the --host option need to be set correctly. I would suggest the following fix:
Here the commonly used CROSS_COMPILE variable is used to determine the host compiler prefix.
Package and Environment Details
Conan profile
Conan host profile
Conan build profile
Steps to reproduce (Include if Applicable)
Logs (Include/Attach if Applicable)
Click to expand log
``` recipes/libbacktrace/all$ conan create --build=missing -pr LPKit-3.1.5-1-core2-64-debug -pr:b Ubuntu-18.04-debug . libbacktrace/cci.20210118@ Exporting package recipe libbacktrace/cci.20210118 exports: File 'conandata.yml' found. Exporting it... libbacktrace/cci.20210118 exports: Copied 1 '.yml' file: conandata.yml libbacktrace/cci.20210118 exports_sources: Copied 2 '.patch' files: 0001-pointer-arithmetic.patch, 0002-msvc-unistd-alternative.patch libbacktrace/cci.20210118: The stored package has not changed libbacktrace/cci.20210118: Using the exported files summary hash as the recipe revision: ec9f997639a91e94618ce0d9c911457c libbacktrace/cci.20210118: Exported revision: ec9f997639a91e94618ce0d9c911457c Configuration (profile_host): [settings] arch=x86_64 build_type=Debug compiler=gcc compiler.libcxx=libstdc++11 compiler.version=9 os=Linux os.distro=LPKit os.distro.platform=core2-64 os.distro.version=3.1.5-1 os_build=Linux os_build.distro=Ubuntu os_build.distro.version=18.04 [options] boost:without_stacktrace=True [build_requires] [env] AR=x86_64-lpkit-linux-ar ARCH=x86 AS=x86_64-lpkit-linux-as CC=x86_64-lpkit-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -fstack-protector-strong -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/lpkit/3.1.5-1-core2-64/sysroots/core2-64-lpkit-linux CFLAGS=-O2 -pipe -g -feliminate-unused-debug-types CONFIGURE_FLAGS=--target=x86_64-lpkit-linux --host=x86_64-lpkit-linux --build=x86_64-linux --with-libtool-sysroot=/opt/lpkit/3.1.5-1-core2-64/sysroots/core2-64-lpkit-linux CONFIG_SITE=/opt/lpkit/3.1.5-1-core2-64/site-config-core2-64-lpkit-linux CPP=x86_64-lpkit-linux-gcc -E -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -fstack-protector-strong -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/lpkit/3.1.5-1-core2-64/sysroots/core2-64-lpkit-linux CPPFLAGS= CROSS_COMPILE=x86_64-lpkit-linux- CXX=x86_64-lpkit-linux-g++ -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -fstack-protector-strong -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/lpkit/3.1.5-1-core2-64/sysroots/core2-64-lpkit-linux CXXFLAGS=-O2 -pipe -g -feliminate-unused-debug-types GDB=x86_64-lpkit-linux-gdb KCFLAGS=--sysroot=/opt/lpkit/3.1.5-1-core2-64/sysroots/core2-64-lpkit-linux LD=x86_64-lpkit-linux-ld --sysroot=/opt/lpkit/3.1.5-1-core2-64/sysroots/core2-64-lpkit-linux LDFLAGS=-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now LD_LIBRARY_PATH= M4=m4 NM=x86_64-lpkit-linux-nm OBJCOPY=x86_64-lpkit-linux-objcopy OBJDUMP=x86_64-lpkit-linux-objdump OECORE_ACLOCAL_OPTS=-I /opt/lpkit/3.1.5-1-core2-64/sysroots/x86_64-lpkitsdk-linux/usr/share/aclocal OECORE_BASELIB=lib OECORE_DISTRO_VERSION=3.1.5-1 OECORE_NATIVE_SYSROOT=/opt/lpkit/3.1.5-1-core2-64/sysroots/x86_64-lpkitsdk-linux OECORE_SDK_VERSION=3.1.5-1 OECORE_TARGET_ARCH=x86_64 OECORE_TARGET_OS=linux OECORE_TARGET_SYSROOT=/opt/lpkit/3.1.5-1-core2-64/sysroots/core2-64-lpkit-linux OE_CMAKE_FIND_LIBRARY_CUSTOM_LIB_SUFFIX= OE_CMAKE_TOOLCHAIN_FILE=/opt/lpkit/3.1.5-1-core2-64/sysroots/x86_64-lpkitsdk-linux/usr/share/cmake/OEToolchainConfig.cmake OE_QMAKE_AR=x86_64-lpkit-linux-ar OE_QMAKE_CC=x86_64-lpkit-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -fstack-protector-strong -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/lpkit/3.1.5-1-core2-64/sysroots/core2-64-lpkit-linux OE_QMAKE_CFLAGS=-O2 -pipe -g -feliminate-unused-debug-types OE_QMAKE_CXX=x86_64-lpkit-linux-g++ -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -fstack-protector-strong -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/lpkit/3.1.5-1-core2-64/sysroots/core2-64-lpkit-linux OE_QMAKE_CXXFLAGS=-O2 -pipe -g -feliminate-unused-debug-types OE_QMAKE_INCDIR_QT=/opt/lpkit/3.1.5-1-core2-64/sysroots/core2-64-lpkit-linux/usr/include OE_QMAKE_LDFLAGS=-Wl,-O1 -Wl,--hash-style=gnu -Wl,--as-needed -fstack-protector-strong -Wl,-z,relro,-z,now OE_QMAKE_LIBDIR_QT=/opt/lpkit/3.1.5-1-core2-64/sysroots/core2-64-lpkit-linux/usr/lib OE_QMAKE_LINK=x86_64-lpkit-linux-g++ -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -fstack-protector-strong -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/lpkit/3.1.5-1-core2-64/sysroots/core2-64-lpkit-linux OE_QMAKE_MOC=/opt/lpkit/3.1.5-1-core2-64/sysroots/x86_64-lpkitsdk-linux/usr/bin/moc OE_QMAKE_PATH_HOST_BINS=/opt/lpkit/3.1.5-1-core2-64/sysroots/x86_64-lpkitsdk-linux/usr/bin OE_QMAKE_QDBUSCPP2XML=/opt/lpkit/3.1.5-1-core2-64/sysroots/x86_64-lpkitsdk-linux/usr/bin/qdbuscpp2xml OE_QMAKE_QDBUSXML2CPP=/opt/lpkit/3.1.5-1-core2-64/sysroots/x86_64-lpkitsdk-linux/usr/bin/qdbusxml2cpp OE_QMAKE_QT_CONFIG=/opt/lpkit/3.1.5-1-core2-64/sysroots/core2-64-lpkit-linux/usr/lib/mkspecs/qconfig.pri OE_QMAKE_RCC=/opt/lpkit/3.1.5-1-core2-64/sysroots/x86_64-lpkitsdk-linux/usr/bin/rcc OE_QMAKE_STRIP=x86_64-lpkit-linux-strip OE_QMAKE_UIC=/opt/lpkit/3.1.5-1-core2-64/sysroots/x86_64-lpkitsdk-linux/usr/bin/uic PATH=[/opt/lpkit/3.1.5-1-core2-64/sysroots/x86_64-lpkitsdk-linux/usr/sbin,/opt/lpkit/3.1.5-1-core2-64/sysroots/x86_64-lpkitsdk-linux/bin,/opt/lpkit/3.1.5-1-core2-64/sysroots/x86_64-lpkitsdk-linux/sbin,/opt/lpkit/3.1.5-1-core2-64/sysroots/x86_64-lpkitsdk-linux/usr/bin/../x86_64-lpkitsdk-linux/bin,/opt/lpkit/3.1.5-1-core2-64/sysroots/x86_64-lpkitsdk-linux/usr/bin/x86_64-lpkit-linux,/opt/lpkit/3.1.5-1-core2-64/sysroots/x86_64-lpkitsdk-linux/usr/bin/x86_64-lpkit-linux-musl] PKG_CONFIG_PATH=/opt/lpkit/3.1.5-1-core2-64/sysroots/core2-64-lpkit-linux/usr/lib/pkgconfig:/opt/lpkit/3.1.5-1-core2-64/sysroots/core2-64-lpkit-linux/usr/share/pkgconfig PKG_CONFIG_SYSROOT_DIR=/opt/lpkit/3.1.5-1-core2-64/sysroots/core2-64-lpkit-linux QMAKESPEC=/opt/lpkit/3.1.5-1-core2-64/sysroots/core2-64-lpkit-linux/usr/lib/mkspecs/linux-oe-g++ QT_CONF_PATH=/opt/lpkit/3.1.5-1-core2-64/sysroots/x86_64-lpkitsdk-linux/usr/bin/qt.conf RANLIB=x86_64-lpkit-linux-ranlib READELF=x86_64-lpkit-linux-readelf SDKTARGETSYSROOT=/opt/lpkit/3.1.5-1-core2-64/sysroots/core2-64-lpkit-linux STRIP=x86_64-lpkit-linux-strip TARGET_PREFIX=x86_64-lpkit-linux- Configuration (profile_build): [settings] arch=x86_64 build_type=Debug compiler=gcc compiler.libcxx=libstdc++11 compiler.version=8 os=Linux os.distro=Ubuntu os.distro.platform=x86_64 os.distro.version=18.04 os_build=Linux os_build.distro=Ubuntu os_build.distro.version=18.04 [options] [build_requires] [env] AR=/usr/bin/x86_64-linux-gnu-gcc-ar-8 ASM=/usr/bin/x86_64-linux-gnu-gcc-8 CC=/usr/bin/x86_64-linux-gnu-gcc-8 CXX=/usr/bin/x86_64-linux-gnu-g++-8 LINKER=/usr/bin/x86_64-linux-gnu-ld NM=/usr/bin/x86_64-linux-gnu-gcc-nm-8 OBJDUMP=/usr/bin/x86_64-linux-gnu-gcc-objdump-8 PATH=[/opt/rs-qt-swp-5.12.3-debug/bin,/usr/local/sbin,/usr/local/bin,/usr/sbin,/usr/bin,/sbin,/bin] RANLIB=/usr/bin/x86_64-linux-gnu-gcc-ranlib-8 libbacktrace/cci.20210118: WARN: Package binary is corrupted, removing: b34b003a510a145869178ac3305bb6252cc6efec libbacktrace/cci.20210118 (test package): Installing package Requirements libbacktrace/cci.20210118 from local cache - Cache Packages libbacktrace/cci.20210118:b34b003a510a145869178ac3305bb6252cc6efec - Build Installing (downloading, building) binaries... libbacktrace/cci.20210118: WARN: Build folder is dirty, removing it: /home/hoff/conan_home/.conan/data/libbacktrace/cci.20210118/_/_/build/b34b003a510a145869178ac3305bb6252cc6efec libbacktrace/cci.20210118: Copying sources to build folder libbacktrace/cci.20210118: Building your package in /home/hoff/conan_home/.conan/data/libbacktrace/cci.20210118/_/_/build/b34b003a510a145869178ac3305bb6252cc6efec libbacktrace/cci.20210118: Generator txt created conanbuildinfo.txt libbacktrace/cci.20210118: Aggregating env generators libbacktrace/cci.20210118: Calling build() libbacktrace/cci.20210118: Calling: > source_subfolder/configure '--disable-shared' '--enable-static' '--prefix=/home/hoff/conan_home/.conan/data/libbacktrace/cci.20210118/_/_/package/b34b003a510a145869178ac3305bb6252cc6efec' '--bindir=${prefix}/bin' '--sbindir=${prefix}/bin' '--libexecdir=${prefix}/bin' '--libdir=${prefix}/lib' '--includedir=${prefix}/include' '--oldincludedir=${prefix}/include' '--datarootdir=${prefix}/share' ----Running------ > source_subfolder/configure '--disable-shared' '--enable-static' '--prefix=/home/hoff/conan_home/.conan/data/libbacktrace/cci.20210118/_/_/package/b34b003a510a145869178ac3305bb6252cc6efec' '--bindir=${prefix}/bin' '--sbindir=${prefix}/bin' '--libexecdir=${prefix}/bin' '--libdir=${prefix}/lib' '--includedir=${prefix}/include' '--oldincludedir=${prefix}/include' '--datarootdir=${prefix}/share' ----------------- configure: loading site script /opt/lpkit/3.1.5-1-core2-64/site-config-core2-64-lpkit-linux checking build system type... x86_64-pc-linux-gnu checking host system type... x86_64-pc-linux-gnu checking target system type... x86_64-pc-linux-gnu checking for gcc... x86_64-lpkit-linux-gcc -m64 -march=core2 -mtune=core2 -msse3 -mfpmath=sse -fstack-protector-strong -Wformat -Wformat-security -Werror=format-security --sysroot=/opt/lpkit/3.1.5-1-core2-64/sysroots/core2-64-lpkit-linux checking whether the C compiler works... yes checking for C compiler default output file name... a.out checking for suffix of executables... checking whether we are cross compiling... configure: error: in `/home/hoff/conan_home/.conan/data/libbacktrace/cci.20210118/_/_/build/b34b003a510a145869178ac3305bb6252cc6efec': configure: error: cannot run C compiled programs. If you meant to cross compile, use `--host'. See `config.log' for more details libbacktrace/cci.20210118: libbacktrace/cci.20210118: ERROR: Package 'b34b003a510a145869178ac3305bb6252cc6efec' build failed libbacktrace/cci.20210118: WARN: Build folder /home/hoff/conan_home/.conan/data/libbacktrace/cci.20210118/_/_/build/b34b003a510a145869178ac3305bb6252cc6efec ERROR: libbacktrace/cci.20210118: Error in build() method, line 85 autotools = self._configure_autotools() while calling '_configure_autotools', line 78 self._autotools.configure(configure_dir=self._source_subfolder, args=args) ConanException: Error 1 while executing source_subfolder/configure '--disable-shared' '--enable-static' '--prefix=/home/hoff/conan_home/.conan/data/libbacktrace/cci.20210118/_/_/package/b34b003a510a145869178ac3305bb6252cc6efec' '--bindir=${prefix}/bin' '--sbindir=${prefix}/bin' '--libexecdir=${prefix}/bin' '--libdir=${prefix}/lib' '--includedir=${prefix}/include' '--oldincludedir=${prefix}/include' '--datarootdir=${prefix}/share' ```