-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Build on PPC64LE with installed sysroot 2.28 fails #20335
Comments
Update: Patching signal.h to comment out
There seems to be an collision with the definitions of the registers The CMake cross-compilation failed due to a silly mistake, the zig-wasm2 used in However, even though the emulation works the compilation sets the HOST_TARGET to linux-x64 |
Progressing on the cross-build till:
I had to patch the zig2.c with args being in the clobber list Somehow the compiler_rt.c has zig_f64 defined as a double instead of a long double and have several read 16bit from 8bits in memcpy() |
The following instruction in building zig2: |
This is solved with |
This is the PR trying to cross-cmake x86_64 -> ppc64le: https://dev.azure.com/conda-forge/feedstock-builds/_build/results?buildId=965648&view=logs&j=8c139a40-380b-5518-bf6b-edcb18cbf319&t=e71f8d0d-13be-528e-b5e7-bfc20e0db699&l=1001 It fails to make |
Does it fail? From the log it looks like it timed out at |
It does. The relocation errors is quite large so it is redirected to a file (not sure why it did not fail on the runner, it fails locally)
I don't understand the relocation errors (currently stuck there):
|
Perhaps a question that can be answered by an LLD developer. Does LLD perhaps lack implementation of some relocations for ppc64le? Or perhaps clang++ is emitting some strange relocations for that target, for some reason. This target builds fine statically with zig-bootstrap, so maybe LLD is lacking a feature related to dynamic linking, or clang++ is lacking a feature related to dynamic linking. |
So with zig-bootstrap (the 0.13.0 zig linux-x64 cross-targeting ppc64le):
|
The 31 and 60 relocs are valid, but they seem to not be implemented in LLD https://refspecs.linuxfoundation.org/ELF/ppc64/PPC-elf64abi.html#RELOC https://github.com/llvm/llvm-project/blob/main/lld/ELF/Relocations.h#L102-L106 |
The target |
Mold does implement these relocs, maybe you could workaround by using it? |
Zig does not integrate with mold since the plan is to provide our own linking functionality for this use case. |
Very cool, I kept banging my head on a brick wall it seems. I don't follow very well, but are we saying that I can only create a statically built zig for ppc64le? |
Yes, that is the current state of affairs, until Zig's linker surpasses LLD's functionality and adds these relocations. |
Cool, I will try. Based upon your previous comment, I should focus on a CMake build, right. I do not have ppc64le, so I used a patched CMakeLists.txt with an emulator, do you see any issues with that as opposed to a native cmake build on Travis runner? They are quite a pain to use while debugging the recipe I will open a different issue with the Windows build that is also not working at my end (suspecting something I don't understand again!) |
For ppc64le specifically, I think your best bet is using https://github.com/ziglang/zig-bootstrap to cross-compile.
Be sure to read the README and use additional environment variables to utilize the logical cores of the host. This build process will take a long time because it will
However, it is definitely working, because it is how the CI builds are produced. |
Right, we would prefer to use the tools already available for host and target within the conda environment. |
When working on the
I don't understand, I provide the sysroot and the libc file, and the target (I tried adding the |
you passed |
I recently gained access to the GCC compiler farm and I wanted test compatibility on a Power10 machine. Unfortunately I encountered many build errors that have limited me to using the 0.13 release via First, I tried building LLVM+Clang+LLD+Zig from source. The llvm portion went fine, but like @MementoRC mentioned at the top I kept running into conflicting type errors - more than sigaction. BTW, I also experienced the same conflicts on a Loongarch64 server which shows that it isnt ppc being special. I then tried using zig-bootstrap, but ran into the same errors. Since I couldn't edit the system headers, I tried using the latest master build. Running
Then I spent a lot of time doing bootstrap builds on an x86_64 server, but got to the same results:
So, to build anything I have to run |
Chatting with @alexrp led me to the same conclusion re: signals, but instead of patching out diff --git a/stage1/zig.h b/stage1/zig.h
index 05529feec7..38f01ca020 100644
--- a/stage1/zig.h
+++ b/stage1/zig.h
@@ -271,6 +271,8 @@ typedef char bool;
#define zig_breakpoint() __asm__ volatile("bkpt #0");
#elif defined(__aarch64__)
#define zig_breakpoint() __asm__ volatile("brk #0");
+#elif defined(__powerpc__)
+#define zig_breakpoint() __asm__ volatile("twge r2,r2");
#else
#include <signal.h>
#if defined(SIGTRAP) With this, I get the same asm clobber errors mentioned above:
@MementoRC can you share the changes you made to the clobber lists? I have no idea how inline asm works. |
Sure, you can find the patches under: https://github.com/conda-forge/zig-feedstock/pull/30/files#diff-6c2d6aaa2d4b5f7aafb076ae683ca83a14d62b89abc619d56b3f586e60335c79 The last issue I encountered was with the relocation that are not supported by LLVM, but I need to build dynamically for the conda-forge recipe, this may not be an issue for a static build |
Just leaving a link to my comment over here: conda-forge/zig-feedstock#44 (comment) TL;DR: LLD doesn't support some relocations that GCC/binutils use in practice. Self-hosted linker will hopefully solve this. |
Zig Version
0.13.0
Steps to Reproduce and Observed Behavior
cmake build
fails with:[17/19] Building C object CMakeFiles/zig2.dir/zig2.c.o
This is under a conda environment that installs sysroot for GLIBC 2.28 (which seems needed for zig). Is there a way to patch the source so that the built zig2.c complies with the
/powerpc64le-conda-linux-gnu/sysroot/usr/include/signal.h
?Or an alternative method to build zig for ppc64le?
Using the distributed binary fails on the Travis runner without any error (objdump -h works but nm fails)
Cross-compiling with CMake fails because
qemu-ppc64le-static
fails similarly when trying to execute/usr/bin/qemu-ppc64le-static -s 32097152 -d guest_errors -p 65536 zig-wasm2c
Cross-compiling with x86_64 binary distro also fails (I'd need to dig the loogs). But basically, I seem unable to build zig for PPC64LE
This is part of an effort to bring zig to the conda framework. Currently, x86_64, aarch64 and osx-64 builds with the recipe
Thank you
Expected Behavior
completes the CMake build and generates a functional zig (the recipe tests the behavior.zig in an isolated and emulated environment
The text was updated successfully, but these errors were encountered: