Closed Earnestly closed 7 years ago
Thank you! we'll have a look.
Is there anything blocking a fix?
nothing, sorry for the delay! Just that we can't seem to reproduce out-of-the-box (tried on a relatively recent Ubuntu and a recently recent RedHat). What's your platform, just for the record?
Most of the details were listed in the bug report. Currently I'm using Arch Linux as a base which is essentially vanilla. If you want to see the build flags for gcc I can provide those.
One unique thing Arch does perhaps is that we remove most static libraries which aren't necessary which means gtkada is linking against shared objects which must be fPIC on x86 as I understand it.
@Earnestly, could you please try the following patch instead, which uses the PIC_Option attribute? (Sorry, I couldn't make the time to install Arch Linux and do the test myself).
diff --git a/shared.gpr.in b/shared.gpr.in
index ba14efe..326ae11 100644
--- a/shared.gpr.in
+++ b/shared.gpr.in
@@ -54,6 +54,7 @@ project Shared is
for Driver ("Objective-C") use "@OBJC@";
for Leading_Required_Switches ("Objective-C") use ("-c");
for PIC_Option ("Objective-C") use ("-fPIC");
+ for PIC_Option ("C") use ("-fPIC");
case Build is
when "Debug" =>
Great, I can confirm your patch does work.
Don't worry about installing Arch Linux; so long as you use relatively up to date software which has minimal tampering from upstream defaults, it should be fine. Shared libraries on x86_64 absolutely need PIC, gcc will even force it. http://unix.derkeiler.com/Newsgroups/comp.unix.programmer/2007-07/msg00513.html
Thank you!
Reopened on second consideration, I jumped the gun a bit since while the patch works, it's still only a patch
and done :)
I have this problem, but neither of the patches work. I am on:
After a kernel update to 5.8.0 it seems the issue is back:
If I run:
./configure ./configure --with-GL=no
make
I get stuck with the error aforementioned.
/usr/lib64/gcc/x86_64-suse-linux/10/../../../../x86_64-suse-linux/bin/ld: /home/xyz/git/BEL/ada_training/gtkada/gtkada-gtkada-17.0/src/obj/gtkada/relocatable/misc.o: relocation R_X86_64_32 against
.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
collect2: error: ld returned 1 exit status
gprlib: /usr/bin/gcc execution error
gprbuild: could not build library for project gtkada
make: *** [Makefile:84: build_library_type/relocatable] Error 4`
The system is:
How to proceed ? Thanks.
Operating System: Kubuntu 20.04 KDE Plasma Version: 5.18.8 KDE Frameworks Version: 5.68.0 Qt Version: 5.12.8 Kernel Version: 5.4.0-131-generic OS Type: 64-bit gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)
I have an error with gtkada-2021-x86_64-linux-bin : relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE
Enter the name of the directory in which you would like to install GtkAda
[/opt/gtkada]
Are you now ready to proceed with the installation [Y/n] ? Copying the Gtk+ binaries ... ====== Building tools ===== /usr/bin/gprbuild -j0 -m -p -XLIBRARY_TYPE=static -Psrc/tools/tools.gpr Bind [gprbind] gdialog.bexch [Ada] gdialog.ali Link [link] gdialog.adb /usr/bin/ld: /home/daniil/Downloads/gtkada-2021-x86_64-linux-bin/src/lib/gtkada/static/libgtkada.a(misc.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a PIE object; recompile with -fPIE collect2: error: ld returned 1 exit status gprbuild: link of gdialog.adb failed gprbuild: failed command was: /usr/bin/gnatgcc gdialog.o b__gdialog.o /home/daniil/Downloads/gtkada-2021-x86_64-linux-bin/src/lib/gtkada/static/libgtkada.a -L/home/daniil/Downloads/gtkada-2021-x86_64-linux-bin//lib -L/home/daniil/Downloads/gtkada-2021-x86_64-linux-bin//bin -L/opt/gtkada/lib -L/it/sbx/wave/x86_64-linux/freetype-2.9.1-gtk-3.14/install/lib -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -Wl,--export-dynamic -lgmodule-2.0 -pthread -lglib-2.0 -lfontconfig -lfreetype -L/home/daniil/Downloads/gtkada-2021-x86_64-linux-bin/src/obj/tools/ -L/home/daniil/Downloads/gtkada-2021-x86_64-linux-bin/src/obj/tools/ -L/home/daniil/Downloads/gtkada-2021-x86_64-linux-bin/src/lib/gtkada/static/ -L/usr/lib/gcc/x86_64-linux-gnu/9/adalib/ -shared-libgcc -lgnat-9 -ldl -Wl,-rpath-link,/usr/lib/gcc/x86_64-linux-gnu/9//adalib -Wl,-z,origin,-rpath,$ORIGIN/../../..//lib:$ORIGIN/../../..//bin:/opt/gtkada/lib:/it/sbx/wave/x86_64-linux/freetype-2.9.1-gtk-3.14/install/lib:$ORIGIN/:$ORIGIN/../..//lib/gtkada/static:/usr/lib/gcc/x86_64-linux-gnu/9/adalib:/usr/lib64:/usr/lib -o gtkada-dialog make: *** [Makefile:81: tools] Error 4
I cloned the repo, ran
./configure --prefix=/usr --with-GL=no
(as suggested in https://github.com/AdaCore/gtkada/issues/9) and followed it withmake PROCESSORS="$(nproc)"
This resulted in a relocation error:
Applying this patch appears to correct the issue: