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

Release LLVM 17 #26076

Merged
merged 4 commits into from
Jun 24, 2024
Merged

Release LLVM 17 #26076

merged 4 commits into from
Jun 24, 2024

Conversation

alan-j-hu
Copy link
Contributor

Note that conf-llvm's configure.sh script should be unchanged from LLVM 16.

@mseri
Copy link
Member

mseri commented Jun 13, 2024

Is the macos failure expected? I think I remember a discussion about this in the past but cannot remember the conclusion

File "src/llvm/static/dune", line 2, characters 0-559:
#  2 | (library
#  3 |  (name llvm_static)
#  4 |  (public_name llvm.static)
#  5 |  (implements llvm)
#  6 |  (foreign_stubs
#  7 |   (language c)
#  8 |   (names llvm_ocaml)
#  9 |   (extra_deps llvm_ocaml.h)
# 10 |   (flags (-I/opt/homebrew/Cellar/llvm@17/17.0.6/include  -D__STDC_CONSTANT_MACROS -D__STDC_FORMAT_MACROS -D__STDC_LIMIT_MACROS)))
# 11 |  (c_library_flags (-L/opt/homebrew/Cellar/llvm@17/17.0.6/lib -Wl,-search_paths_first -Wl,-headerpad_max_install_names -lstdc++ -lLLVMCore -lLLVMRemarks -lLLVMBitstreamReader -lLLVMBinaryFormat -lLLVMTargetParser -lLLVMSupport -lLLVMDemangle
# 12 | -lm -lz -lzstd -lcurses -lxml2)))
# (cd _build/default && /Users/mac1000/.opam/4.14.2/bin/ocamlmklib.opt -g -o src/llvm/static/llvm_static_stubs src/llvm/static/llvm_ocaml.o -ldopt -L/opt/homebrew/Cellar/llvm@17/17.0.6/lib -ldopt -Wl,-search_paths_first -ldopt -Wl,-headerpad_max_install_names -ldopt -lstdc++ -ldopt -lLLVMCore -ldopt -lLLVMRemarks -ldopt -lLLVMBitstreamReader -ldopt -lLLVMBinaryFormat -ldopt -lLLVMTargetParser -ldopt -lLLVMSupport -ldopt -lLLVMDemangle -ldopt -lm -ldopt -lz -ldopt -lzstd -ldopt -lcurses -ldopt -lxml2)
# ld: library 'zstd' not found
# clang: error: linker command failed with exit code 1 (use -v to see invocation)

@alan-j-hu
Copy link
Contributor Author

alan-j-hu commented Jun 13, 2024

I opened a PR at #25002 some months ago. However, it's an annoying breaking Homebrew change due to Mac's switch from Intel to ARM. Homebrew installed Intel binaries in the standard location, /usr/local, so it installs ARM binaries in a non-standard location, /opt/homebrew. Furthermore, due to security issues, Mac doesn't let you change the default library search path with LD_LIBRARY_PATH due to "System Integrity Protection" (SIP), so the libraries installed by Homebrew for ARM can't be made to be found. The OCaml LLVM package is not the only breakage by the Homebrew change. For example, I saw error messages on the Internet from people trying to use zstd (the LLVM dependency involved) purely from C on the new Macs. The Homebrew change breaks many things, because naturally tools search for libraries under standard paths, not arbitrary non-standard paths like /opt/homebrew.

The llvm-config tool does not use .pc files to search up the paths for library flags. The -lzstd flag is hardcoded in the tool. The workaround involves a new dependency on pkg-config to look up the paths via the .pc file.

This isn't the "fault" of my package, circumstances came together and Mac and Homebrew made some breaking changes with no solutions for downstream users. I'm unhappy with the "workaround," which adds a new tool dependency. I would rather Homebrew go and fix their project.

The PR was not handled because "this is a tricky package, and I suppose none of the maintainers have time to understand the various issues at play." I have no idea why it was marked as "reporter action needed" three weeks ago.

Homebrew/brew#9177

alan-j-hu/llvm-dune#18

@alan-j-hu
Copy link
Contributor Author

I've marked this as unavailable for ARM Macs with Homebrew. I may publish a separate version, with the workaround with an additional dependency on pkg-config, for Homebrew on the ARM Macs separately.

@mseri
Copy link
Member

mseri commented Jun 14, 2024

I opened a PR at #25002 some months ago. However, it's an annoying breaking Homebrew change due to Mac's switch from Intel to ARM. Homebrew installed Intel binaries in the standard location, /usr/local, so it installs ARM binaries in a non-standard location, /opt/homebrew. Furthermore, due to security issues, Mac doesn't let you change the default library search path with LD_LIBRARY_PATH due to "System Integrity Protection" (SIP), so the libraries installed by Homebrew for ARM can't be made to be found. The OCaml LLVM package is not the only breakage by the Homebrew change. For example, I saw error messages on the Internet from people trying to use zstd (the LLVM dependency involved) purely from C on the new Macs. The Homebrew change breaks many things, because naturally tools search for libraries under standard paths, not arbitrary non-standard paths like /opt/homebrew.

At that is my fault sorry, I need to find some time to review it properly and understand what is going on

@mseri
Copy link
Member

mseri commented Jun 14, 2024

I've marked this as unavailable for ARM Macs with Homebrew. I may publish a separate version, with the workaround with an additional dependency on pkg-config, for Homebrew on the ARM Macs separately.

Sounds good

@avsm avsm merged commit 14494e7 into ocaml:master Jun 24, 2024
0 of 2 checks passed
@avsm
Copy link
Member

avsm commented Jun 24, 2024

Thanks! You may want to announce this on https://discuss.ocaml.org, where we have a Community category and an announce tag for this purpose.

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

Successfully merging this pull request may close these issues.

3 participants