Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Cross compilation on same os / architecture #10923

Open
eirikb opened this issue Mar 30, 2022 · 7 comments
Open

[feature] Cross compilation on same os / architecture #10923

eirikb opened this issue Mar 30, 2022 · 7 comments

Comments

@eirikb
Copy link

eirikb commented Mar 30, 2022

As strange as it sounds I'm trying to cross compile from Linux x86_64 to Linux x86_64, using a Yocto SDK Toolchain.
I use two profiles (-pr:b and -pr:h).
A lot of recipes work out-of-the-box, but not all. Currently struggling with libbacktrace (because of boost).
It uses autotools.

Here is output of building with two Yocto toolchains, one from x86_64 to armv7hf and one from x86_64 to x86_64:
https://github.com/eirikb/proof-of-conan/runs/5742649170?check_suite_focus=true
The one failing will say:

configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.

The --host (and --target) is not passed.

This seems logical enough, and the check in https://github.com/conan-io/conan/blob/develop/conans/client/tools/oss.py#L460 will check if host_os or host_arch is not like build_os or build_arch.

I'm not sure how to solve this, perhaps some additional flag somewhere? Maybe it is already possible?
As I understand using two profiles by itself doesn't necessarily mean cross building.


In addition I did some tests, by forcing cross_building in oss.py to always return True.
Then --host and --target would be passed, but automake didn't consider it cross build. I'm not 100% sure why not, could be a similar arch vs arch check? The parameters were x86_64-linux-gnu . If I changed these, to for example x86_64-linux it would cross build, even when they were equal. I did this directly in autotools_environment.py.

@memsharded
Copy link
Member

Hi @eirikb

Indeed a non expected case.
As Conan has no further information so far, it will use only os-arch to decide.
But it is not only a problem of the cross_building method, but it can be bigger. For example, the package_id could be colliding. If all settings and options are exactly the same, the package_id is the same and the binary will be consider the same (and binary compatible) among them. But I think it is not the case, the binary built for Yocto won't run on the host system and viceversa.

I think something else is necessary into the model to dissambiguate between those builds/binaries. What would be the variable thing in the packages? Something in the Yocto built image? Versioning or classifying the Linux distro?

@eirikb
Copy link
Author

eirikb commented Mar 30, 2022

I'm not very well traversed in the land of Yocto, but the toolchain files at least seem to contain pieces such as;

  • libc: musl, glibc.
    Not sure if this means host or target.
  • Host architecture: i686, x86_64 etc.
  • Image name: Can indicate package sets and such.
  • Target arch: I believe this is same as MACHINE, such as aarch64, armv5e, core2-64, cortexa8hf-neon, corei7-64 etc.
    This can also often include hardware names as well, such as cortexa72-raspberrypi4-64.
  • Yocto version

All of these variables might end up creating different binaries.

I think it is possible to distinguish binaries in cache today by introducing extra parameters in settings.yml.
Since I build using docker with custom profiles this should be straight forward and contained to the specific toolchains.
This won't help with cross compiling though.

Update / Edit

When building with bitbake these parameters will show:

BB_VERSION           = "1.46.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "universal"
TARGET_SYS           = "x86_64-poky-linux"
MACHINE              = "qemux86-64"
DISTRO               = "poky"
DISTRO_VERSION       = "3.1.14"
TUNE_FEATURES        = "m64 core2"
TARGET_FPU           = ""

Any combination of these might create a different binary, at least the ones not relevant to build system.
This is interesting when it comes to binaries and cache, however for my current issue cross compiling is the problem.
Some way to force this in Conan would be great.

@eirikb
Copy link
Author

eirikb commented Apr 6, 2022

Since I have a docker image for the sole purpose of cross compiling I decided to test out some hacks based on my findings from my initial test.

Note that this is very hacky, only for testing purposes, and it is done in a toolchain-purposed docker image.

# This will force Conan to always consider the build as cross compiling
RUN sed -i '/def cross_build/a \    return True' /usr/local/lib/python3.8/dist-packages/conans/client/tools/oss.py

# This will trick automake configure to consider the build cross compile
RUN sed -i '/self.build,/a \        self.build = "x86_64-linux"' /usr/local/lib/python3.8/dist-packages/conans/client/build/autotools_environment.py

I'm not sure if that last one is a problem with automake or the library, or something else.
Even without Conan, just trying to build the library from github using the toolchain it won't build, with the same errors.
I'm not sure how Yocto builds this library as I can't find the recipe.

With the changes above I can successfully run conan install on libbacktrace, and I can run conan create on boost which depends on this libbacktrace.
Running conan create on libbacktrace gave compilation error in test_package. I'm not sure why, I believe this worked in my previous test.

@steinerthomas
Copy link

steinerthomas commented Sep 8, 2023

Hi,
what's the status? Is there a feature for the autotools build helper (e.g. by forcing the --host argument in the profile/configuration) planned?

I'm also facing an issue when "cross-building" from x86_64 Debian10 (build server, default profile) to x86_64 Debian12 (target) when building the libxml2 library:

