Skip to content
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-cmake][libpng] Add "OSX_SPLIT_BUILD" feature #22898

Closed
wants to merge 2 commits into from

Conversation

omartijn
Copy link
Contributor

@omartijn omartijn commented Feb 2, 2022

Describe the pull request

  • What does your PR fix?

It enabled universal binaries for cmake-based ports that somehow don't support it (e.g. because they use NASM). One such example is libpng, which now works with this PR

  • Which triplets are supported/not supported? Have you updated the CI baseline?

All. It also works for libpng when you set VCPKG_OSX_ARCHITECTURES to both arm64 and x86_64

Yes

  • If you have added/updated a port: Have you run ./vcpkg x-add-version --all and committed the result?

Yes

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have modified or added at least one vcpkg.json where a "license" field is missing.
If you feel able to do so, please consider adding a "license" field to the following files:

  • ports/libpng/vcpkg.json
  • ports/vcpkg-cmake/vcpkg.json

Valid values for the license field are listed at https://spdx.org/licenses/

@JackBoosY JackBoosY self-assigned this Feb 3, 2022
@JackBoosY JackBoosY added category:port-bug The issue is with a library, which is something the port should already support category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly labels Feb 3, 2022
@omartijn
Copy link
Contributor Author

omartijn commented Feb 3, 2022

@JackBoosY It seems the pipeline failed x86_windows, but not with any error I can understand. Looks like the "Test Modified Ports and Prepare Test Logs" failed, but the message simply states:

Evaluating: SucceededNode()
Result: False

Is this something I can fix on my end or is this some other issue? Should we just restart the pipeline?

Copy link

@github-actions github-actions bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You have modified or added at least one vcpkg.json where a "license" field is missing.
If you feel able to do so, please consider adding a "license" field to the following files:

  • ports/libpng/vcpkg.json

Valid values for the license field are listed at https://spdx.org/licenses/

@BillyONeal BillyONeal changed the title Osx split build [vcpkg-cmake][libpng] Add "OSX_SPLIT_BUILD" feature Feb 4, 2022
@omartijn
Copy link
Contributor Author

omartijn commented Feb 4, 2022

@JackBoosY: Can you shed a light on this build failure: https://dev.azure.com/vcpkg/public/_build/results?buildId=66849&view=logs&j=878666d5-db33-5b27-9e7d-b0c7ee352005&t=d914c609-a9aa-5880-221f-cbd46db9069e

It says it's failed, but I don't understand why.

@JackBoosY
Copy link
Contributor

That's because you also need to update the related docs.
Please download this file and apply it, then commit.

@omartijn
Copy link
Contributor Author

omartijn commented Feb 5, 2022

Thanks, @JackBoosY, I would have never guessed that from the output!

@JackBoosY
Copy link
Contributor

cc @strega-nil-ms for review this PR.

@JackBoosY JackBoosY added the requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. label Mar 18, 2022
Copy link
Contributor

@strega-nil-ms strega-nil-ms left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is really cool! I'll bring it up to the team 😄

One thing that I'd like to see here is, instead of passing OSX_SPLIT_BUILD to both vcpkg_cmake_configure and vcpkg_cmake_install, just setting a Z_OSX_SPLIT_BUILD cache variable (just like how we do generators).

It also seems like this could be a more general solution; I think it could very easily be adapted for autotools and meson builds, at least, with a helper z_vcpkg_merge_osx_architectures.

I'm sorry it took so long for me to see this PR; it completely slipped under the radar.

docs/maintainers/ports/vcpkg-cmake/vcpkg_cmake_install.md Outdated Show resolved Hide resolved
ports/vcpkg-cmake/vcpkg_cmake_build.cmake Outdated Show resolved Hide resolved
@JackBoosY
Copy link
Contributor

Can you please resolve the file conflicts?

Thanks.

@omartijn
Copy link
Contributor Author

Can you please resolve the file conflicts?

Thanks.

Certainly. I thought I had, but I think I must've rebased on an older version of the master branch. Should be good to go now.

@JackBoosY JackBoosY added info:reviewed Pull Request changes follow basic guidelines and removed requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. labels Jun 29, 2022
@JackBoosY
Copy link
Contributor

@ras0219-msft Please review the vcpkg-cmake part.

@dan-shaw dan-shaw added requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. and removed info:reviewed Pull Request changes follow basic guidelines labels Jun 30, 2022
@JackBoosY
Copy link
Contributor

Can you please merge to master first?

@omartijn
Copy link
Contributor Author

Can you please merge to master first?

I guess you mean "merge master in first"? Just as an aside, merging to master would be when we finally get this feature in the master branch.

Anyway, during merging I noticed that master is broken. Somebody has been playing around renaming variables (which happens surprisingly often it seems), parallel_args seems to be renamed to parallel_param, as well as some other variables ending in _args now ending in _param, but this has not been consistently changed. So now there are variables being set and not used.

github-actions[bot]
github-actions bot previously approved these changes Jul 15, 2022
@JackBoosY
Copy link
Contributor

JackBoosY commented Jul 18, 2022

When building mesa:x64-windows:

[710/1008] "C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe" "-Isrc\mesa\libmesa.a.p" "-Isrc\mesa" "-I..\src\esa-22.0.2-5fd67a6f31.clean\src\mesa" "-Iinclude" "-I..\src\esa-22.0.2-5fd67a6f31.clean\include" "-Isrc" "-I..\src\esa-22.0.2-5fd67a6f31.clean\src" "-Isrc\mapi" "-I..\src\esa-22.0.2-5fd67a6f31.clean\src\mapi" "-I..\src\esa-22.0.2-5fd67a6f31.clean\src\gallium\include" "-Isrc\gallium\auxiliary" "-I..\src\esa-22.0.2-5fd67a6f31.clean\src\gallium\auxiliary" "-Isrc\mesa\main" "-I..\src\esa-22.0.2-5fd67a6f31.clean\src\mesa\main" "-Isrc\compiler\nir" "-I..\src\esa-22.0.2-5fd67a6f31.clean\src\compiler\nir" "-Isrc\util" "-I..\src\esa-22.0.2-5fd67a6f31.clean\src\util" "-Isrc\mesa\program" "-Isrc\mapi\glapi\gen" "-Isrc\compiler" "-ID:/installed/x64-windows/debug/../include" "-ID:/installed/x64-windows/include" "-DNDEBUG" "/MDd" "/nologo" "/showIncludes" "/utf-8" "/W2" "/std:c11" "/Od" "/Zi" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-D__STDC_LIMIT_MACROS" "-DPACKAGE_VERSION=\"22.0.2\"" "-DPACKAGE_BUGREPORT=\"https://gitlab.freedesktop.org/mesa/mesa/-/issues\"" "-DHAVE_WINDOWS_PLATFORM" "-DUSE_ELF_TLS" "-DUSE_TLS_BEHIND_FUNCTIONS" "-DENABLE_ST_OMX_BELLAGIO=0" "-DENABLE_ST_OMX_TIZONIA=0" "-DEGL_NO_X11" "-D_WIN32_WINNT=0x0A00" "-DWINVER=0x0A00" "-DPIPE_SUBSYSTEM_WINDOWS_USER" "-D_USE_MATH_DEFINES" "-DVC_EXTRALEAN" "-D_CRT_SECURE_NO_WARNINGS" "-D_CRT_SECURE_NO_DEPRECATE" "-D_SCL_SECURE_NO_WARNINGS" "-D_SCL_SECURE_NO_DEPRECATE" "-D_ALLOW_KEYWORD_MACROS" "-D_HAS_EXCEPTIONS=0" "-DNOMINMAX" "-DMISSING_64BIT_ATOMICS" "-DHAS_SCHED_H" "-DHAVE_DLFCN_H" "-DHAVE_STRTOF" "-DHAVE_QSORT_S" "-DHAVE_DIRENT_D_TYPE" "-DHAVE_ZLIB" "-DHAVE_ZSTD" "-DHAVE_COMPRESSION" "-DLLVM_AVAILABLE" "-DMESA_LLVM_VERSION_STRING=\"14.0.4\"" "-DLLVM_IS_SHARED=0" "-DDRAW_LLVM_AVAILABLE" "-DMESA_EXECMEM" "-DVK_USE_PLATFORM_WIN32_KHR" "/wd4018" "/wd4056" "/wd4244" "/wd4267" "/wd4305" "/wd4351" "/wd4756" "/wd4800" "/wd4996" "/wd4291" "/wd4146" "/wd4200" "/wd4624" "/wd4309" "/wd4838" "/wd5105" "/we4020" "/we4024" "/Zc:__cplusplus" "-nologo" "-DWIN32" "-D_WINDOWS" "-W3" "-utf-8" "-MP" "-D_CRT_DECLARE_NONSTDC_NAMES" "-D_DEBUG" "-MDd" "-Z7" "-Ob0" "-Od" "-RTC1" "-D_GDI32_" "/Fdsrc\mesa\libmesa.a.p\meson-generated_.._program_lex.yy.c.pdb" /Fosrc/mesa/libmesa.a.p/meson-generated_.._program_lex.yy.c.obj "/c" src/mesa/program/lex.yy.c
FAILED: src/mesa/libmesa.a.p/meson-generated_.._program_lex.yy.c.obj 
"C:/Program Files/Microsoft Visual Studio/2022/Enterprise/VC/Tools/MSVC/14.32.31326/bin/Hostx64/x64/cl.exe" "-Isrc\mesa\libmesa.a.p" "-Isrc\mesa" "-I..\src\esa-22.0.2-5fd67a6f31.clean\src\mesa" "-Iinclude" "-I..\src\esa-22.0.2-5fd67a6f31.clean\include" "-Isrc" "-I..\src\esa-22.0.2-5fd67a6f31.clean\src" "-Isrc\mapi" "-I..\src\esa-22.0.2-5fd67a6f31.clean\src\mapi" "-I..\src\esa-22.0.2-5fd67a6f31.clean\src\gallium\include" "-Isrc\gallium\auxiliary" "-I..\src\esa-22.0.2-5fd67a6f31.clean\src\gallium\auxiliary" "-Isrc\mesa\main" "-I..\src\esa-22.0.2-5fd67a6f31.clean\src\mesa\main" "-Isrc\compiler\nir" "-I..\src\esa-22.0.2-5fd67a6f31.clean\src\compiler\nir" "-Isrc\util" "-I..\src\esa-22.0.2-5fd67a6f31.clean\src\util" "-Isrc\mesa\program" "-Isrc\mapi\glapi\gen" "-Isrc\compiler" "-ID:/installed/x64-windows/debug/../include" "-ID:/installed/x64-windows/include" "-DNDEBUG" "/MDd" "/nologo" "/showIncludes" "/utf-8" "/W2" "/std:c11" "/Od" "/Zi" "-D__STDC_CONSTANT_MACROS" "-D__STDC_FORMAT_MACROS" "-D__STDC_LIMIT_MACROS" "-DPACKAGE_VERSION=\"22.0.2\"" "-DPACKAGE_BUGREPORT=\"https://gitlab.freedesktop.org/mesa/mesa/-/issues\"" "-DHAVE_WINDOWS_PLATFORM" "-DUSE_ELF_TLS" "-DUSE_TLS_BEHIND_FUNCTIONS" "-DENABLE_ST_OMX_BELLAGIO=0" "-DENABLE_ST_OMX_TIZONIA=0" "-DEGL_NO_X11" "-D_WIN32_WINNT=0x0A00" "-DWINVER=0x0A00" "-DPIPE_SUBSYSTEM_WINDOWS_USER" "-D_USE_MATH_DEFINES" "-DVC_EXTRALEAN" "-D_CRT_SECURE_NO_WARNINGS" "-D_CRT_SECURE_NO_DEPRECATE" "-D_SCL_SECURE_NO_WARNINGS" "-D_SCL_SECURE_NO_DEPRECATE" "-D_ALLOW_KEYWORD_MACROS" "-D_HAS_EXCEPTIONS=0" "-DNOMINMAX" "-DMISSING_64BIT_ATOMICS" "-DHAS_SCHED_H" "-DHAVE_DLFCN_H" "-DHAVE_STRTOF" "-DHAVE_QSORT_S" "-DHAVE_DIRENT_D_TYPE" "-DHAVE_ZLIB" "-DHAVE_ZSTD" "-DHAVE_COMPRESSION" "-DLLVM_AVAILABLE" "-DMESA_LLVM_VERSION_STRING=\"14.0.4\"" "-DLLVM_IS_SHARED=0" "-DDRAW_LLVM_AVAILABLE" "-DMESA_EXECMEM" "-DVK_USE_PLATFORM_WIN32_KHR" "/wd4018" "/wd4056" "/wd4244" "/wd4267" "/wd4305" "/wd4351" "/wd4756" "/wd4800" "/wd4996" "/wd4291" "/wd4146" "/wd4200" "/wd4624" "/wd4309" "/wd4838" "/wd5105" "/we4020" "/we4024" "/Zc:__cplusplus" "-nologo" "-DWIN32" "-D_WINDOWS" "-W3" "-utf-8" "-MP" "-D_CRT_DECLARE_NONSTDC_NAMES" "-D_DEBUG" "-MDd" "-Z7" "-Ob0" "-Od" "-RTC1" "-D_GDI32_" "/Fdsrc\mesa\libmesa.a.p\meson-generated_.._program_lex.yy.c.pdb" /Fosrc/mesa/libmesa.a.p/meson-generated_.._program_lex.yy.c.obj "/c" src/mesa/program/lex.yy.c
cl : Command line warning D9025 : overriding '/W2' with '/W3'
cl : Command line warning D9025 : overriding '/Zi' with '/Z7'
src/compiler/glsl/glsl_lexer.cpp(2): warning C4117: macro name '__STDC_VERSION__' is reserved, '#define' ignored
../src/esa-22.0.2-5fd67a6f31.clean/src/compiler/glsl/glsl_lexer.ll(27): fatal error C1083: Cannot open include file: 'ast.h': No such file or directory

Is this related to your changes?

@omartijn
Copy link
Contributor Author

Is this related to your changes?

I'd be very surprised if it were, given that the changes are only enabled on macos. It's possible I made a mistake during one of the merges. I'll check this out later today.

@JackBoosY
Copy link
Contributor

@omartijn Any progress?

@omartijn
Copy link
Contributor Author

I've tried building the package on the master branch, and that also failed in the mesa:x64-windows package. So it seems the package is simply broken.

@JackBoosY
Copy link
Contributor

Can you please resolve the file conflicts so I can take a look?

Some ports (e.g. libpng) don't support building for multiple
architectures at the same time. For these ports, we can now use the
OSX_SPLIT_BUILD option, which will perform multiple builds (one for each
requested architecture) and then merge them into a universal binary when
the build is complete
Comment on lines +313 to +319
"${CMAKE_COMMAND}" "${arg_SOURCE_PATH}"
-D CMAKE_OSX_ARCHITECTURES=${OSX_ARCHITECTURE}
${arg_OPTIONS}
${arg_OPTIONS_RELEASE}
-G "${generator}"
"-DCMAKE_BUILD_TYPE=Release"
"-DCMAKE_INSTALL_PREFIX=${OSX_SPLIT_BUILD_INSTALL_DIR_RELEASE}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I prefer to use dbg_command and rel_command here, can you please make some changes for this?

"-DCMAKE_BUILD_TYPE=Release"
"-DCMAKE_INSTALL_PREFIX=${OSX_SPLIT_BUILD_INSTALL_DIR_RELEASE}"
WORKING_DIRECTORY "${build_dir_release}-${OSX_ARCHITECTURE}"
LOGNAME "${arg_LOGFILE_BASE}-rel-${OSX_ARCHITECTURE}"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We may also need to declare SAVE_LOG_FILES here.

Comment on lines +292 to +303
vcpkg_execute_required_process(
COMMAND
"${CMAKE_COMMAND}" "${arg_SOURCE_PATH}"
-D CMAKE_OSX_ARCHITECTURES=${OSX_ARCHITECTURE}
${arg_OPTIONS}
${arg_OPTIONS_DEBUG}
-G "${generator}"
"-DCMAKE_BUILD_TYPE=Debug"
"-DCMAKE_INSTALL_PREFIX=${OSX_SPLIT_BUILD_INSTALL_DIR_DEBUG}"
WORKING_DIRECTORY "${build_dir_debug}-${OSX_ARCHITECTURE}"
LOGNAME "${arg_LOGFILE_BASE}-dbg-${OSX_ARCHITECTURE}"
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same as above.

@omartijn
Copy link
Contributor Author

omartijn commented Aug 9, 2022

I've taken a look into using rel_command and dbg_command, and I cannot get it to work the way I expect. I have tried removing the CMAKE_INSTALL_PREFIX from both commands and then passing those as extra flags to vcpkg_execute_required_process (because those are different for regular vs split build)

Somehow, the option is then not correctly processed. I have spent about as much time as I am willing on this, but the constant code churn is taking too much of my time. So I'll leave this PR for anyone who's willing to maintain it.

@JackBoosY JackBoosY removed the requires:vcpkg-team-review This PR or issue requires someone on the vcpkg team to take a further look. label Aug 12, 2022
@JackBoosY
Copy link
Contributor

Convert this PR to draft since there is no progress for 10 days.

@JackBoosY JackBoosY marked this pull request as draft August 19, 2022 07:49
@JackBoosY
Copy link
Contributor

Closing this PR since it seems that no progress is being made. Please ping me to reopen if work is still being done.

@JackBoosY JackBoosY closed this Sep 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
category:port-bug The issue is with a library, which is something the port should already support category:tool-update The issue is with build tool or build script, which requires update or should be executed correctly
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants