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
[android] vcpkg_configure_make correct set flags for android build #15605
[android] vcpkg_configure_make correct set flags for android build #15605
Conversation
Regression when building
|
Regression is gone. |
@Neumann-A Can you please review again? Thanks. |
Fixes #15255. |
Seems have many regressions when building |
…e_crosscompiling_android
…e_crosscompiling_android
@xandox Thanks for the contribution. I've been playing around with this PR to try and build 'libiconv' the past two days, and I've found a few things that have prevented that port from building. I think most of it was that And according to @DanAlbert post in the NDK repo and the NDK integration with other build systems documentation those really shouldn't be in there. I guess this isn't really a problem with |
@venabled hi. I am not sure what you mean. I am able to build libiconv with 21d and 22 ndk. What is you problem? According to the article you provided - yes, looks like |
I guess I should have been more specific, I had to modify 'libiconv' port as the current port only builds from source if you're on Windows. |
Yes, sure. See #15606. |
Possibly superfluous context here, but in case it's helpful: While they're not necessary to build correctly, as long as they are set to the appropriate values they shouldn't harm anything. The toolchain file still configures them because (iirc), CMake's
The problem in the NDK bug linked was that folks had set |
…e_crosscompiling_android
Cool, @JackBoosY could you review today? |
ports/libiconv/portfile.cmake
Outdated
@@ -1,4 +1,4 @@ | |||
if(NOT VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_ANDROID) | |||
if(NOT VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_CROSSCOMPILING) |
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.
What is the point of this change? Port libiconv could be empty when the target has iconv, but it must be built
- when the target is Windows.
- when the target is ...
But it doesn't matter if we are cross compiling.
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.
If I am building libiconv on linux-x64 for linux-arm64 without VCPKG_CROSSCOMPILING it will let empty, for example.
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.
If I am building libiconv on linux-x64 for linux-arm64 without VCPKG_CROSSCOMPILING it will let empty, for example.
IIUC that's just the intention of that code block: "iconv is empty unless built for Windows or Android." Probably this assumes iconv system libraries on linux, osx or bsd, and maybe this is not 100% right. But it doesn't matter if you compile from a different platform or natively.
Can you just remove the iconv changes from this PR? IMO they seem to be unrelated to "vcpkg_configure_make flags for android".
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.
ok, done
Can you please resolve the file conflicts? |
done |
…use system headers
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 would like to note that the get_cmake_vars
project is transforming into a unit which no longer reports the actual cmake variables. This is probably beneficial for some use cases, but it can fail miserably for other uses.
My preference would be a clearer separation of concerns, e.g. by using different variables for computed effective properties, and/or by offering a separate entry point for getting these properties.
foreach(_lang IN ITEMS C CXX) | ||
foreach(INCDIR ${CMAKE_${_lang}_IMPLICIT_INCLUDE_DIRECTORIES}) | ||
string(APPEND CMAKE_${_lang}_FLAGS " ${CMAKE_INCLUDE_SYSTEM_FLAG_${_lang}}${INCDIR}") | ||
endforeach() |
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 don't see the benefit here. Implicit directories are needed to be known in order to find a file in build system configuration steps, but they do not need to be given explicitly to the compiler.
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.
Unfortunately for some cases it needed to be explicitly provided. Especially for macos native compiler.
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.
Unfortunately for some cases it needed to be explicitly provided. Especially for macos native compiler.
Now I wonder how I can build autotools projects without vcpkg/cmake.
(All really meant constructive. I just want to avoid pitfalls from my personal cross-platform cmake experience.)
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.
Yep. good catch.
I am not good in autotools or macos, so some explanation could be not accurate. But what I saw is. There are two different compile system in macos (how I understand this). First one which cmake
uses usually placed in /Library/....
. The compiler in this system unusable without all this flags and include directories. And cmake provide them to it. The second one placed in /usr/bin
and if you just run configure.sh
for some autotools package very probably that it will select second one system. And it is what happen right now in master
when you install some autotools
package by vcpkg
. So there is some inconsistent.
When I just start this PR I tried to leave this behaviour unchanged. But guys decided it's not good idea. And now I force autotools
use the same compiler as cmake
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.
When I just start this PR I tried to leave this behaviour unchanged. But guys decided it's not good idea. And now I force
autotools
use the same compiler ascmake
Yes, this is a good thing.
I am not good in autotools or macos
I wouldn't claim to be an expert. This discussion is also an invitation for others to help with feedback.
Not sure what you mean. Which variable it reports now?
It reports all properties, consumer could use only what they need. |
Why do we need host cmake vars? VCPKG should not build for the host but only the target! host binaries are provided by host dependencies! Otherwise patch the buildsystem |
Host cmake vars needed for host tools used during compilation (file generators and so on).
It's good idea but not for all ports in single pull request. Let's merge this one which works, and then everyone who would like to patch every single autotools port to separate host-build-tools from main package could do it in their own rithm. |
All the added lines which look like |
So, you suggest to make another one project like |
I didn't want to jump into proposing a particular implementation. Following the single responsibility principle and the principle of least surprise, Disclaimer: This is just personal opinion of an external contributor. |
Gentle ping, an integration of this would be much appreciated (it's really nice work) |
@strega-nil-ms @m-kuhn Sorry, but right now I have no time to work on this PR. If someone would take over this I will be appreciated. |
I am afraid this pull request is outside my comfort zone and I don't have the time available to expand this zone at the moment. Even if it was within the zone, what I think this needs currently is:
and since number 2 depends on number 1 it will be hard to take over for anyone at the moment |
If you want to continue this PR, please reopen it. |
vcpkg_configure_make properly set CFLAGS, CXXFLAGS, LDFLAG, CC and CXX env variables now for android cross compilation.
Which triplets are supported/not supported? Mostly android triplets,
Have you updated the CI baseline? - no
Does your PR follow the maintainer guide?
yes