$conan create recipes/libxml2/all libxml2/2.11.4@ -u -tf None -pr debian6412 -pr:b default -s:b build_type=RelWithDebInfo -o shared=True -o iconv=False -o zlib:shared=True -s build_type=RelWithDebInfo

ERROR:

configure:4252: ./conftest
./conftest: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./conftest)
configure:4256: $? = 1
configure:4263: error: in `/home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/build-relwithdebinfo':
configure:4265: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
Full console output
Exporting package recipe
libxml2/2.11.4 exports: File 'conandata.yml' found. Exporting it...
libxml2/2.11.4 exports: Copied 1 '.yml' file: conandata.yml
libxml2/2.11.4: The stored package has not changed
libxml2/2.11.4: Using the exported files summary hash as the recipe revision: aa29921b43f43d017da9ddcd161b8c35
libxml2/2.11.4: Exported revision: aa29921b43f43d017da9ddcd161b8c35
Configuration (profile_host):
[settings]
arch=x86_64
build_type=RelWithDebInfo
compiler=gcc
compiler.cppstd=20
compiler.libcxx=libstdc++11
compiler.version=12
os=Linux
[options]
iconv=False
shared=True
zlib:shared=True
[build_requires]
[env]
AR=x86_64-debian6412-linux-gnu-ar
AS=x86_64-debian6412-linux-gnu-as
CC=x86_64-debian6412-linux-gnu-gcc
CHOST=x86_64-debian6412-linux-gnu
CONAN_CMAKE_FIND_ROOT_PATH=/opt/x-tools/x86_64-debian6412-linux-gnu/x86_64-debian6412-linux-gnu/sysroot
CONAN_CMAKE_FIND_ROOT_PATH_MODE_INCLUDE=ONLY
CONAN_CMAKE_FIND_ROOT_PATH_MODE_LIBRARY=ONLY
CONAN_CMAKE_FIND_ROOT_PATH_MODE_PROGRAM=NEVER
CONAN_CMAKE_TOOLCHAIN_FILE=/opt/x-tools/x86_64-debian6412-linux-gnu/toolchain.cmake
CXX=x86_64-debian6412-linux-gnu-g++
LD=x86_64-debian6412-linux-gnu-ld
PATH=[/opt/x-tools/x86_64-debian6412-linux-gnu/bin]
RANLIB=x86_64-debian6412-linux-gnu-ranlib
STRIP=x86_64-debian6412-linux-gnu-strip
Configuration (profile_build):
[settings]
arch=x86_64
arch_build=x86_64
build_type=RelWithDebInfo
compiler=gcc
compiler.cppstd=17
compiler.libcxx=libstdc++11
compiler.version=8
os=Linux
os_build=Linux
[options]
[build_requires]
[env]

zlib/1.2.13: WARN: Can't update, no package in remote
libxml2/2.11.4: Forced build from source
Installing package: libxml2/2.11.4
Requirements
    libxml2/2.11.4 from 'cc-conan-local' - Cache
    zlib/1.2.13 from 'cc-conan-local' - Cache
Packages
    libxml2/2.11.4:f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47 - Build
    zlib/1.2.13:1ca3480341e9d85429a069954d57f5d671521233 - Cache
Build requirements
    pkgconf/1.9.3 from 'cc-conan-local' - Cache
Build requirements packages
    pkgconf/1.9.3:252f7e09f641bef29a75fc98d05ac217b842cde4 - Cache

Installing (downloading, building) binaries...
pkgconf/1.9.3: Already installed!
pkgconf/1.9.3: Appending PATH env var: /home/thomas/.conan/data/pkgconf/1.9.3/_/_/package/252f7e09f641bef29a75fc98d05ac217b842cde4/bin
pkgconf/1.9.3: Setting PKG_CONFIG env var: /home/thomas/.conan/data/pkgconf/1.9.3/_/_/package/252f7e09f641bef29a75fc98d05ac217b842cde4/bin/pkgconf
pkgconf/1.9.3: Appending AUTOMAKE_CONAN_INCLUDES env var: /home/thomas/.conan/data/pkgconf/1.9.3/_/_/package/252f7e09f641bef29a75fc98d05ac217b842cde4/bin/aclocal
zlib/1.2.13: Already installed!
libxml2/2.11.4: Applying build-requirement: pkgconf/1.9.3
libxml2/2.11.4: WARN: Build folder is dirty, removing it: /home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47
libxml2/2.11.4: Copying sources to build folder
libxml2/2.11.4: Building your package in /home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47
libxml2/2.11.4: Generator txt created conanbuildinfo.txt
libxml2/2.11.4: Calling generate()
libxml2/2.11.4: Aggregating env generators
libxml2/2.11.4: Calling build()
libxml2/2.11.4: Calling:
 > "/home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/src/configure" '--enable-shared' '--disable-static' '--prefix=/' '--bindir=${prefix}/bin' '--sbindir=${prefix}/bin' '--libdir=${prefix}/lib' '--includedir=${prefix}/include' '--oldincludedir=${prefix}/include' '--enable-shared=yes' '--enable-static=no' '--with-c14n=yes' '--with-catalog=yes' '--with-ftp=yes' '--with-http=yes' '--with-html=yes' '--with-iconv=no' '--with-icu=no' '--with-iso8859x=yes' '--with-legacy=yes' '--with-mem-debug=no' '--with-output=yes' '--with-pattern=yes' '--with-push=yes' '--with-python=no' '--with-reader=yes' '--with-regexps=yes' '--with-sax1=yes' '--with-schemas=yes' '--with-schematron=yes' '--with-threads=yes' '--with-tree=yes' '--with-valid=yes' '--with-writer=yes' '--with-xinclude=yes' '--with-xpath=yes' '--with-xptr=yes' '--with-zlib=yes' '--with-lzma=no'
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... /bin/mkdir -p
checking for gawk... no
checking for mawk... mawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether to enable maintainer-specific portions of Makefiles... yes
checking whether make supports nested variables... (cached) yes
checking for gcc... x86_64-debian6412-linux-gnu-gcc
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/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/build-relwithdebinfo':
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
libxml2/2.11.4:
libxml2/2.11.4: ERROR: Package 'f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47' build failed
libxml2/2.11.4: WARN: Build folder /home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/build-relwithdebinfo
ERROR: libxml2/2.11.4: Error in build() method, line 287
        autotools.configure()
        ConanException: Error 77 while executing "/home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/src/configure" '--enable-shared' '--disable-static' '--prefix=/' '--bindir=${prefix}/bin' '--sbindir=${prefix}/bin' '--libdir=${prefix}/lib' '--includedir=${prefix}/include' '--oldincludedir=${prefix}/include' '--enable-shared=yes' '--enable-static=no' '--with-c14n=yes' '--with-catalog=yes' '--with-ftp=yes' '--with-http=yes' '--with-html=yes' '--with-iconv=no' '--with-icu=no' '--with-iso8859x=yes' '--with-legacy=yes' '--with-mem-debug=no' '--with-output=yes' '--with-pattern=yes' '--with-push=yes' '--with-python=no' '--with-reader=yes' '--with-regexps=yes' '--with-sax1=yes' '--with-schemas=yes' '--with-schematron=yes' '--with-threads=yes' '--with-tree=yes' '--with-valid=yes' '--with-writer=yes' '--with-xinclude=yes' '--with-xpath=yes' '--with-xptr=yes' '--with-zlib=yes' '--with-lzma=no'
Full autoconf log (config.log)
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.

It was created by libxml2 configure 2.11.4, which was
generated by GNU Autoconf 2.71.  Invocation command line was

  $ /home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/src/configure --enable-shared --disable-static --prefix=/ '--bindir=${prefix}/bin' '--sbindir=${prefix}/bin' '--libdir=${prefix}/lib' '--includedir=${prefix}/include' '--oldincludedir=${prefix}/include' --enable-shared=yes --enable-static=no --with-c14n=yes --with-catalog=yes --with-ftp=yes --with-http=yes --with-html=yes --with-iconv=no --with-icu=no --with-iso8859x=yes --with-legacy=yes --with-mem-debug=no --with-output=yes --with-pattern=yes --with-push=yes --with-python=no --with-reader=yes --with-regexps=yes --with-sax1=yes --with-schemas=yes --with-schematron=yes --with-threads=yes --with-tree=yes --with-valid=yes --with-writer=yes --with-xinclude=yes --with-xpath=yes --with-xptr=yes --with-zlib=yes --with-lzma=no

## --------- ##
## Platform. ##
## --------- ##

hostname = EA0017300639
uname -m = x86_64
uname -r = 4.4.0-19041-Microsoft
uname -s = Linux
uname -v = #2311-Microsoft Tue Nov 08 17:09:00 PST 2022

/usr/bin/uname -p = unknown
/bin/uname -X     = unknown

/bin/arch              = unknown
/usr/bin/arch -k       = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo      = unknown
/bin/machine           = unknown
/usr/bin/oslevel       = unknown
/bin/universe          = unknown

PATH: /home/thomas/.conan/data/pkgconf/1.9.3/_/_/package/252f7e09f641bef29a75fc98d05ac217b842cde4/bin/
PATH: /opt/x-tools/x86_64-debian6412-linux-gnu/bin/
PATH: /home/thomas/.conan/data/pkgconf/1.9.3/_/_/package/252f7e09f641bef29a75fc98d05ac217b842cde4/bin/
PATH: /usr/local/sbin/
PATH: /usr/local/bin/
PATH: /usr/sbin/
PATH: /usr/bin/
PATH: /sbin/
PATH: /bin/
PATH: /usr/games/
PATH: /usr/local/games/
PATH: /mnt/c/Program Files/TDO/bin/
PATH: /mnt/c/oracle/ora11x64/bin/
PATH: /mnt/c/Program Files/OpenJDK/jdk-17.0.1+12/bin/
PATH: /mnt/c/Program Files (x86)/Common Files/Oracle/Java/javapath/
PATH: /mnt/c/ProgramData/Oracle/Java/javapath/
PATH: /mnt/c/c2ktools/bat/
PATH: /mnt/c/c2ktools/util/
PATH: /mnt/c/oracle/ora11x86/bin/
PATH: /mnt/c/Program Files (x86)/JpSoft/TCMD32/
PATH: /mnt/c/WINDOWS/system32/
PATH: /mnt/c/WINDOWS/
PATH: /mnt/c/WINDOWS/System32/Wbem/
PATH: /mnt/c/WINDOWS/System32/WindowsPowerShell/v1.0/
PATH: /mnt/c/Program Files (x86)/OpenText/Viewer/bin/
PATH: /mnt/c/Program Files (x86)/Araxis/Araxis Merge v6.5/
PATH: /mnt/c/OpenVPN/bin/
PATH: /mnt/c/c2ktools/apache-maven-3.8.6/bin/
PATH: /mnt/c/Program Files/Git/cmd/
PATH: /mnt/c/packer/packer_1.2.3/
PATH: /mnt/c/Program Files/doxygen/bin/
PATH: /mnt/c/Program Files/SlikSvn/bin/
PATH: /mnt/c/WINDOWS/System32/OpenSSH/
PATH: /mnt/c/WINDOWS/system32/config/systemprofile/.dnx/bin/
PATH: /mnt/c/Program Files/Microsoft DNX/Dnvm/
PATH: /mnt/c/Program Files/CMake/bin/
PATH: /mnt/c/Program Files/TortoiseSVN/bin/
PATH: /mnt/c/HashiCorp/Vagrant/bin/
PATH: /mnt/c/Program Files/MATLAB/MATLAB Runtime/v93/runtime/win64/
PATH: /mnt/c/Program Files/Intel/WiFi/bin/
PATH: /mnt/c/Program Files/Common Files/Intel/WirelessCommon/
PATH: /mnt/c/Program Files/dotnet/
PATH: /mnt/c/Program Files (x86)/Intel/Intel(R) Management Engine Components/DAL/
PATH: /mnt/c/Program Files/Intel/Intel(R) Management Engine Components/DAL/
PATH: /mnt/c/Users/001122563/AppData/Local/Microsoft/WindowsApps/
PATH: /mnt/c/Users/001122563/AppData/Local/Programs/Microsoft VS Code/bin/
PATH: /mnt/c/Users/001122563/.dotnet/tools/
PATH: /home/thomas/.local/bin/


## ----------- ##
## Core tests. ##
## ----------- ##

configure:2661: looking for aux files: ltmain.sh compile missing install-sh config.guess config.sub
configure:2674:  trying /home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/src/
configure:2703:   /home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/src/ltmain.sh found
configure:2703:   /home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/src/compile found
configure:2703:   /home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/src/missing found
configure:2685:   /home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/src/install-sh found
configure:2703:   /home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/src/config.guess found
configure:2703:   /home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/src/config.sub found
configure:2825: checking build system type
configure:2840: result: x86_64-pc-linux-gnu
configure:2860: checking host system type
configure:2874: result: x86_64-pc-linux-gnu
configure:2940: checking for a BSD-compatible install
configure:3013: result: /usr/bin/install -c
configure:3024: checking whether build environment is sane
configure:3079: result: yes
configure:3236: checking for a race-free mkdir -p
configure:3280: result: /bin/mkdir -p
configure:3287: checking for gawk
configure:3322: result: no
configure:3287: checking for mawk
configure:3308: found /usr/bin/mawk
configure:3319: result: mawk
configure:3330: checking whether make sets $(MAKE)
configure:3353: result: yes
configure:3383: checking whether make supports nested variables
configure:3401: result: yes
configure:3538: checking whether to enable maintainer-specific portions of Makefiles
configure:3548: result: yes
configure:3573: checking whether make supports nested variables
configure:3591: result: yes
configure:3665: checking for gcc
configure:3697: result: x86_64-debian6412-linux-gnu-gcc
configure:4050: checking for C compiler version
configure:4059: x86_64-debian6412-linux-gnu-gcc --version >&5
x86_64-debian6412-linux-gnu-gcc (crosstool-NG 1.25.0.220_981043d) 12.3.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

configure:4070: $? = 0
configure:4059: x86_64-debian6412-linux-gnu-gcc -v >&5
Using built-in specs.
COLLECT_GCC=x86_64-debian6412-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/opt/x-tools/x86_64-debian6412-linux-gnu/bin/../libexec/gcc/x86_64-debian6412-linux-gnu/12.3.0/lto-wrapper
Target: x86_64-debian6412-linux-gnu
Configured with: /tmp/build-debian6412/.build/x86_64-debian6412-linux-gnu/src/gcc/configure --build=x86_64-build_pc-linux-gnu --host=x86_64-build_pc-linux-gnu --target=x86_64-debian6412-linux-gnu --prefix=/home/jenkins/x-tools/x86_64-debian6412-linux-gnu --exec_prefix=/home/jenkins/x-tools/x86_64-debian6412-linux-gnu --with-sysroot=/home/jenkins/x-tools/x86_64-debian6412-linux-gnu/x86_64-debian6412-linux-gnu/sysroot --enable-languages=c,c++ --with-arch=x86-64 --with-tune=generic --with-pkgversion='crosstool-NG 1.25.0.220_981043d' --enable-__cxa_atexit --disable-libmudflap --disable-libgomp --disable-libssp --disable-libquadmath --disable-libquadmath-support --enable-libsanitizer --enable-libmpx --with-gmp=/tmp/build-debian6412/.build/x86_64-debian6412-linux-gnu/buildtools --with-mpfr=/tmp/build-debian6412/.build/x86_64-debian6412-linux-gnu/buildtools --with-mpc=/tmp/build-debian6412/.build/x86_64-debian6412-linux-gnu/buildtools --with-isl=/tmp/build-debian6412/.build/x86_64-debian6412-linux-gnu/buildtools --enable-lto --enable-threads=posix --enable-target-optspace --disable-plugin --disable-nls --disable-multilib --with-local-prefix=/home/jenkins/x-tools/x86_64-debian6412-linux-gnu/x86_64-debian6412-linux-gnu/sysroot --enable-long-long
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.3.0 (crosstool-NG 1.25.0.220_981043d)
configure:4070: $? = 0
configure:4059: x86_64-debian6412-linux-gnu-gcc -V >&5
x86_64-debian6412-linux-gnu-gcc: error: unrecognized command-line option '-V'
x86_64-debian6412-linux-gnu-gcc: fatal error: no input files
compilation terminated.
configure:4070: $? = 1
configure:4059: x86_64-debian6412-linux-gnu-gcc -qversion >&5
x86_64-debian6412-linux-gnu-gcc: error: unrecognized command-line option '-qversion'; did you mean '--version'?
x86_64-debian6412-linux-gnu-gcc: fatal error: no input files
compilation terminated.
configure:4070: $? = 1
configure:4059: x86_64-debian6412-linux-gnu-gcc -version >&5
x86_64-debian6412-linux-gnu-gcc: error: unrecognized command-line option '-version'
x86_64-debian6412-linux-gnu-gcc: fatal error: no input files
compilation terminated.
configure:4070: $? = 1
configure:4090: checking whether the C compiler works
configure:4112: x86_64-debian6412-linux-gnu-gcc  -m64 -O2 -g  -DNDEBUG -I/home/thomas/.conan/data/zlib/1.2.13/_/_/package/1ca3480341e9d85429a069954d57f5d671521233/include  -m64 -L/home/thomas/.conan/data/zlib/1.2.13/_/_/package/1ca3480341e9d85429a069954d57f5d671521233/lib conftest.c  -lz >&5
configure:4116: $? = 0
configure:4166: result: yes
configure:4169: checking for C compiler default output file name
configure:4171: result: a.out
configure:4177: checking for suffix of executables
configure:4184: x86_64-debian6412-linux-gnu-gcc -o conftest  -m64 -O2 -g  -DNDEBUG -I/home/thomas/.conan/data/zlib/1.2.13/_/_/package/1ca3480341e9d85429a069954d57f5d671521233/include  -m64 -L/home/thomas/.conan/data/zlib/1.2.13/_/_/package/1ca3480341e9d85429a069954d57f5d671521233/lib conftest.c  -lz >&5
configure:4188: $? = 0
configure:4211: result:
configure:4233: checking whether we are cross compiling
configure:4241: x86_64-debian6412-linux-gnu-gcc -o conftest  -m64 -O2 -g  -DNDEBUG -I/home/thomas/.conan/data/zlib/1.2.13/_/_/package/1ca3480341e9d85429a069954d57f5d671521233/include  -m64 -L/home/thomas/.conan/data/zlib/1.2.13/_/_/package/1ca3480341e9d85429a069954d57f5d671521233/lib conftest.c  -lz >&5
configure:4245: $? = 0
configure:4252: ./conftest
./conftest: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by ./conftest)
configure:4256: $? = 1
configure:4263: error: in `/home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/build-relwithdebinfo':
configure:4265: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=x86_64-pc-linux-gnu
ac_cv_env_CC_set=set
ac_cv_env_CC_value=x86_64-debian6412-linux-gnu-gcc
ac_cv_env_CFLAGS_set=set
ac_cv_env_CFLAGS_value=' -m64 -O2 -g'
ac_cv_env_CPPFLAGS_set=set
ac_cv_env_CPPFLAGS_value=' -DNDEBUG -I/home/thomas/.conan/data/zlib/1.2.13/_/_/package/1ca3480341e9d85429a069954d57f5d671521233/include'
ac_cv_env_ICU_CFLAGS_set=
ac_cv_env_ICU_CFLAGS_value=
ac_cv_env_ICU_DEFS_set=
ac_cv_env_ICU_DEFS_value=
ac_cv_env_ICU_LIBS_set=
ac_cv_env_ICU_LIBS_value=
ac_cv_env_LDFLAGS_set=set
ac_cv_env_LDFLAGS_value=' -m64 -L/home/thomas/.conan/data/zlib/1.2.13/_/_/package/1ca3480341e9d85429a069954d57f5d671521233/lib'
ac_cv_env_LIBS_set=set
ac_cv_env_LIBS_value=' -lz'
ac_cv_env_LT_SYS_LIBRARY_PATH_set=
ac_cv_env_LT_SYS_LIBRARY_PATH_value=
ac_cv_env_LZMA_CFLAGS_set=
ac_cv_env_LZMA_CFLAGS_value=
ac_cv_env_LZMA_LIBS_set=
ac_cv_env_LZMA_LIBS_value=
ac_cv_env_PKG_CONFIG_LIBDIR_set=
ac_cv_env_PKG_CONFIG_LIBDIR_value=
ac_cv_env_PKG_CONFIG_PATH_set=set
ac_cv_env_PKG_CONFIG_PATH_value=/home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/build-relwithdebinfo/conan:
ac_cv_env_PKG_CONFIG_set=set
ac_cv_env_PKG_CONFIG_value=/home/thomas/.conan/data/pkgconf/1.9.3/_/_/package/252f7e09f641bef29a75fc98d05ac217b842cde4/bin/pkgconf
ac_cv_env_PYTHON_CFLAGS_set=
ac_cv_env_PYTHON_CFLAGS_value=
ac_cv_env_PYTHON_LIBS_set=
ac_cv_env_PYTHON_LIBS_value=
ac_cv_env_PYTHON_set=
ac_cv_env_PYTHON_value=
ac_cv_env_Z_CFLAGS_set=
ac_cv_env_Z_CFLAGS_value=
ac_cv_env_Z_LIBS_set=
ac_cv_env_Z_LIBS_value=
ac_cv_env_build_alias_set=
ac_cv_env_build_alias_value=
ac_cv_env_host_alias_set=
ac_cv_env_host_alias_value=
ac_cv_env_target_alias_set=
ac_cv_env_target_alias_value=
ac_cv_host=x86_64-pc-linux-gnu
ac_cv_path_install='/usr/bin/install -c'
ac_cv_path_mkdir=/bin/mkdir
ac_cv_prog_AWK=mawk
ac_cv_prog_ac_ct_CC=x86_64-debian6412-linux-gnu-gcc
ac_cv_prog_make_make_set=yes
am_cv_make_support_nested_variables=yes

## ----------------- ##
## Output variables. ##
## ----------------- ##

ACLOCAL='${SHELL} '\''/home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/src/missing'\'' aclocal-1.16'
AMDEPBACKSLASH=''
AMDEP_FALSE=''
AMDEP_TRUE=''
AMTAR='$${TAR-tar}'
AM_BACKSLASH='\'
AM_CFLAGS=''
AM_DEFAULT_V='$(AM_DEFAULT_VERBOSITY)'
AM_DEFAULT_VERBOSITY='0'
AM_LDFLAGS=''
AM_V='$(V)'
AR='x86_64-debian6412-linux-gnu-ar'
AUTOCONF='${SHELL} '\''/home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/src/missing'\'' autoconf'
AUTOHEADER='${SHELL} '\''/home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/src/missing'\'' autoheader'
AUTOMAKE='${SHELL} '\''/home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/src/missing'\'' automake-1.16'
AWK='mawk'
BASE_THREAD_LIBS=''
CC='x86_64-debian6412-linux-gnu-gcc'
CCDEPMODE=''
CFLAGS=' -m64 -O2 -g'
CPPFLAGS=' -DNDEBUG -I/home/thomas/.conan/data/zlib/1.2.13/_/_/package/1ca3480341e9d85429a069954d57f5d671521233/include'
CSCOPE='cscope'
CTAGS='ctags'
CYGPATH_W='echo'
DEFS=''
DEPDIR=''
DLLTOOL=''
DSYMUTIL=''
DUMPBIN=''
ECHO_C=''
ECHO_N='-n'
ECHO_T=''
EGREP=''
ETAGS='etags'
EXEEXT=''
FGREP=''
GREP=''
ICONV_CFLAGS=''
ICU_CFLAGS=''
ICU_DEFS=''
ICU_LIBS=''
INSTALL_DATA='${INSTALL} -m 644'
INSTALL_PROGRAM='${INSTALL}'
INSTALL_SCRIPT='${INSTALL}'
INSTALL_STRIP_PROGRAM='$(install_sh) -c -s'
LD='x86_64-debian6412-linux-gnu-ld'
LDFLAGS=' -m64 -L/home/thomas/.conan/data/zlib/1.2.13/_/_/package/1ca3480341e9d85429a069954d57f5d671521233/lib'
LIBM=''
LIBOBJS=''
LIBS=' -lz'
LIBTOOL=''
LIBXML_MAJOR_VERSION='2'
LIBXML_MICRO_VERSION='4'
LIBXML_MINOR_VERSION='11'
LIBXML_VERSION='2.11.4'
LIBXML_VERSION_EXTRA=''
LIBXML_VERSION_INFO='13:4:11'
LIBXML_VERSION_NUMBER='21104'
LIPO=''
LN_S=''
LTLIBOBJS=''
LT_SYS_LIBRARY_PATH=''
LZMA_CFLAGS=''
LZMA_LIBS=''
MAINT=''
MAINTAINER_MODE_FALSE='#'
MAINTAINER_MODE_TRUE=''
MAKEINFO='${SHELL} '\''/home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/src/missing'\'' makeinfo'
MANIFEST_TOOL=''
MKDIR_P='/bin/mkdir -p'
MODULE_EXTENSION=''
MODULE_PLATFORM_LIBS=''
NM=''
NMEDIT=''
OBJDUMP=''
OBJEXT=''
OTOOL64=''
OTOOL=''
PACKAGE='libxml2'
PACKAGE_BUGREPORT=''
PACKAGE_NAME='libxml2'
PACKAGE_STRING='libxml2 2.11.4'
PACKAGE_TARNAME='libxml2'
PACKAGE_URL=''
PACKAGE_VERSION='2.11.4'
PATH_SEPARATOR=':'
PERL=''
PKG_CONFIG='/home/thomas/.conan/data/pkgconf/1.9.3/_/_/package/252f7e09f641bef29a75fc98d05ac217b842cde4/bin/pkgconf'
PKG_CONFIG_LIBDIR=''
PKG_CONFIG_PATH='/home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/build-relwithdebinfo/conan:'
PYTHON=''
PYTHON_CFLAGS=''
PYTHON_EXEC_PREFIX=''
PYTHON_LDFLAGS=''
PYTHON_LIBS=''
PYTHON_PLATFORM=''
PYTHON_PREFIX=''
PYTHON_VERSION=''
RANLIB='x86_64-debian6412-linux-gnu-ranlib'
RDL_CFLAGS=''
RDL_LIBS=''
RELDATE=''
SED=''
SET_MAKE=''
SHELL='/bin/bash'
STRIP='x86_64-debian6412-linux-gnu-strip'
TAR=''
THREAD_CFLAGS=''
THREAD_LIBS=''
USE_VERSION_SCRIPT_FALSE=''
USE_VERSION_SCRIPT_TRUE=''
VERSION='2.11.4'
VERSION_SCRIPT_FLAGS=''
WGET=''
WITH_C14N=''
WITH_C14N_SOURCES_FALSE=''
WITH_C14N_SOURCES_TRUE=''
WITH_CATALOG=''
WITH_CATALOG_SOURCES_FALSE=''
WITH_CATALOG_SOURCES_TRUE=''
WITH_DEBUG=''
WITH_DEBUG_SOURCES_FALSE=''
WITH_DEBUG_SOURCES_TRUE=''
WITH_FTP=''
WITH_FTP_SOURCES_FALSE=''
WITH_FTP_SOURCES_TRUE=''
WITH_GLOB_FALSE=''
WITH_GLOB_TRUE=''
WITH_HTML=''
WITH_HTML_SOURCES_FALSE=''
WITH_HTML_SOURCES_TRUE=''
WITH_HTTP=''
WITH_HTTP_SOURCES_FALSE=''
WITH_HTTP_SOURCES_TRUE=''
WITH_ICONV=''
WITH_ICU=''
WITH_ISO8859X=''
WITH_LEGACY=''
WITH_LEGACY_SOURCES_FALSE=''
WITH_LEGACY_SOURCES_TRUE=''
WITH_LZMA=''
WITH_LZMA_SOURCES_FALSE=''
WITH_LZMA_SOURCES_TRUE=''
WITH_MEM_DEBUG=''
WITH_MODULES=''
WITH_MODULES_SOURCES_FALSE=''
WITH_MODULES_SOURCES_TRUE=''
WITH_OUTPUT=''
WITH_OUTPUT_SOURCES_FALSE=''
WITH_OUTPUT_SOURCES_TRUE=''
WITH_PATTERN=''
WITH_PATTERN_SOURCES_FALSE=''
WITH_PATTERN_SOURCES_TRUE=''
WITH_PUSH=''
WITH_PYTHON_FALSE=''
WITH_PYTHON_TRUE=''
WITH_READER=''
WITH_READER_SOURCES_FALSE=''
WITH_READER_SOURCES_TRUE=''
WITH_REGEXPS=''
WITH_REGEXPS_SOURCES_FALSE=''
WITH_REGEXPS_SOURCES_TRUE=''
WITH_SAX1=''
WITH_SAX1_SOURCES_FALSE=''
WITH_SAX1_SOURCES_TRUE=''
WITH_SCHEMAS=''
WITH_SCHEMAS_SOURCES_FALSE=''
WITH_SCHEMAS_SOURCES_TRUE=''
WITH_SCHEMATRON=''
WITH_SCHEMATRON_SOURCES_FALSE=''
WITH_SCHEMATRON_SOURCES_TRUE=''
WITH_THREADS=''
WITH_THREAD_ALLOC=''
WITH_TREE=''
WITH_TRIO=''
WITH_TRIO_SOURCES_FALSE=''
WITH_TRIO_SOURCES_TRUE=''
WITH_VALID=''
WITH_VALID_SOURCES_FALSE=''
WITH_VALID_SOURCES_TRUE=''
WITH_WRITER=''
WITH_WRITER_SOURCES_FALSE=''
WITH_WRITER_SOURCES_TRUE=''
WITH_XINCLUDE=''
WITH_XINCLUDE_SOURCES_FALSE=''
WITH_XINCLUDE_SOURCES_TRUE=''
WITH_XPATH=''
WITH_XPATH_SOURCES_FALSE=''
WITH_XPATH_SOURCES_TRUE=''
WITH_XPTR=''
WITH_XPTR_LOCS=''
WITH_XPTR_SOURCES_FALSE=''
WITH_XPTR_SOURCES_TRUE=''
WITH_ZLIB=''
XML_CFLAGS=''
XML_INCLUDEDIR=''
XML_LIBDIR=''
XML_LIBS=''
XML_LIBTOOLLIBS=''
XML_PRIVATE_CFLAGS=''
XML_PRIVATE_LIBS=''
XSLTPROC=''
Z_CFLAGS=''
Z_LIBS=''
ac_ct_AR=''
ac_ct_CC='x86_64-debian6412-linux-gnu-gcc'
ac_ct_DUMPBIN=''
am__EXEEXT_FALSE=''
am__EXEEXT_TRUE=''
am__fastdepCC_FALSE=''
am__fastdepCC_TRUE=''
am__include=''
am__isrc=' -I$(srcdir)'
am__leading_dot='.'
am__nodep=''
am__quote=''
am__tar='$${TAR-tar} chof - "$$tardir"'
am__untar='$${TAR-tar} xf -'
bindir='${prefix}/bin'
build='x86_64-pc-linux-gnu'
build_alias=''
build_cpu='x86_64'
build_os='linux-gnu'
build_vendor='pc'
datadir='${datarootdir}'
datarootdir='${prefix}/share'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
dvidir='${docdir}'
exec_prefix='NONE'
host='x86_64-pc-linux-gnu'
host_alias=''
host_cpu='x86_64'
host_os='linux-gnu'
host_vendor='pc'
htmldir='${docdir}'
includedir='${prefix}/include'
infodir='${datarootdir}/info'
install_sh='${SHELL} /home/thomas/.conan/data/libxml2/2.11.4/_/_/build/f0cb5ad7a4a12e1d84218fb638deb2fa5fe11a47/src/install-sh'
libdir='${prefix}/lib'
libexecdir='${exec_prefix}/libexec'
localedir='${datarootdir}/locale'
localstatedir='${prefix}/var'
mandir='${datarootdir}/man'
mkdir_p='$(MKDIR_P)'
oldincludedir='${prefix}/include'
pdfdir='${docdir}'
pkgpyexecdir=''
pkgpythondir=''
prefix='/'
program_transform_name='s,x,x,'
psdir='${docdir}'
pyexecdir=''
pythondir=''
runstatedir='${localstatedir}/run'
sbindir='${prefix}/bin'
sharedstatedir='${prefix}/com'
sysconfdir='${prefix}/etc'
target_alias=''

## ----------- ##
## confdefs.h. ##
## ----------- ##

/* confdefs.h */
#define PACKAGE_NAME "libxml2"
#define PACKAGE_TARNAME "libxml2"
#define PACKAGE_VERSION "2.11.4"
#define PACKAGE_STRING "libxml2 2.11.4"
#define PACKAGE_BUGREPORT ""
#define PACKAGE_URL ""
#define PACKAGE "libxml2"
#define VERSION "2.11.4"

configure: exit 77

see also #11437

Here is my current workaround:
conan-io/conan-center-index@e207c0b
Is there a better way?
I think it would also work to update my build server to Debian12.
UPDATE: I now use a Debian12 build-container, it compiles as expected.

@yzsolt
Copy link

yzsolt commented Dec 13, 2023

Bumping because I ran into the exact same issue when building for Yocto x64 on an Ubuntu x64 host. Interestingly everything worked and I didn't notice that Conan thought it's not cross-compiling, until I added gRPC as a dependency.

gRPC needs a runnable grpc_cpp_plugin binary on the build machine, and the gRPC recipe would indeed install "itself" for the build environment if cross_building() would return True. I also tried the hack mentioned above, patching Conan to always return True for cross_building() but then I ran into a "loop/cycle detected error" and gave up.

So I guess there are two issues here:

  • Comparing OS and arch is not enough to detect cross-compilation
    I don't know what a future-proof, automatic solution would be here, but in the meantime a "force cross-compilation" flag would probably suffice, if recipes always use the cross_building() helper and have no hand-rolled detection mechanisms.
  • Same OS and arch for build and host profiles may generate the same package ID while the packages are not binary compatible
    I think this can be mitigated manually by e.g. adding an os.distro subsetting, just like in the examples. Maybe it's worth to add a remark to the cross-compilation documentation about this.

With the emerge of ARM laptops this can become a more common issue, e.g. when building from an ARM Linux laptop to Raspberry.

Also note that there is a possible duplicate issue: #9808

@jasal82
Copy link
Contributor

jasal82 commented Jun 25, 2024

Bump. Ran into an issue with the benchmark library on a Yocto x86_64 toolchain where the generated executables cannot be run on the build system (different ld loader naming convention). What about a conf that forces cross_building() to true? We could set that in the respective profile.

@CMelanie
Copy link
Contributor

I ran into a similar issue here, maybe the suggested workaround also works for you?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants