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

Glitches with --prefer-static -Dc_link_args="-static" -Dcpp_link_args="-static" when static library doesn't exist #10691

Open
pal1000 opened this issue Aug 14, 2022 · 1 comment

Comments

@pal1000
Copy link

pal1000 commented Aug 14, 2022

Case 1: library is required

To Reproduce

  • Open a MSYS2 MinGW32 or MINGW64 shell;
  • Update installation by running pacman -Syu then pacman -Su;
  • Install build dependencies: pacman -S bison flex git ${MINGW_PACKAGE_PREFIX}-{cc,meson,pkgconf,python-mako,vulkan-loader,zlib,zstd} --needed
  • Get code that reproduces the issue:
git clone --branch=22.1 https://gitlab.freedesktop.org/mesa/mesa.git mesa
cd mesa
  • Build config command: ${MINGW_PREFIX}/bin/meson setup build --buildtype=release -Db_ndebug=true -Dzstd=enabled --prefer-static -Dllvm=disabled -Dgallium-drivers=zink -Dvulkan-drivers= -Dshared-glapi=enabled -Dc_args="-march=core2 -pipe" -Dcpp_args="-march=core2 -pipe" -Dc_link_args="-static -s -ltre -lintl -liconv" -Dcpp_link_args="-static -s -ltre -lintl -liconv"
  • Build command: ${MINGW_PREFIX}/bin/ninja -C build

Expected behavior

Build should succeed with gallium megadriver linked with Vulkan shared library as there is no static library. This warning is displayed as it should though: WARNING: Static library 'vulkan' not found for dependency 'vulkan', may not be statically linked

Actual result

FAILED: src/gallium/targets/wgl/libgallium_wgl.dll
"c++" @src/gallium/targets/wgl/libgallium_wgl.dll.rsp
C:/Software/Development/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/12.1.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lvulkan: No such file or directory
collect2.exe: error: ld returned 1 exit status

System parameters

  • Is this a cross build or just a plain native build (for the same computer)?

Native

  • what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)

Windows 11

  • what Python version are you using e.g. 3.8.0

3.10.6

  • what meson --version

0.63.1

  • what ninja --version if it's a Ninja build

1.11.0

Another instance of this issue was analyzed here.

@pal1000
Copy link
Author

pal1000 commented Aug 15, 2022

Case 2: library is optional

To Reproduce

  • Open a MSYS2 MinGW32 or MINGW64 shell;
  • Update installation by running pacman -Syu then pacman -Su;
  • Install build dependencies: pacman -S bison flex git ${MINGW_PACKAGE_PREFIX}-{cc,clang,libclc,meson,pkgconf,python-mako,spirv-llvm-translator,spirv-tools,zstd} --needed
  • Get code that reproduces the issue:
git clone --branch=main https://gitlab.freedesktop.org/mesa/mesa.git mesa
cd mesa
  • Build config command: ${MINGW_PREFIX}/bin/meson setup build --buildtype=release -Db_ndebug=true -Dzstd=enabled --prefer-static -Dcpp_rtti=true -Dllvm=enabled -Dshared-llvm=disabled -Dgallium-drivers= -Dvulkan-drivers= -Dshared-glapi=auto -Dmicrosoft-clc=enabled -Dstatic-libclc=all -Dc_args="-march=core2 -pipe" -Dcpp_args="-march=core2 -pipe" -Dc_link_args="-static -s -ltre -lintl -liconv" -Dcpp_link_args="-static -s -ltre -lintl -liconv"
  • Build command: ${MINGW_PREFIX}/bin/ninja -C build

Expected behavior

There should be a warning during config about clang-cpp being a shared library only just like with 1st case but it's not.

Actual result

Microsoft CLC built like this always crashes. I wonder if clang-cpp actually gets linked in or clang doesn't get linked in at all. The latter justifies the crashes.

System parameters

  • Is this a cross build or just a plain native build (for the same computer)?

Native

  • what operating system (e.g. MacOS Catalina, Windows 10, CentOS 8.0, Ubuntu 18.04, etc.)

Windows 11

  • what Python version are you using e.g. 3.8.0

3.10.6

  • what meson --version

0.63.1

  • what ninja --version if it's a Ninja build

1.11.0

This issue was first mentioned here.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant