[Ohrrpgce] Can't compile 64-bit hspeak on the nightly build vm

Ralph Versteegen teeemcee at gmail.com
Wed Dec 20 02:35:31 PST 2017


Bah. I wasn't expecting that to work. fbc apparently only does a PIC build
when building a dynamic library, not when building an executable. I think
what's going on here is that fbc calls ld directly, while linkgcc=1 uses
gcc to indirectly call the linker. I guess it's gcc itself which is telling
ld to do a PIE build. I want to fix linkgcc=1.

So could you please try editing SConscript to replace
CXXLINKFLAGS = []
with
CXXLINKFLAGS = ["-no-pie"]
and see if that works (running just plain "scons")

On 20 December 2017 at 16:23, James Paige <Bob at hamsterrepublic.com> wrote:

> Ah, yes! scons linkgcc=0 did the trick. :)
>
> On Tue, Dec 19, 2017 at 1:10 AM, Ralph Versteegen <teeemcee at gmail.com>
> wrote:
>
>> Hmm. Most of the errors are in libfbmt.a. But a couple of the relocation
>> errors are in .bas modules,  "relocation R_X86_64_32 against
>> `.rodata.str1.1' " and I don't understand why - if gcc is defaulting to
>> PIC,
>> As fir why gcc says "...can not be used when making a shared object",
>> I'm guessing that's a gcc bug, since PIC is normally only required when
>> creating a dynamic library on non-x86, so configuring gcc to force it also
>> for executables might activate the same codepath.
>>
>> Anyway, see if any of the following work:
>> scons linkgcc=0
>> FBFLAGS=-pic scons linkgcc=0
>> FBFLAGS="-Wl -no-pie" scons
>> (I suggest linkgcc=0 because linkgcc=1 always links libfbmt.a, never
>> libfbmtpic.a which is compiled with -fPIC)
>>
>> On 19 December 2017 at 16:47, James Paige <Bob at hamsterrepublic.com>
>> wrote:
>>
>>> I should have mentioned I already tried scons -c and it didn't help :(
>>>
>>>
>>> On Monday, December 18, 2017, Ralph Versteegen <teeemcee at gmail.com>
>>> wrote:
>>>
>>>> Run "scons -c" to delete the old object files. Since they were compiled
>>>> without -fPIC, which is now the default in debian 9, they can't be linked
>>>> into a PIE executable.
>>>>
>>>> On 19 December 2017 at 14:05, James Paige <Bob at hamsterrepublic.com>
>>>> wrote:
>>>>
>>>>> So I made a copy of the 64 bit Linux VM, and upgraded it from Debian 8
>>>>> to Debian 9.
>>>>>
>>>>> hspeak compiles fine now as a 64 bit binary, but I can no longer
>>>>> compile ohrrpgce-game and ohrrpgce-custom
>>>>>
>>>>> when making a shared object; recompile with -fPIC
>>>>> /usr/bin/ld: /usr/local/bin/../lib/freebasic/linux-x86_64/libfbmt.a(io_print_wstr.o): relocation R_X86_64_32 against undefined symbol `__fb_ctx' can not be used when making a shared object; recompile with -fPIC
>>>>> /usr/bin/ld: /usr/local/bin/../lib/freebasic/linux-x86_64/libfbmt.a(io_printvoid_wstr.o): relocation R_X86_64_32 against `.rodata.str4.4' can not be used when making a shared object; recompile with -fPIC
>>>>> /usr/bin/ld: /usr/local/bin/../lib/freebasic/linux-x86_64/libfbmt.a(sys_getexename.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
>>>>> /usr/bin/ld: /usr/local/bin/../lib/freebasic/linux-x86_64/libfbmt.a(file_print_wstr.o): relocation R_X86_64_32 against undefined symbol `__fb_ctx' can not be used when making a shared object; recompile with -fPIC
>>>>> /usr/bin/ld: /usr/local/bin/../lib/freebasic/linux-x86_64/libfbmt.a(io_printpad_wstr.o): relocation R_X86_64_32 against `.rodata.str4.4' can not be used when making a shared object; recompile with -fPIC
>>>>> /usr/bin/ld: /usr/local/bin/../lib/freebasic/linux-x86_64/libfbmt.a(dev_scrn_write_wstr.o): relocation R_X86_64_32S against symbol `fb_DevScrnWriteWstr' can not be used when making a shared object; recompile with -fPIC
>>>>> /usr/bin/ld: /usr/local/bin/../lib/freebasic/linux-x86_64/libfbmt.a(io_printbuff_wstr.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
>>>>> /usr/bin/ld: /usr/local/bin/../lib/freebasic/linux-x86_64/libfbmt.a(array_erase.o): relocation R_X86_64_PC32 against symbol `free@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
>>>>> /usr/bin/ld: final link failed: Bad value
>>>>> collect2: error: ld returned 1 exit status
>>>>> scons: *** [ohrrpgce-game] Error 1
>>>>> scons: building terminated because of errors.
>>>>>
>>>>>
>>>>> On Sun, Dec 17, 2017 at 10:21 AM, James Paige <Bob at hamsterrepublic.com
>>>>> > wrote:
>>>>>
>>>>>> Today I will try upgrading Debian on a copy of the 64-bit VM,
>>>>>>  Hopefully that will resolve it.
>>>>>>
>>>>>> ---
>>>>>> James
>>>>>>
>>>>>>
>>>>>> On Sat, Dec 16, 2017 at 4:00 PM, Ralph Versteegen <teeemcee at gmail.com
>>>>>> > wrote:
>>>>>>
>>>>>>> -no-pie is actually passed by SConscript.  I can't find any mention
>>>>>>> in my emails about a -no-pie problem on debian. The problem we had was that
>>>>>>> -no-pie was supported (nor necessary) for clang on OSX.
>>>>>>>
>>>>>>> The -no-pie flag was added in r9542:
>>>>>>> """
>>>>>>> scons: Fix hspeak builds on Arch Linux and others where gcc defaults
>>>>>>> to PIE
>>>>>>>
>>>>>>> The Euphoria 4.1 builds we recommend (and which are also used by the
>>>>>>> Arch
>>>>>>> opeeuphoria package on AUR) haven't been built for PIE
>>>>>>> """
>>>>>>> Apparently this flag is also necessary on (recent?) Debian and
>>>>>>> Ubuntu, as they also default to PIE.
>>>>>>>
>>>>>>> It's not clear, but from searching around it appears that this flag
>>>>>>> used to be called -nopie until gcc 6 switched to -no-pie. So try that. I
>>>>>>> have the man page for gcc 4.8 here, and it doesn't say either way.
>>>>>>> Also, there is -fno-pie which is a compiler flag while -no-pie is a
>>>>>>> linker flag (also understood by gcc). So you could also try that and see
>>>>>>> whether it works. (I assume that -no-pie passed to gcc implies -fno-pie)
>>>>>>>
>>>>>>> On 16 December 2017 at 12:3
>>>>>>> 2, James Paige <Bob at hamsterrepublic.com> wrote:
>>>>>>>
>>>>>>>> So now I remember why I have the 32-bit version of Euphoria
>>>>>>>> installed on the Linux nightly build machine.
>>>>>>>>
>>>>>>>> The hspeak build fails because gcc doesn't understand --no-pie
>>>>>>>>
>>>>>>>>
>>>>>>>> gcc -o /home/james/src/ohr/wip/hspeak init-.o hspeak.o main-.o
>>>>>>>> hspeak_0.o hspeak_1.o hspeak_2.o hspeak_3.o hspeak_4.o hsspiffy.o file.o
>>>>>>>> sort.o get.o graphics.o machine.o math.o types.o unicode.o ucstypes.o
>>>>>>>> io_with_unicode.o 0achine.o memory.o dll.o  /usr/share/euphoria/bin/eu.a
>>>>>>>> -m64 -ldl -lm -lpthread -no-pie
>>>>>>>> gcc: error: unrecognized command line option '-no-pie'
>>>>>>>> hspeak.mak:97: recipe for target '/home/james/src/ohr/wip/hspeak'
>>>>>>>> failed
>>>>>>>> make: *** [/home/james/src/ohr/wip/hspeak] Error 1
>>>>>>>> make: Leaving directory '/home/james/src/ohr/wip/build/hspeak'
>>>>>>>> scons: done building targets.
>>>>>>>> james at ixrat:~/src/ohr/wip$ euc -v
>>>>>>>> Euphoria to C Translator v4.1.0 development
>>>>>>>>    64-bit Linux, Using System Memory
>>>>>>>>    Revision Date: 2015-02-02 14:18:53, Id: 5861:57179171dbed
>>>>>>>> james at ixrat:~/src/ohr/wip$ gcc --version
>>>>>>>> gcc (Debian 4.9.2-10) 4.9.2
>>>>>>>> Copyright (C) 2014 Free Software Foundation, Inc.
>>>>>>>> This is free software; see the source for copying conditions.
>>>>>>>> There is NO
>>>>>>>> warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR
>>>>>>>> PURPOSE.
>>>>>>>>
>>>>>>>>
>>>>>>>> I am wondering if the easiest way to resolve this might be to
>>>>>>>> upgrade the virtual machine from Debian 8.x to 9.x and hopefully get a
>>>>>>>> version of gcc that does not have this problem.
>>>>>>>>
>>>>>>>> For now, I am leaving the 64-bit version of euphoria installed on
>>>>>>>> the vm, so the 64-bit nightly builds are going to remain broken until I
>>>>>>>> have figured out a solution.
>>>>>>>>
>>>>>>>> ---
>>>>>>>> James
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> Ohrrpgce mailing list
>>>>>>>> ohrrpgce at lists.motherhamster.org
>>>>>>>> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherh
>>>>>>>> amster.org
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> Ohrrpgce mailing list
>>>>>>> ohrrpgce at lists.motherhamster.org
>>>>>>> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherh
>>>>>>> amster.org
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>> _______________________________________________
>>>>> Ohrrpgce mailing list
>>>>> ohrrpgce at lists.motherhamster.org
>>>>> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
>>>>>
>>>>>
>>>>
>>> _______________________________________________
>>> Ohrrpgce mailing list
>>> ohrrpgce at lists.motherhamster.org
>>> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
>>>
>>>
>>
>> _______________________________________________
>> Ohrrpgce mailing list
>> ohrrpgce at lists.motherhamster.org
>> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
>>
>>
>
> _______________________________________________
> Ohrrpgce mailing list
> ohrrpgce at lists.motherhamster.org
> http://lists.motherhamster.org/listinfo.cgi/ohrrpgce-motherhamster.org
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.motherhamster.org/pipermail/ohrrpgce-motherhamster.org/attachments/20171220/fef19099/attachment-0001.html>


More information about the Ohrrpgce mailing list