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
[vcpkg-ci-meson] New test port #38658
base: master
Are you sure you want to change the base?
Conversation
2f54ad0
to
33207ce
Compare
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 self.static: | ||
- if not self._add_sub_dependency(iconv_factory(env, self.for_machine, {'static': True})): | ||
+ code = '''#include <libintl.h>\n\nint main() {\n gettext("Hello world");\n}''' | ||
+ if self.static or not self.clib_compiler.links(code, env, dependencies=[self], extra_args=self.clib_compiler.get_option_link_args(self.clib_compiler.get_options()))[0]: |
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.
Fixing meson intl
detection on windows-static...
... but still not using WindowsApp.lib
from c(pp)_winlibs
.
Reference: mesonbuild/meson#7630 (comment) (from 2020!).
@@ -356,7 +356,7 @@ function(vcpkg_configure_meson) | |||
set(meson_input_file_${buildname} "${CURRENT_BUILDTREES_DIR}/meson-${TARGET_TRIPLET}-${suffix_${buildname}}.log") | |||
endif() | |||
|
|||
vcpkg_list(APPEND arg_OPTIONS --backend ninja --wrap-mode nodownload -Dbuildtype=plain -Doptimization=plain) | |||
vcpkg_list(APPEND arg_OPTIONS --backend ninja --wrap-mode nodownload -Doptimization=plain) |
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.
Original form was suggested in mesonbuild/meson#11257 (comment) (from Jan 2023), and added despite the config warning it generates.
Maybe the original issues was fixed with 1.0.1 (Feb 2023).
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.
It suffices to only pass -Dbuildtype=plain, I think. I may have missed a /
in that comment and forgot to reply?
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.
The general options here are combined with per-build-type options which ATM control meson's -Ddebug
.
Let's say the key goal is to use the pristine flags provided by vcpkg while keeping meson informed about the type of build.
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 see now that there is also a build type custom
which would be implicitly activated by -Doptimization=plain -Ddebug=true
.
https://mesonbuild.com/Builtin-options.html#details-for-buildtype
(Sorry AT eli-schwartz, I pressed submit too early.) |
Effect of
IMO the final list of libraries is in wrong order, but |
OMG, our version of meson sorts the libs alphabetically. Fixed in mesonbuild/meson@05f4e0d because it broke Apple frameworks, but plain static linking also needs to respect order. |
Yeah fun with meson o.O. The self proclaimed build system of the future..... just feel free to patch the hell out of it until it learns to behave :) |
@dg0yt considering there is no complaint when linking, one may theorize that meson knows what it is doing and this isn't a problem after all. I would elaborate on what exactly I mean by that (I had a lengthy comment prepared last night), but it seems the peanut gallery has found your PR and reduced my ability to care. Instead I'll leave @Neumann-A with the following insight:
Truly, we live in the glorious future of build systems, within which perfection has been reached and the One True Way has been discovered. This message has been sponsored by CMAKE(tm), the ISO standard build system of the 21st century. Accept no substitutes. |
@dg0yt If you touch meson anyway you might want to directly update to 1.4.0 and investigate what issues appear with that version. I have another change in #37409 which allows to setup extra properties in meson but that probably has to wait until another port actually requires it. don't know why eli-schwartz feels personally attacked by my previous comment but it seems like you have to carry the meson behavior discussion to the meson github. (Probably also makes it more discoverable for other people having a similar issues/questions) |
I've tried to update meson to 1.4.0 in #37599. LLVM update is blocked by mesa, mesa build is blocked by meson... |
I do have some sympathy for, and some disappointments from, both CMake and meson. And the same is true for vcpkg, maybe even worse. These disappointments are no excuse for disrespectful communication. |
Software is, indeed, complicated and occasionally frustrating. I'm not aware of anyone that ever achieved perfection. Which does make it a bit annoying when I'm pinged on vcpkg <--> meson integration issues and then have to deal with people that to my knowledge have never once attempted to be cordial with the meson project, who show up exclusively in this issue to make... non-cordial jokes. Perhaps it will be better going forth -- it seems he's blocked me on github and I can only assume intends to not come asking me for help with meson in the future. |
@@ -20,6 +20,7 @@ pkg-config= ['@PKGCONFIG@'] | |||
[properties] | |||
cmake_toolchain_file = '@SCRIPTS@/buildsystems/vcpkg.cmake' | |||
[cmake] | |||
CMAKE_BUILD_TYPE = '@buildconfig@' |
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.
Better check the toolchain meson generates. Could very well be that it is overriding this value.
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.
This isn't added for fun. I didn't test with Meson 1.4 which has changes for CMAKE_BUILD_TYPE
. But at the moment we need this. And ideally the proper configuration is validated by vcpkg-ci-meson
.
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 did not see any change in 1.4 regarding CMAKE_BUILD_TYPE
in the generated toolchain nor the invocation log.
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.
Would it make sense to split this and the changes to vcpkg_configure_meson
suppressing the meson warnings out into a different PR?
The list in #38658 (comment) seems quite long and the stuff I mentioned seems to be trivial to merge while the other points might require a lot more iterations and time to solve.
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.
Some splitting could be applied. But this is still in an experimental phase. Basically I'm studying mingw cross builds on linux in order to fix windows and uwp ;-) (How did I get here? Must have been gtk
.)
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.
FTR this is the coming change in meson: mesonbuild/meson#12947
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.
Would it make sense to split this and the changes to
vcpkg_configure_meson
suppressing the meson warnings out into a different PR?
@@ -0,0 +1,23 @@ | |||
project('vcpkg-ci-meson', 'c', version: '1.0') | |||
|
|||
apple_frameworks = dependency('appleframeworks', modules: 'foundation', required: false) |
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.
Workaround.
For cmake, this should come from the dependency.
TARGET_NAME, LINK_ONLY, CONFIG
|
||
cargs += self.get_compiler_check_args(mode) | ||
+ if mode is CompileCheckMode.LINK: | ||
+ # Add <lang>_winlibs, accounting for machhine file |
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.
+ # Add <lang>_winlibs, accounting for machhine file | |
+ # Add <lang>_winlibs, accounting for machine file |
- if not self._add_sub_dependency(iconv_factory(env, self.for_machine, {'static': True})): | ||
+ code = '''#include <libintl.h>\n\nint main() {\n gettext("Hello world");\n}''' | ||
+ if self.static or not self.clib_compiler.links(code, env, dependencies=[self])[0]: | ||
+ if not self._add_sub_dependency(iconv_factory(env, self.for_machine, {'static': self.static})): |
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.
NB: system iconv on macOS is dynamic lib.
@eli-schwartz The original post is now updated to reflect sub-issues and proposed fixes, including naming the relevant patches. I understand that the patches need to be transfered to meson PRs. The entry barrier is creating proper unit tests which correspond to what is an end-to-end test in port vcpkg-ci-meson, for the static and uwp vcpkg triplets. I'm not very familiar with python and meson. And I have seen some meson PRs targeting CMake support with a conan background. There is some overlap. |
/azp run |
Azure Pipelines successfully started running 1 pipeline(s). |
Cherry-picked and extended from #38658. And a minor refactoring for easier management of patches. llvm 18 changes for #37599, squashed from #37599 (comment).
@dg0yt Do you think you'll need more changes to |
Cherry-picked from #38658: Fixes errors like ~~~ CMake Error at /Users/vcpkg/Data/installed/x64-osx/share/ffmpeg/FindFFMPEG.cmake:70 (find_library): Could not find FFMPEG_DEPENDENCY_-F/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/System/Library/Frameworks_RELEASE using the following names: -F/Library/Developer/CommandLineTools/SDKs/MacOSX14.2.sdk/System/Library/Frameworks Call Stack (most recent call first): /Users/vcpkg/Data/installed/x64-osx/share/ffmpeg/FindFFMPEG.cmake:144 (append_dependencies) /Users/vcpkg/Data/installed/x64-osx/share/ffmpeg/vcpkg-cmake-wrapper.cmake:25 (_find_package) /Users/vcpkg/Data/work/1/s/scripts/buildsystems/vcpkg.cmake:813 (include) CMakeLists.txt:32 (find_package) ~~~
@Neumann-A It should only need a cleanup and rebase onto master after integration of the split-out PRs. Then the PR will be ready for review. (I need to see if the current changes are accepted into vcpkg and into meson. Fixing the remaining lib order quirk is out of scope for this PR.) |
Check canonical use of builtin dependency providers.
meson issues:
cmake
dependency method return debug lib paths in release config.Reason: CMake is run without
CMAKE_BUILD_TYPE
.Proposed: Set
CMAKE_BUILD_TYPE
. Vcpkg portvcpkg-tool-meson
.Cherry-picked into [vcpkg-tool-meson] Fix warnings, cmake, llvm 18 #38796.
intl
failing on windows-static tripletsReason: meson not using
iconv
linking requirement unless asking for staticintl
.Proposed: add
iconv
dep when linking fails. Meson.Patch:
dependencies-misc-diff
.intl
failing on appleReason: meson not using
CoreFoundation
linking requirement.Proposed: add
foundation
framework dep when linking fails. Meson.Patch:
dependencies-misc.diff
.Not using vcpkg cmake toolchain, ignoring vcpkg cmake wrappersIgnoring
$<CONFIG:...>
elements.Observed for the
intl
cmake method (vcpkg patch):Intl::Intl
is not configured withIconv::Iconv
as expected.Reason: Meson's cmake dependency parser cannot handle generator expression in interface link libraries (even not the typical generated
$<LINK_ONLY:>
): Meson not respecting config dependent generator expressions in INTERFACE_LINK_LIBRARIES from CMake dependencies. mesonbuild/meson#8232Proposed: Extend generator expression support. Meson.
Patch:
cmake-generator-expressions.patch
.WindowsApp.lib
on uwpObserved for
iconv
, despiteWindowsApp.lib
being in the crossfile'swinlibs
.Reason: A link check is more bare-bones than generating build rules for executable target. The link check needs explicit link args.
Proposal: Add winlibs to link checks. Meson.
Patch:
winlibs.patch
.-framework FRAMEWORK
link libraries.Observed after adding
-framework CoreFoundation
in vcpkg wrapper forFindIntl.cmake
.Reason:
-framework
arguments are not recognized as linker options, and cannot be resolved as CMake targets.Proposal: Treat them like
-lLIB
. Meson.Patch:
cmake-trace-framework.diff
.Observed for intl/iconv/charset in x64-mingw-static, although without raising an error.
Reason: Meson sorts libs alphabetically, after losing order while forming a set.
Proposal: Remove lib list cleanup. (Maybe remove early duplicates). Meson.
Patch:
cmake-no-sorted.diff
.Even with sorting removed, the result will be wrong:
Reason: link libs are added as soon as reaching a target in the dependency digraph. This is not the required topological sort.
Proposal: Implement topological sort. Meson.
Patch: TBD (FTR I worked on this topic recently in
pkgconf
.)