conan-darwin-toolchain
conan-darwin-toolchain copied to clipboard
Profile for iOS simulator
I am trying to build some libraries using .configure but I am getting this error while trying to build it for iPhone Simulator for macOS.
Following is my profile:
include(default)
[settings]
os=iOS
os.version=11.0
arch=x86_64
[build_requires]
darwin-toolchain/1.0.4@theodelrieu/stable
build in conanfile.py
autotools = AutoToolsBuildEnvironment(self)
self.run("cd .. && autoreconf -fsi")
autotools.configure(configure_dir="..", args=["--prefix=${PWD}"])
autotools.make()
error while building for iOS simulator
configure: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
ERROR: conanfile.py (meshlink/None): Error in build() method, line 17
autotools.configure(configure_dir="..", args=["--prefix=${PWD}"])
ConanException: Error 1 while executing ../configure '--prefix=${PWD}' '--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
I had this issue with some library also. It is most likely due to --host and --build having the same value.
Could you try autotools.configure(..., host="x86_64-apple-ios")?
That did not work as well. If I change the profile to exclude the build_requires section, then it works but I am yet to test the binary on the simulator.
If you can share the recipe, I'll be able to reproduce the issue
If you can share the recipe, I'll be able to reproduce the issue
https://github.com/elear-solutions/meshlink/blob/elear-master/conanfile.py
Adding host="x86_64-apple-ios" fixes the first issue on my machine, but it fails later on with catta:
=== configuring in catta (/tmp/meshlink/build/catta) configure: WARNING: no configuration information is in catta /Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive Making all in catta make[2]: *** No rule to make target `all'. Stop. make[1]: *** [all-recursive] Error 1
for now I have written a _targets method to filter the target as per the input from conan
And did it fix your issue?
yeah sorry was busy applying the fix on all the conan files, yeah basically I wrote a lookup table by using the function to determine the host. That fixed the issue for now, maybe you can put this on your backlog :) thanks for all the help
I have trouble building libjpeg from conan-center for simulator. it is using autotools. curiously I found a very simple script that actually works here. is it possible to teach conan to do that using this profile?
@maddanio I've had the same error, which is unfortunately quite common with the AutoToolsBuildEnvironment helper. The thing is that it guesses the host wrong, and gives the same value to both --build and --host (i.e. x86_64-darwin-apple, instead of x86_64-darwin-ios).
You can override the default value by calling env_build.configure(..., host="x86_64-darwin-ios"). I will open an issue to Conan about the helper, I had this problem several times in my recipes.
EDIT: For some reason, I've only understood now that this is likely a Conan problem...
The workaround I use to enable mutliple profile builds using the same file.
class libConan(ConanFile):
@property
def _targets(self):
return {
"iOS-x86-*": "i386-apple-ios",
"iOS-x86_64-*": "x86_64-apple-ios"
}
def config_options(self):
args = ["--prefix=${PWD}"]
return args
def build(self):
autotools = AutoToolsBuildEnvironment(self)
args = self.config_options()
self.run("cd .. && autoreconf -fsi ")
query = "%s-%s-%s" % (self.settings.os, self.settings.arch, self.settings.compiler)
ancestor = next((self._targets[i] for i in self._targets if fnmatch.fnmatch(query, i)), None)
if not ancestor:
autotools.configure(configure_dir= "..",args= args, use_default_install_dirs=True)
else:
autotools.configure(configure_dir= "..",args= args, use_default_install_dirs=True, host= ancestor)