$ conan install libjpeg/9c@ -pr ios-x86_64-release --build missing
With the ios-x86_64-release profile:
[build_requires]
darwin-toolchain/1.0.6@theodelrieu/stable
[settings]
os=iOS
os.version=9.0
compiler=apple-clang
compiler.version=11.0
compiler.libcxx=libc++
os_build=Macos
arch_build=x86_64
build_type=Release
arch=x86_64
source_subfolder/configure '--enable-shared=no' '--enable-static=yes' '--prefix=/Users/theo/.conan/data/libjpeg/9c/_/_/package/da19cce1f78c02bc458c542be18262529975d9ab' '--bindir=${prefix}/bin' '--sbindir=${prefix}/bin' '--libexecdir=${prefix}/bin' '--libdir=${prefix}/lib' '--includedir=${prefix}/include' '--oldincludedir=${prefix}/include' '--datarootdir=${prefix}/share' --build=x86_64-apple-darwin --host=x86_64-apple-darwin
checking build system type... x86_64-apple-darwin
checking host system type... x86_64-apple-darwin
checking target system type... x86_64-apple-darwin
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... source_subfolder/./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking whether to enable maintainer-specific portions of Makefiles... no
checking for x86_64-apple-darwin-gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang
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/Users/theo/.conan/data/libjpeg/9c/_/_/build/da19cce1f78c02bc458c542be18262529975d9ab': configure: error: cannot run C compiled programs. If you meant to cross compile, use--host'.
See `config.log' for more details
As you can see, the --build and --host values are exactly the same (i.e. x86_64-apple-darwin). Thus autotools does not consider the current build as a cross-build, and it fails.
In this case, the --host should be x86_64-darwin-ios (the default should be x86_64-darwin-macos by the way, from what I've understood from reading the config.sub file).
Also note that it only fails when building for the 64-bit iOS simulator, but for completeness, the triplet for 32-bit simulator should become i686-darwin-ios, to avoid confusion with 32-bit macOS systems (which do not exist anymore, fair enough).
EDIT: Linked to https://github.com/theodelrieu/conan-darwin-toolchain/issues/10
it would be very nice if this was fixed. currently forces me to maintain yet another recipe fork (libjpeg), which I don't really want to push upstream, since it is basically just a workaround, muddening up the recipe.
Hi! Having a quick look at the source code of the AutoToolsBuildEnvironment class, I see there is probably a bug (and incomplete feature) in the host/build/targets triplets we are building. At least, the build triplet we are creating (build = get_gnu_triplet(os_detected, arch_detected, self._compiler)) doesn't take into account os_build and arch_build.
This is something we need to fix/improve.
@jgsogo
I don't know if it's relevant here, but in cc65,
I modified self.settings to copy arch_build and os_build to arch and os.
I think it's fine that the build helpers take only arch and os into account.
But they should warn when one of these is not defined and some default is used.
It's better to be explicit about these things.
If I understand the situation correctly, then the AutoToolsBuildEnvironment build helper should respect os_build and arch_build.
Build helpers should make things as easy as possible, copying values manually sounds like a workaround
is anyone stabbing at this? otherwise I might to and try ...
@maddanio I don't think there is, feel free to try it out ;)
@maddanio
How are things going? Can I help with anything?
hmm, as always, too much other stuff on the plate...
hmm, as always, too much other stuff on the plate...
Yes, sorry, same here, we have been swamped too, couldn't check this further. If someone could try to contribute a fix, that will definitely help.
@jgsogo one of the things that I would like to consider for the cross-building is how the build helpers like AutoToolsBuildEnvironment could use the build_profile to use to build the triplets, instead of having to obtain the current os and arch from detected_os(), platform.machine(), etc.
I am wondering.
If os_build and arch_build will influence the build helpers (CMake, AutoToolsBuildEnvironment and Meson), does it also influence the dependency tree?
Does conan currently know that its requires must be chosen such that requirement.os == new_package.os_build and requirement.arch== new_package.arch_build?
Does conan currently know that its requires must be chosen such that requirement.os == new_package.os_build and requirement.arch== new_package.arch_build?
With one of the latest PR merged to develop, that is more or less the model that will be applied. There will be 2 profiles (not os_build, arch_build), one "host" profile (the regular one) and one "build" profile. For build_requires, there will be a switch, and the "build" profile will be applied.
This model is not accessible yet, it is only in the core, the UI will most likely be released in next Conan 1.24.
@jgsogo one of the things that I would like to consider for the cross-building is how the build helpers like AutoToolsBuildEnvironment could use the
build_profileto use to build the triplets, instead of having to obtain the current os and arch fromdetected_os(),platform.machine(), etc.
Yes, I'm almost sure that the conanfile object needs to know the profile_host and the profile_build (right now it has only a boolean using_build_profile). A custom implementation of the build() method might need it and the build helpers will need it.
1.24 will add (馃 ) the PR https://github.com/conan-io/conan/pull/5594 that implements the command line interface to use the new cross-building model, still for very na茂ve graphs but it starts to work. On top of it there is a lot of work to do related to build-helpers, passing options (one of the hardest things in my POC) and more complex use cases.
But I feel like we are on the right path now 馃槂
Coming back to this issue, we can fix it for the current model without waiting for the new one.
Labeled this as help wanted, if someone can give a try, please report before doing, so nobody collides. Thanks!
Correct triplets have been defined in #6748, will be released in Conan 1.27
Most helpful comment
If I understand the situation correctly, then the
AutoToolsBuildEnvironmentbuild helper should respectos_buildandarch_build.Build helpers should make things as easy as possible, copying values manually sounds like a workaround