GCC4.0 – relocation R_X86_64_PC32 against `memcpy@@GLIBC_2.2.5′ can not be used
There is a bug in GCC 4.0 (and 4.0.1 and 4.1) which breaks the Mozilla/Firefox/Thunderbird build on x86_64 and various other processors: GCC is treating the builtin functions such as “memset” and “memcpy” as having hidden visibility in certain circumstances that are hard to figure out. GCC bug 20297 covers the issue, though the patch in the bug doesn’t fix all the problems and I haven’t seen any action by the GCC maintainers to get the patch landed or fixed. I tried to provide a patch to detect this bug in Mozilla bug 307168, but apparently my configure test is not good enough to catch all instances of the bug.
In the meantime, if you experience the error “relocation R_X86_64_PC32 against `memcpy@@GLIBC_2.2.5′ can not be used” or something similar while building mozilla, use the following hackaround:
ac_cv_visibility_pragma=no path/to/mozilla/configure --enable-options-here
or put this in your mozconfig:
ac_cv_visibility_pragma=no (Don’t prefix this with ac_add_options!)
October 27th, 2005 at 2:52 pm
Thankssssssssss! Finally, I’ll be able to do coding on my laptop *^^*
November 5th, 2005 at 4:15 am
Error building Firefox on Linux amd64
I’ve been trying to build Firefox on Debian amd64 for a while and keep getting the same error, a compiler error containing ‘relocation R_X86_64_PC32 against `memcpy@@GLIBC_2.2.5’. Benjamin Smedberg wrote about a solution so I thought I’d at leas…
November 6th, 2005 at 8:22 pm
thunderbird-1.5rc1 compiles but unfortunately it won’t run. :-(
It always shows an “Thunderbird is already running, but is not responding…” dialog even after rebooting.
AMD64/Gentoo
November 7th, 2005 at 2:45 am
Yay, it worked for “firefox-1.5rc1”.
I am running a compiled 64-bit version right now.
Hopefully I can fix thunderbird.
November 10th, 2005 at 3:32 pm
I also have a “Thunderbird is already running, but is not responding…†message. did you get any resolution about this?
November 15th, 2005 at 2:20 pm
Thanks a lot, Ben — with your hints I was able to compile Thunderbird 1.5rc1 on my SuSE 10.0, x86_64 system!
Regarding the “not responding” issues: Have you guys tried removing the file .parentlock (or so) in your profile directory? It sometimes stays there when TB chrashes…
December 19th, 2005 at 8:21 pm
Thanks a lot for your tip! Thunderbird compile is running now!
January 2nd, 2006 at 3:25 pm
thanks for that tip, but the compilation of firefox 1.5 is still bombing for me. (It does proceed much further than before and I don’t see the ‘relocation R_X86_64_PC32 against `memcpy@@GLIBC_2.2.5′ error anymore).
Now there is this error:
nsAppShell.cpp: In member function ‘virtual nsresult nsAppShell::ListenToEventQueue(nsIEventQueue*, PRBool)’:
nsAppShell.cpp:230: error: cast from ‘void*’ to ‘gint’ loses precision
nsAppShell.cpp:237: error: cast from ‘void*’ to ‘gint’ loses precision
nsAppShell.cpp:242: error: cast from ‘void*’ to ‘guint’ loses precision
gmake[4]: *** [nsAppShell.o] Error 1
gmake[4]: Leaving directory `/usr/local/src/mozilla/widget/src/gtk2′
gmake[3]: *** [libs] Error 2
gmake[3]: Leaving directory `/usr/local/src/mozilla/widget/src’
gmake[2]: *** [libs] Error 2
gmake[2]: Leaving directory `/usr/local/src/mozilla/widget’
gmake[1]: *** [tier_9] Error 2
gmake[1]: Leaving directory `/usr/local/src/mozilla’
make: *** [default] Error 2
This is on the AMD64x2 cpu, using Mandriva compiled kernel 2.6.12-14mdksmp
and gcc-4.0.1 packages supplied by the same vendor. The mozconfig options were as follows (uncommenting the commented lines has had no effect)
ac_cv_visibility_pragma=no
mk_add_options_OBJDIR=@TOPSRCDIR@/firefox
ac_add_options –enable-application=browser
#ac_add_options –enable-optimize
ac_add_options –disable-debug
ac_add_options –enable-default-toolkit=gtk2
ac_add_options –enable-xft
#ac_add_options –enable-static
#ac_add_options –disable-shared
ac_add_options –enable-extensions=default
Somehow I get the feeling that I bought the best processor only to have the worst support from the opensource/freesoftware community.
January 12th, 2006 at 5:09 pm
oneir, the source is using the GPOINTER_TO_INT macro, which should handle the 64-bit pointer conversions (compilation works on my AMD64 machine FC4 with gcc4.02). http://lxr.mozilla.org/mozilla/source/widget/src/gtk2/nsAppShell.cpp#230
March 6th, 2006 at 3:01 pm
I had a similar problem the only fix I could find was to completely remove firefox and redo. I found instructions on how to clean out a firefox install here:
http://www.listerit.com/faqs/blog/firefox-faqs/fix-for-error-firefox-is-already-running-but-not-responding.html
March 14th, 2006 at 11:52 pm
Thanks for the Firefox fix and link to the lister.com website. I followed the link above and now firefox is working again.
March 28th, 2006 at 12:30 pm
[…] A while back, I posted a workaround that lets Mozilla compile and link properly, working around a bug that is present in GCC 4. I am happy to report that the GCC bug has been fixed on the GCC trunk, 4.1 branch, and 4.0 branch (it should appear in GCC4.0.4 and 4.1.1). I was very excited and immediately went off to build my own GCC and try to build XULRunner with it. No dice! Linking failed in toolkit/library with a similar error as before: […]
July 21st, 2006 at 7:59 am
[…] Recently I was trying to build firefox from source along with XULRunner so that I could try out JavaXPCOM. The first problem I ran into was a GCC 4 bug that breaks the build. Luckily someone out there had an easy fix for the problem (see GCC4.0 – relocation R_X86_64_PC32 against memcpy@@GLIBC_2.2.5 can not be used). After getting that problem fixed an a little fight with setting up XULRunner I got a very simple program working. That is when the 2nd problem showed up. When I tried to use some of the GUI functions I started getting core dumps from within GTK2. At that point I gave up and moved to my laptop. The same code worked right off using my laptop. […]
October 12th, 2006 at 6:31 am
Ben, this tip works like a charm :-) I finally managed to get over the ‘memset’ hurdle ;-). I use SUSE Linux x86_64 and had to remove the line “ac_add_options –enable-optimize” to get it running. (gcc version 4.0.3 20051024 (prerelease)) Thank you!
December 16th, 2006 at 6:53 am
PHP-5.2.0 source compile fails on AMD64 (ubuntu606) with MySQL-5.0.27 from source with this error:
/usr/bin/ld: /usr/local/mysql/lib/mysql/libmysqld.a(mf_qsort.o): relocation R_X86_64_PC32 against `memcpy@@GLIBC_2.2.5′ can not be used when making a shared object; recompile with -fPIC
These things always make me realize how much more I need to learn. Meanwhile I’m stuck with guessing with options to remove. MySQLI is my next guess.
March 10th, 2007 at 1:22 am
Hello and THANK YOU….
clfs, blfs pages need to link to your page… thanks again.
May 17th, 2007 at 9:03 am
Hello, and thanks a lot… I guess the people who left these messages above are the only people who compile mozilla products other than the mozilla developers… or others who compile them are much smarter (which I doubt).
Thanks again.