-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
[c-ares] Fix cross building #4492
[c-ares] Fix cross building #4492
Conversation
This comment has been minimized.
This comment has been minimized.
9832b32
to
02a6a31
Compare
This comment has been minimized.
This comment has been minimized.
Usually we add an option (others cross compilation can produce these executables). if self.options.tools:
bin_path = os.path.join(self.package_folder, "bin")
self.output.info("Appending PATH environment variable: {}".format(bin_path))
self.env_info.PATH.append(bin_path) Take also into account, that this option has been added in 1.15.0 in upstream's CMakeLists. Maybe a small patch could be added for 1.14.0 to avoid branching based on versions in conanfile: https://github.com/c-ares/c-ares/blob/17dc1b3102e0dfc3e7e31369989013154ee17893/CMakeLists.txt#L673 |
Please consider DiracResearch#1 |
02a6a31
to
efcd492
Compare
This comment has been minimized.
This comment has been minimized.
Good points @SpaceIm. I have applied the changes you suggested. FYI: I have applied for the EAP thing but I'm not in yet. |
efcd492
to
244107e
Compare
This comment has been minimized.
This comment has been minimized.
244107e
to
0a9472d
Compare
This comment has been minimized.
This comment has been minimized.
0a9472d
to
98bad9e
Compare
This comment has been minimized.
This comment has been minimized.
98bad9e
to
ea013cd
Compare
Sorry, the build is only launched for Early Access Program users. You can request access writing in this issue. |
I detected other pull requests that are modifying c-ares/all recipe: This message is automatically generated by https://github.com/ericLemanissier/conan-center-conflicting-prs so don't hesitate to report issues/improvements there. |
ea013cd
to
4aeb8be
Compare
Sorry, the build is only launched for Early Access Program users. You can request access writing in this issue. |
recipes/c-ares/all/conanfile.py
Outdated
# Default build tools to false if cross building, otherwise to true. | ||
if self.options.tools == None: | ||
self.options.tools = not tools.cross_building(self.settings) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure if we should not delegate this responsability to consumers (coherent with others recipes), so c-ares:tools=True
by default
And if you want to cross build to Android/iOS, don't forget to set to False any option like utilities, tools etc in all recipes which have such option.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just think that options should have good defaults and in almost all situations I think you are not interested to have these tools for the host environment when cross building. The recipe still allows you to set the option if the default is not what you want.
I'm planing to contribute similar things for other recipes (like protobuf with it's protoc tool). So I guess it good to take make a decision here and go with it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not. Let's wait opinion of others contributors.
Anyway, if self.options.tools == None:
is useless, options values are unknown at config_options
time. Just keep self.options.tools = not tools.cross_building(self.settings)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the == None
is needed. See conan-io/conan#3519.
The "pattern" is taken from the docs: https://docs.conan.io/en/latest/reference/conanfile/attributes.html#default-options
def config_options(self):
if self.options.some_option == None:
if self.settings.os == 'Android':
self.options.some_option = True
else:
self.options.some_option = False
I noted that conan create
and conan install
behaves differently.
With conan install
the None check is needed but not with conan create
. Weird..
Some configurations of 'c-ares/1.17.1' failed in build 9 (
|
Sorry, I don't understand what the errors are.
I think that's unrelated the this PR and is more likely caused by different CMake versions on the build agents. |
This has always been my guess that the (wrong) stdout/stderr redirections/interceptions cause CCI to mark the successful build as failed. @jgsogo @anton-dirac Try to close the PR and open it again after 15 seconds, maybe the "errors" are gone. |
4aeb8be
to
6fc7a6f
Compare
- Add option to build tools or not. Can for example be used to disable tools when cross building. - Add patch to that adds CARES_BUILD_TOOLS on older versions (1.14.0). - iOS, not just Macos, needs `resolv`. This enables the package to be used in iOS and Android builds.
3b4ca3f
to
59565dd
Compare
An unexpected error happened and has been reported. Help is on its way! 🏇 |
All green in build 17 (
|
All of this is really interesting. 🤔 |
Reviewers:
I think the only way to fix this is to patch the CMakeLists file in c-ares. |
It is totally fine. Someone can take care of them in the future if those tools are needed in a ios/android scenario. We cannot fix everything in each PRs, let's go step by step! Every contribution helps to improve C++ ecosystem. Thanks a lot! |
No because it will require to patch c-ares forever. I prefer to wait that conan supports setting default option value with |
Ok, makes sense. So merge this and I might create a new PR in the future depending on how other things pan out? |
FYI: It was a one-liner fix in c-ares c-ares/c-ares#395 |
Nice, it looks good to me to add a patch in all current versions of c-ares in CCI. |
Fixes: INSTALL TARGETS given no BUNDLE DESTINATION for MACOSX_BUNDLE executable on iOS.
65313e9
Yes and it depends. |
All green in build 18 (
|
Add option to build tools or not. Defaults to false when cross building and true otherwise.
Add patch to that adds CARES_BUILD_TOOLS on older versions (1.14.0)
This enables the package to be used in iOS and Android builds.
Specify library name and version: c-ares/all
conan-center hook activated.