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

brew install zig installs broken zig: Unable to find target for this triple (no targets are registered) #53198

Closed
3 of 4 tasks
timotheecour opened this issue Apr 15, 2020 · 6 comments
Labels
outdated PR was locked due to age

Comments

@timotheecour
Copy link
Contributor

Please note we will close your issue without comment if you delete, do not read or do not fill out the issue checklist below and provide ALL the requested information. If you repeatedly fail to use the issue template, we will block you from ever submitting issues to Homebrew again.

  • ran brew update and can still reproduce the problem?
  • ran brew doctor, fixed all issues and can still reproduce the problem?
    only irrelevant unrelated issues
  • ran brew gist-logs <formula> (where <formula> is the name of the formula that failed) and included the output link?
  • if brew gist-logs didn't work: ran brew config and brew doctor and included their output with your issue?
    NA

What you were trying to do (and why)

brew install zig
(tried both brew install zig and brew install --build-from-source zig (after brew uninstall zig))
this works, see gist: https://gist.github.com/timotheecour/f7dc4baa86f256695307731e35177dde

then use it:
zig build-exe --c-source thelloc.c --library c

What happened (include command output)

Unable to find target for this triple (no targets are registered)

What you expected to happen

works, just like it does when I download and unzip https://github.com/ziglang/zig/releases/download/0.6.0/zig-macos-x86_64-0.6.0.tar.xz and use export PATH=/Users/timothee/Downloads/zig-macos-x86_64-0.6.0/:$PATH

Step-by-step reproduction instructions (by running brew install commands)

see above

links

root cause of ziglang/zig#5055

@SMillerDev
Copy link
Member

It seems the upstream install instructions create a broken install as you figured out. Can you cross-post of there's new instructions there?

@timotheecour
Copy link
Contributor Author

yes, please keep this open though to make life easy towards a fix

@andrewrk
Copy link

Here's how homebrew can fix this immediately:

  • Stop passing -DZIG_PREFER_CLANG_CPP_DYLIB=ON
  • Add this patch:
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -384,6 +384,9 @@ target_link_libraries(zig_cpp LINK_PUBLIC
     ${CLANG_LIBRARIES}
     ${LLD_LIBRARIES}
     ${LLVM_LIBRARIES}
+    "-Wl,/usr/local/opt/llvm/lib/libPolly.a"
+    "-Wl,/usr/local/opt/llvm/lib/libPollyPPCG.a"
+    "-Wl,/usr/local/opt/llvm/lib/libPollyISL.a"
 )
 
 add_library(opt_c_util STATIC ${OPTIMIZED_C_SOURCES})

This will solve the problem until LLVM 10.0.1 is released with a fix to https://bugs.llvm.org/show_bug.cgi?id=44870.

@timotheecour
Copy link
Contributor Author

ziglang/zig#5092 would avoid having to patch

@Bo98
Copy link
Member

Bo98 commented Apr 18, 2020

I'll look at the situation tomorrow - it's quite late here. From first glance, I'm happy with either way.

Bo98 added a commit to Bo98/homebrew-core that referenced this issue Apr 19, 2020
@Bo98
Copy link
Member

Bo98 commented Apr 19, 2020

Looks like Zig has many other linkage issues depending on the build environment where LLVM is built. I explicitly disabled z3 support here: e3753ac. It wasn't activated in the bottles we built, but it may have been for those who build from source and had z3 installed already. There is likely more. As such, I can only realistically provide support for Zig when LLVM and/or Zig is installed from a bottle.

The short-term patch for Polly is now applied to the Zig formula. Please run brew upgrade zig.

@lock lock bot added the outdated PR was locked due to age label May 20, 2020
@lock lock bot locked as resolved and limited conversation to collaborators May 20, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
outdated PR was locked due to age
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants