-
Notifications
You must be signed in to change notification settings - Fork 985
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
[bug] creating iOS packages using simple toolchains broken as of conan 1.26 #7493
Comments
Maybe this would be a reasonable fix? diff --git a/conans/client/build/cmake_flags.py b/conans/client/build/cmake_flags.py
index ca91d250b..439517110 100644
--- a/conans/client/build/cmake_flags.py
+++ b/conans/client/build/cmake_flags.py
@@ -298,7 +298,8 @@ class CMakeDefinitionsBuilder(object):
definitions["CMAKE_OSX_ARCHITECTURES"] = tools.to_apple_arch(arch)
# xcrun is only available on macOS, otherwise it's cross-compiling and it needs to be
# set within CMake toolchain
- if platform.system() == "Darwin":
+ toolchain_file = os.getenv("CONAN_CMAKE_TOOLCHAIN_FILE")
+ if platform.system() == "Darwin" and not toolchain_file:
definitions["CMAKE_OSX_SYSROOT"] = tools.XCRun(self._conanfile.settings).sdk_path Also @DoDoENT we would be interested in your feedback for the We are preparing a patch release Conan 1.28.1, are you planning to upgrade to 1.28 or to which other version? |
I think it requires a bit different fix. |
copying comment from @anuraaga also:
|
Ok, would be then an easy fix?, do you think you could prepare a patch for 1.28.1 @SSE4 ? |
We are currently stuck at 1.25.2 due to this bug (I've actually discovered it soon after 1.26.1 was released, by was unfortunately too busy to test the behaviour thoroughly, make sure that it really is a bug and not something on my side and write a proper bug report - sorry about that). As soon this gets fixed, we will upgrade to 1.28.1, provided that we don't find some other new bugs that would stop us in upgrade along the way 😛
I didn't play with this feature, but I've read the documentation as part of trying to find a workaround for this very issue and this got me confused. Basically the current Here is what I expect from the
Ideally, a proper toolchain should be a conan package itself, with its own options (for example, clang toolchain may have options to toggle LTO, AddressSanitizer, ControlFlowSanitizer, ...). The only difference to the "normal" should be the ability to impose settings to the rest of the dependency graph at the cost of having only a single toolchain per build context in the graph. At the moment, this is only possible via the command line or by using profiles. As you can see, the toolchains are more related to profiles and build requirements than the concrete packages - this is what first confused me when I saw Actually, to be fair, most of the abilities I've described above are already possible with the current conan model, although it requires some orchestration between profiles and conan packages which requires some conan experience and can be very intimidating for the beginners. But it works quite well when configured properly. Here is how we currently do it at Microblink:
So, I would seek-out to implement toolchains as an upgrade to profiles. Just like packages allow
I hope this gives some good feedback about what I think about current conan's "toolchain" feature. Also, since conan tribe 2.0 messaging hasn't started yet, feel free to reference this comment there as soon as it starts. |
I've just tried creating an iOS package with this patch and it works correctly - just like in 1.25.2. Thank you! |
I wonder if this whole issue could have been avoided when this |
Consider this simple iOS toolchain (based on this toolchain):
Let's create a simple package that contains this toolchain:
Also, let's create a conan profile using this toolchain:
Now, let's use this profile to create some package
With Conan 1.25.2 and earlier, everything works. With Conan 1.26.1 and later (also tested with 1.28.0), I get the following CMake configuration error:
The problem can be traced to how conan's CMake build helper invokes cmake:
The problematic part is
-DCMAKE_OSX_SYSROOT="/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk"
- this overrides theCMAKE_OSX_SYSROOT
variable as set by the toolchain. Also problematic is-DCMAKE_OSX_ARCHITECTURES="None"
that does the same.When executed with
CONAN_PRINT_RUN_COMMANDS=1
by using conan 1.25.2 (or earlier), it can be seen that those two variables are not given via command-line prior toCMAKE_TOOLCHAIN_FILE
.I know that from v1.26 there is support for new toolchain mechanism, but I didn't get how should I modify my toolchain files to work with the new conan.
The text was updated successfully, but these errors were encountered: