Felix linux build error

9 views
Skip to first unread message

Razetime

unread,
Oct 22, 2022, 3:30:40 AM10/22/22
to felix...@googlegroups.com
I am trying to build felix on my linux machine.

OS: Ubuntu 20.04.5 LTS x86_64

Python version: 3.8.10

OCaml version: 4.14.0

g++ version: 9.4.0

Error:

[bootflx] build/release/host/bin/flx --felix=build.fpc -c -od
build/release/host/lib/rtl build/release/share/lib/plugins/flx_plugin
# =========================================================
# build tools required for rebuild.
# This is to be done right after building the bootstrap.
# The tools are placed in the host.
# =========================================================
build/release/host/bin/flx --felix=build.fpc --static -c -od
build/release/host/bin src/tools/flx_build_flxg.flx
BOOTFLX
[bootflx] build/release/host/bin/flx --felix=build.fpc --static -c -od
build/release/host/bin src/tools/flx_build_flxg.flx
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_static.a(flx_world_config_static.o):
requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_static.a(flx_svc_static.o): requires
unsupported dynamic reloc 11; recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_static.a(flx_ioutil_static.o):
requires dynamic R_X86_64_32 reloc which may overflow at runtime;
recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_static.a(flx_ioutil_static.o):
requires dynamic R_X86_64_32 reloc against '__gxx_personality_v0'
which may overflow at runtime; recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_static.a(flx_world_static.o):
requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_static.a(flx_world_static.o):
requires dynamic R_X86_64_32 reloc against
'_ZTIN3flx3rtl15flx_exception_tE' which may overflow at runtime;
recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_static.a(flx_world_static.o):
requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_static.a(flx_world_static.o):
requires dynamic R_X86_64_32 reloc which may overflow at runtime;
recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_static.a(flx_sync_static.o):
requires dynamic R_X86_64_32 reloc which may overflow at runtime;
recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_static.a(flx_sync_static.o):
requires dynamic R_X86_64_32 reloc which may overflow at runtime;
recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_static.a(flx_rtl_static.o): requires
unsupported dynamic reloc 11; recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_static.a(flx_rtl_static.o): requires
dynamic R_X86_64_32 reloc against '_ZTIPN3flx3rtl5con_tE' which may
overflow at runtime; recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_static.a(flx_rtl_static.o): requires
dynamic R_X86_64_32 reloc which may overflow at runtime; recompile
with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_static.a(flx_async_world_static.o):
requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_static.a(flx_async_world_static.o):
requires dynamic R_X86_64_32 reloc against
'_ZTIN10__cxxabiv115__forced_unwindE' which may overflow at runtime;
recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_static.a(flx_async_world_static.o):
requires dynamic R_X86_64_32 reloc which may overflow at runtime;
recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_static.a(flx_spinlock_static.o):
requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_static.a(flx_spinlock_static.o):
requires dynamic R_X86_64_32 reloc which may overflow at runtime;
recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_dynlink_static.a(flx_dynlink_static.o):
requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_dynlink_static.a(flx_dynlink_static.o):
requires dynamic R_X86_64_32 reloc against
'_ZTIN3flx3rtl18flx_link_failure_tE' which may overflow at runtime;
recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_dynlink_static.a(flx_dynlink_static.o):
requires dynamic R_X86_64_32 reloc which may overflow at runtime;
recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_dynlink_static.a(flx_dlopen_static.o):
requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_dynlink_static.a(flx_dlopen_static.o):
requires dynamic R_X86_64_32 reloc which may overflow at runtime;
recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_gc_static.a(flx_collector_static.o):
requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_gc_static.a(flx_collector_static.o):
requires unsupported dynamic reloc 11; recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_gc_static.a(flx_collector_static.o):
requires dynamic R_X86_64_32 reloc which may overflow at runtime;
recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_gc_static.a(flx_serialisers_static.o):
requires dynamic R_X86_64_32 reloc which may overflow at runtime;
recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_gc_static.a(flx_gc_static.o):
requires dynamic R_X86_64_32 reloc which may overflow at runtime;
recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_gc_static.a(flx_gc_static.o):
requires dynamic R_X86_64_32 reloc against
'_ZTIN3flx3rtl19flx_out_of_memory_tE' which may overflow at runtime;
recompile with -fPIC
/usr/local/bin/ld: error:
build/release/host/lib/rtl/libflx_gc_static.a(flx_gc_static.o):
requires dynamic R_X86_64_32 reloc which may overflow at runtime;
recompile with -fPIC
collect2: error: ld returned 1 exit status
Link command="g++" -o
"/home/razetime/Software/felix/build/release/host/bin/flx_build_flxg"
"build/release/host/lib/rtl/flx_run_lib_static_static.o"
"build/release/host/lib/rtl/flx_run_main_static.o"
"/home/razetime/.felix/cache/text/home/razetime/Software/felix/src/tools/flx_build_flxg_static_link_thunk_static.o"
"/home/razetime/.felix/cache/text/home/razetime/Software/felix/src/tools/flx_build_flxg_static.o"
"-Lbuild/release/host/lib/rtl" "-lflx_re2_static" "-lflx_static"
"-lflx_pthread_static" "-lpthread" "-lflx_dynlink_static" "-ldl"
"-lflx_strutil_static" "-lflx_gc_static" "-ljudy_static"
"-lflx_exceptions_static" FAILED
[flx] C++ static executable link
/home/razetime/Software/felix/build/release/host/bin/flx_build_flxg
failed
Error 1 in flx: [strerror_r] Failed to find text for error number 1
make: *** [GNUmakefile:170: bootstrap-tools] Error 1

rraghu...@gmail.com

unread,
Oct 22, 2022, 3:55:56 AM10/22/22
to felix
I'd like to know if the versions are improper or i'm doing something wrong in this build. It is the exact same order of commands as given in https://felix-lang.github.io/felix/

Razetime

unread,
Oct 22, 2022, 4:28:15 AM10/22/22
to felix
It is also of note that I tried running the hello world program with
my built binary and prebuilt binaries and I am getting a grammar file
error:

felix/build/release/host/bin$ ./flx /tmp/hello.flx
BOOTFLX
[bootflx] ./flx /tmp/hello.flx
Grammar include file
'/usr/local/lib/felix/felix-2019.01.06/share/lib/grammar/grammar.files'
doesn't exist, exiting

felix-bin/build/release/host/bin$ ./flx /tmp/hello.flx
Grammar include file
'/usr/local/lib/felix/felix-2018.09.16/share/lib/grammar/grammar.files'
doesn't exist, exiting
> --
> You received this message because you are subscribed to the Google Groups
> "felix" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to felix-lang+...@googlegroups.com.
> To view this discussion on the web, visit
> https://groups.google.com/d/msgid/felix-lang/6ead3f4e-5cbd-48c6-a7f2-c1e3eee38f85n%40googlegroups.com.
>

rraghu...@gmail.com

unread,
Oct 22, 2022, 4:46:33 AM10/22/22
to felix
I did not realize that the initial build instructions on the site were not enough. Maybe it would be better to link these docs first? https://felix-tools.readthedocs.io/en/latest/installation.html#running-in-place

John Skaller

unread,
Oct 25, 2022, 8:28:04 PM10/25/22
to felix

> requires dynamic R_X86_64_32 reloc which may overflow at runtime;
> recompile with -fPIC
> /usr/local/bin/ld: error:
> build/release/host/lib/rtl/libflx_gc_static.a(flx_gc_static.o):
> requires dynamic R_X86_64_32 reloc which may overflow at runtime;
> recompile with -fPIC
> /usr/local/bin/ld: error:
> build/release/host/lib/rtl/libflx_gc_static.a(flx_gc_static.o):
> requires dynamic R_X86_64_32 reloc against
> '_ZTIN3flx3rtl19flx_out_of_memory_tE' which may overflow at runtime;
> recompile with -fPIC
> /usr/local/bin/ld: error:
> build/release/host/lib/rtl/libflx_gc_static.a(flx_gc_static.o):
> requires dynamic R_X86_64_32 reloc which may overflow at runtime;
> recompile with -fPIC
> collect2: error: ld returned 1 exit status


I don’t understand what’s happening here.

On Linux, the object files ending in _static.o are *deliberately* compiled
WITHOUT -fPIC.

The files ending in _dynamic.o are compiled WITH -fPIC

That’s the difference between them. -fPIC is required for dynamic linkage
and generates “relocatable code”. But this costs extra instructions for every subroutine call.

So for static linkage, you don’t want -fPIC and the compiler is wrong it cannot overflow at run time.

On MacOS, there is no difference, ALL code is position independent because
MacOS does NOT support static linkage of frameworks including the C run time library.

On Windows it’s messy: contrary to popular belief the Windows linker does not support
dynamic linkage, it ONLY has static linkage. So the compiler is forced to do the hackery
required instead .. that’s what export and import do. So in practice everyone on Windows
uses DLLs, with hacked static links, in other words, Windows really doesn’t support
static linkage even though the linker can ONLy do static linkage .. .Windows is weird :-)

Anyhow the message above is saying the garbage collector requires dynamic relocation
against the error handling routine for out of memory.

I’m noting that the boostrap version of flx is running and trying to build the Felix build tools
which are used to rebuild flx and everything else.

So the Python buildscript has successfully built the bootstrap flx, but that version of flx
is not building the build tools:


build/release/host/bin/flx --felix=build.fpc --static -c -od
build/release/host/bin src/tools/flx_build_flxg.flx
BOOTFLX
[bootflx] build/release/host/bin/flx --felix=build.fpc --static -c -od
build/release/host/bin src/tools/flx_build_flxg.flx


build/release/host/bin/flx is the bootstrap version of flx.
It is trying to build “flx_build_flxg” which is the Felix program that
builds the compiler, flxg.

Of course the compiler flxg is ALREADY built, but it was built by Python script.

So you need to make this a GitHub issue. I’m running a Mac so I don’t get this error.

However Travis regularly builds Felix on Linux and doesn’t get the error either.

So my GUESS at the moment it’s a change in the GNU linker model with version 9.
My guess is that they’re dropping support for static linkage, as Apple has done.
More precisely, dropping support for non-position independent (PIC) code.

However it could be a BUG in the build scripts, where just one object file uses -fPIC
which means all the others have to as well. Since I run MacOS I would never notice
that.

However, I do get some weirdo relocation error once when I run flx. As far as I can tell
that one is a BUG in clang’s C++ standard library that has never been fixed so it is
probably unrelated ...




John Skaller
ska...@internode.on.net





Reply all
Reply to author
Forward
0 new messages