-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
homebrew and llvm 10 packages in apt.llvm.org are broken with undefined reference to getPollyPluginInfo #4799
Comments
It's a problem with apt.llvm.org. They're aware and will hopefully fix it soon. In the meantime, you'll have to use the same workaround that the CI uses, or build llvm+clang+lld 10 from source. |
I am having the same issue with an attempt to combine this LLVM 10 (release) PR in Nixpkgs NixOS/nixpkgs#83350 and the following change to diff --git a/pkgs/development/compilers/zig/default.nix b/pkgs/development/compilers/zig/default.nix
index 961e28da82e..ab43c862227 100644
--- a/pkgs/development/compilers/zig/default.nix
+++ b/pkgs/development/compilers/zig/default.nix
@@ -1,18 +1,18 @@
{ stdenv, fetchFromGitHub, cmake, llvmPackages, libxml2, zlib }:
stdenv.mkDerivation rec {
- version = "0.5.0";
+ version = "0d43543";
pname = "zig";
src = fetchFromGitHub {
owner = "ziglang";
repo = pname;
rev = version;
- sha256 = "0xyl0riakh6kwb3yvxihb451kqs4ai4q0aygqygnlb2rlr1dn1zb";
+ sha256 = "144igsf104dlwf8rvxg0dk6brlv73ywhq35r5nnljra81h52wzf9";
};
nativeBuildInputs = [ cmake ];
- buildInputs = [ llvmPackages.clang-unwrapped llvmPackages.llvm libxml2 zlib ];
+ buildInputs = [ llvmPackages.clang-unwrapped llvmPackages.llvm llvmPackages.lld libxml2 zlib ];
preBuild = ''
export HOME=$TMPDIR;
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 30bc0af360e..f0ab0586955 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -15147,7 +15147,7 @@ in
zmqpp = callPackage ../development/libraries/zmqpp { };
zig = callPackage ../development/compilers/zig {
- llvmPackages = llvmPackages_9;
+ llvmPackages = llvmPackages_10;
};
zimlib = callPackage ../development/libraries/zimlib { }; |
I was able to devise a quick-and-dirty workaround to make it possible to build master with Nixpkgs (with NixOS/nixpkgs#83350 merged) diff --git a/pkgs/development/compilers/zig/default.nix b/pkgs/development/compilers/zig/default.nix
index 961e28da82e..ed521a0e70a 100644
--- a/pkgs/development/compilers/zig/default.nix
+++ b/pkgs/development/compilers/zig/default.nix
@@ -1,18 +1,25 @@
{ stdenv, fetchFromGitHub, cmake, llvmPackages, libxml2, zlib }:
stdenv.mkDerivation rec {
- version = "0.5.0";
+ version = "547ba8eb203fa84d207eb38d8d64c0f7f3162101";
pname = "zig";
src = fetchFromGitHub {
owner = "ziglang";
repo = pname;
rev = version;
- sha256 = "0xyl0riakh6kwb3yvxihb451kqs4ai4q0aygqygnlb2rlr1dn1zb";
+ sha256 = "1qvaky2h4j0bss7qjcwiz7q3jhrwlhbjyjgg91zjp9rz5sx2a24k";
};
nativeBuildInputs = [ cmake ];
- buildInputs = [ llvmPackages.clang-unwrapped llvmPackages.llvm libxml2 zlib ];
+ buildInputs = [ llvmPackages.clang-unwrapped llvmPackages.llvm llvmPackages.lld libxml2 zlib ];
+
+ patches = [ ./llvm10_poly.patch ] ;
+
+ postPatch = ''
+ export llvm_extras=-Wl,${llvmPackages.llvm}/lib/LLVMPolly.so
+ substituteAllInPlace CMakeLists.txt
+ '';
preBuild = ''
export HOME=$TMPDIR;
diff --git a/pkgs/development/compilers/zig/llvm10_poly.patch b/pkgs/development/compilers/zig/llvm10_poly.patch
new file mode 100644
index 00000000000..873c825dfbc
--- /dev/null
+++ b/pkgs/development/compilers/zig/llvm10_poly.patch
@@ -0,0 +1,10 @@
+diff --git a/CMakeLists.txt b/CMakeLists.txt
+index 97608cddf..e451c0711 100644
+--- a/CMakeLists.txt
++++ b/CMakeLists.txt
+@@ -369,6 +369,7 @@ target_link_libraries(zig_cpp LINK_PUBLIC
+ ${CLANG_LIBRARIES}
+ ${LLD_LIBRARIES}
+ ${LLVM_LIBRARIES}
++ @llvm_extras@
+ )
diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix
index 30bc0af360e..f0ab0586955 100644
--- a/pkgs/top-level/all-packages.nix
+++ b/pkgs/top-level/all-packages.nix
@@ -15147,7 +15147,7 @@ in
zmqpp = callPackage ../development/libraries/zmqpp { };
zig = callPackage ../development/compilers/zig {
- llvmPackages = llvmPackages_9;
+ llvmPackages = llvmPackages_10;
};
zimlib = callPackage ../development/libraries/zimlib { }; |
I run into the same problem installing
|
Homebrew fix: Homebrew/homebrew-core#52352 |
LLVM 10 release is in Nixpkgs now NixOS/nixpkgs#83350 |
:/ That homebrew fix didn't work (see the issue), and adding
EDIT Linking to all the static versions of the library worked. In CMakeLists.txt: 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"
) |
@josephg |
I've been asked a few times about this over at Homebrew from people coming over from here. Just to make everyone aware, this is a comment I made on the matter before: Homebrew/homebrew-core#52352 (comment) (after the bullet points). I've looked at the issue more since then, so let me clarify a few things:
To answer some questions I've been asked: Why does Polly not automatically get linked when you link clangCodeGen?Because clangCodeGen is a static library. This is an inherent attribute of static libraries. Why does zig not detect to link Polly itself?Because zig provides a manual list of what to link when it comes to Clang: Lines 37 to 58 in a20f3e3
How do you detect whether Polly should be linked?Let CMake handle the linking work for you and use Clang's provided CMake modules. They can be found in It handles what should be linked. For example,
There is a A similar system for LLVM libraries also exists. Is there another way?Use the There's a big move in some of the community to stop using Clang static libraries and start using What about
|
Thanks for the clarification @Bo98. It's a bit of a problem that LLVM forces downstream projects to use cmake in order to properly link against it, but that's not Homebrew's fault. I'm looking into this and will attempt to make zig's cmake configuration compatible with Homebrew, and stop sending people your way. Thanks again for stopping by. |
Yeah, it caught out Mesa too I heard. They don't use CMake, so they had to go with the |
I've opened #4992 to solve this. Now it's just the O(N) task of testing it on all the various systems and putting in workarounds to fix the breakage. |
@Bo98 I tried taking your advice and going full cmake-based configuration. That work is in #4992. It successfully built against the Homebrew package. However, the apt.llvm.org packaging problem persists (and is reproduced by an LLVM dev), and there are other show-stopping problems with cmake-based config. So I've made the much less invasive change: #4993 I'm not aware of any other patches or issues downstream, but please let me know and I would be happy to work with you on getting that patch count (and other unwanted workarounds) down to zero. |
Does this mean that we will have to wait for llvm to fix it in their next major release? Also, having read the relevant threads, will it still be possible to get a working build if I build clang+lld from source? I've been stuck at the last working revision ( |
As for the apt.llvm.org packages, I just got an update of |
to work around #4799 until a newer llvm version is released.
to work around ziglang#4799 until a newer llvm version is released.
Thank's @andrewrk , cmake -DZIG_WORKAROUND_POLLY_SO:STRING=/usr/lib/llvm-10/lib/LLVMPolly.so .. |
EDIT: Never mind, it works using the macOS-specific workaround flag.
|
Works for me with LLVM 10.0.1 on MacOS |
I'm getting a new and different error on the new (
|
That is probably from llvm-config, which hasn’t worked properly on macOS since LLVM 3.9. I’m unaware of any intention to fix it.
The same happens when building from source outside of Homebrew. I know some people noticed it in rc1, which Homebrew never shipped.
… On 17 Aug 2020, at 14:44, Bodie ***@***.***> wrote:
I'm getting a new and different error on the new homebrew release of LLVM :D
ld: library not found for -llibxml2.tbd
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub <#4799 (comment)>, or unsubscribe <https://github.com/notifications/unsubscribe-auth/AAJCWYXNWPGHXDMQSTQ373TSBEX3RANCNFSM4LS5OAHA>.
|
I can confirm that this is indeed the problem with
|
😢 |
A temporary (and super hacky hack hack that makes me cringe) solution to the problem of
is to:
This should get everyone with LLVM |
I think we can mark this particular issue as resolved (to do with
which also seems an upstream issue... EDIT: I've now created an issue for this #6087. |
LLVM 11 was released today and I just merged the llvm11 branch into master. |
Just a heads up that at the time of writing, homebrew still doesn't feature LLVM updated to version 11, so anyone developing on a macOS might either wait a little, or install LLVM from source. |
Or use the bootstrap repository. |
Just an FYI that I'm working hard on updating LLVM to 11 in homebrew in Homebrew/homebrew-core#62798 |
Note for future readers: this one got merged, so |
Building with the shiny new llvm10 fails:
I have installed llvm10 from the official apt repository:
Might this be a problem with my installation?
The text was updated successfully, but these errors were encountered: