-
Notifications
You must be signed in to change notification settings - Fork 423
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
PowerPC: i2pd fails with Bus error if built using GCC atomics #1726
Comments
Do you know any defines, which compilator adds when building with OSX SDK? I've tested build with Homebrew and never seen such error here. |
Which compiler has you used? If it is some version of P. S. I will update soon on what happens on 10.5.8 and 10.6 PPC. Currently running some other stuff, need to wait until it builds. |
Homebrew using same gcc, but I don't know which version now. I'll try to run my VM with it (I don't have any real Mac here ;D) and try to check |
Try latest commit. |
@r4sas I tried to build on 10.5.8 now with gcc11, and it still fails on:
gcc11:
I will with other compiler, but gcc11 should have been fine, it's the latest one. |
@r4sas Ok, so it fails with stock So I cloned current
Same failure:
|
That's why I'm asking you about determining in code that we use MacPorts GCC with custom pthreads which not supports Maybe check header file |
@barracuda156 can you test by changing check here: Line 126 in 90130b5
to #if defined(__APPLE__) && defined(CONFIG_PTHREAD_SETNAME_NP_W_TID) ?
|
Please excuse me, I didn’t know how to check that specifically. But I tried with non-Macports compilers initially ( |
@r4sas I have tried building with
Unfortunately, no change:
|
Can you find pthread.h header and send it here? |
Currently trying to test with add: failing to link binary... idk why, but boost can't find some symbols. add2: that's why I hate cmake: add3: I'm able to build binary only with clang. |
@r4sas Cmake is a disaster, I agree. Do you have an idea how we can fix it to build with some version of gcc? Clang is broken for ppc. P. S. I just got Boost 1.78 built. Though it probably won't solve the problem.
P. P. S. If it does not build due to compiler bug, I can open Bugzilla ticket for gcc. |
Yes, sure. |
Hm. 10.6 header has option, using same type as we used (const char*), but why compiler tells that "char*" is needed - idk. Maybe wrong header? Difference with 10.5.8 only in 2 lines, where pthread_setname_np is not exists. Let's do it other way, just remove calling for |
Signed-off-by: R4SAS <[email protected]>
@r4sas Thank you! Now files are built with a single warning:
However linking stage fails:
|
@r4sas Above was on 10.6 PPC (10A190). On a stock 10.5.8 however the build fails as before with:
In either case gcc11 was used and Boost 1.76. |
I found how to get all predefined macros: https://stackoverflow.com/a/10905013. |
That's not problem, because code generated only when required
Same for me with gcc. I really don't know why, but looks like libraries built by clang in latest versions, because only with it I built i2pd succesfully. |
@r4sas Interesting. Firstly, this seems to be a rather unique case when building something has more success on 10.6 PPC (which is a developer build lacking many features of 10.6 release and therefore it may be tricky to build stuff for it) than on a vanilla 10.5.8 which has been tested and polished. Unless I am doing something wrong. Secondly, unclear why the latest gcc11 fails here. Do you think it is a compiler fault or what? |
No, there is no linking problem, there is library itself diffirence, because you trying to link clang built libraries with applicaton built by gcc and using gcc linker. |
I have no libraries built with Clang. Everything that is not a part of OS itself is built with gcc. |
Are they built with gcc?
That prefix used by macports as I know. |
@herbygillot, can you say to us, is libraries provided by macports are built with clang? |
|
@r4sas So yes, It does't show in
But trust me, it's the case. Anyone on Macports can confirm that. I don't even have
|
Hm... In that case I can't say anything. Can you try rebuild boost locally? |
@pdimov So yeah, we have a broken Boost on PPC. Every binary compiled fails with Bus error and
It appears that something is fundamentally broken (not with one module). A fibonacci test for Where to look? We definitely want this fixed. |
@pdimov Out of those tests 1 passes (
Implementation used looks correct:
|
It's pretty odd that spinlock_mt_test succeeds, while the simple single threaded tests such as spinlock_test do not. spinlock_test is a very simple program that just locks and unlocks two spinlocks. You should be able to disassemble it and see at which address it causes the bus error. At the moment I'd think that the You can define BOOST_SP_USE_STD_ATOMIC to force smart_ptr to use |
@pdimov Oh wow, this indeed seems to be the case. I managed to get a more meaningful GDB output, here the test was compiled with:
GDB:
Then I recompile the test with a definition you recommended to try:
And all is good:
Maybe @iains could shed some light on |
Odd, because libstdc++'s |
Also you should try std::atomic_load instead boost::atomic_load. I remember I had to use boost's because it was not supported by older g++. |
|
Try it on PPC if it crashes |
@pdimov @orignal I recompiled
(Nothing is set up yet, so it does not connect, but it runs, no Bus error anymore.) |
Then add it to Makefile.osx |
@orignal Existing P. S. I was using Cmake myself to build + a portfile (I wanna bring |
Create Makefile.ppc then. |
Why name it .ppc? Its not a PPC arch issue (bsd/linux are fine). It only applies to osx and the backported toolchains for it. |
@orignal Well, either someone modified it since that time or you have fixed Clang for Darwin PPC :) @yhaenggi Yes, of course makefiles are to be OS-based and then arch-specific if necessary. I am well aware that Darwin, AIX and BeOS need different implementation for PPC :) |
I used g++ initially, built it manually using old Xcode. |
@barracuda156 so, are you currently using cmake or make for MacPorts? |
@r4sas Cmake. We can use only one build system in Macports for a given port, and since we have established for sure that it was not Cmake causing a problem, I will stick with it. If you and others wish, we can also include the portfile with |
In that case adding of |
Fair enough, it is preferable to add that into CMakeLists rather than having a custom fix in Macports (it is easily done via portfile, but then it is limited to Macports). |
Thanks, this will help. |
Can you please test whether this change: fixes the issue? |
@pdimov A quick check suggests that it does. I have modified the header in Boost 1.76, while leaving 1.79 as it was:
No error with modified header. |
Good! Will you be trying the real thing with the patch? |
@pdimov Sure, will try rebuilding now. (But we rather wait for GCC devs reply too before making any changes to the code.) UPD. Rebuilt |
Signed-off-by: R4SAS <[email protected]>
I have tried building
i2pd
forppc
on 10.6.8 withgcc11
, and it failed on this:I used this line to configure:
cmake -DCMAKE_C_COMPILER=/opt/svacchanda/gcc11ppc/bin/gcc -DCMAKE_CXX_COMPILER=/opt/svacchanda/gcc11ppc/bin/g++ -DLLVM_DEFAULT_TARGET_TRIPLE=powerpc-apple-darwin10 -DBoost_INCLUDE_DIR=/opt/local/libexec/boost/1.76/include
The text was updated successfully, but these errors were encountered: