Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-pascal / 2018-10

mips cross compiler libraries (and crti.o) problem

2 messages · 1 person ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Luca Olivetti

Hello,

I built an fpc-3.0.4 mips cross compiler on kubuntu 18.04 using the prepackaged mips binutils with

make all BINUTILSPREFIX=mips-linux-gnu- CPU_TARGET=mips OS_TARGET=linux sudo make crossinstall BINUTILSPREFIX=mips-linux-gnu- CPU_TARGET=mips OS_TARGET=linux

When I try to compile the program I get this error:

ppcrossmips lgmounter.pas
Free Pascal Compiler version 3.0.4 [2018/10/07] for mips Copyright (c) 1993-2017 by Florian Klaempfl and others Target OS: Linux for MIPSEB
Compiling lgmounter.pas
Compiling synaser.pas
Compiling synafpc.pas
Assembling synafpc
Compiling synautil.pas
synautil.pas(564,51) Warning: Symbol "TimeSeparator" is deprecated synautil.pas(1804,43) Warning: Symbol "ShortMonthNames" is deprecated synautil.pas(1805,42) Warning: Symbol "ShortMonthNames" is deprecated Assembling synautil
synaser.pas(2278,41) Warning: range check error while evaluating constants (4294967295 must be between -2147483648 and 2147483647) Assembling synaser
Assembling lgmounter
Linking lgmounter
lgmounter.pas(274) Warning: "crtbegin.o" not found, this will probably cause a linking failure
lgmounter.pas(274) Warning: "crtend.o" not found, this will probably cause a linking failure
mips-linux-gnu-ld: warning: link.res contains output sections; did you forget -T?
mips-linux-gnu-ld: skipping incompatible
/usr/lib/x86_64-linux-gnu/crti.o when searching for /usr/lib/x86_64-linux-gnu/crti.o
mips-linux-gnu-ld: cannot find /usr/lib/x86_64-linux-gnu/crti.o mips-linux-gnu-ld: skipping incompatible
/usr/lib/x86_64-linux-gnu//libdl.so when searching for -ldl mips-linux-gnu-ld: skipping incompatible
/usr/lib/x86_64-linux-gnu//libdl.a when searching for -ldl mips-linux-gnu-ld: skipping incompatible
/usr/lib/i386-linux-gnu//libdl.so when searching for -ldl mips-linux-gnu-ld: skipping incompatible
/usr/lib/i386-linux-gnu//libdl.a when searching for -ldl mips-linux-gnu-ld: cannot find -ldl
mips-linux-gnu-ld: skipping incompatible
/usr/lib/x86_64-linux-gnu//libc.so when searching for -lc mips-linux-gnu-ld: skipping incompatible
/usr/lib/x86_64-linux-gnu//libc.a when searching for -lc mips-linux-gnu-ld: skipping incompatible
/usr/lib/i386-linux-gnu//libc.so when searching for -lc

mips-linux-gnu-ld: skipping incompatible /usr/lib/i386-linux-gnu//libc.a when searching for -lc

mips-linux-gnu-ld: cannot find -lc

lgmounter.pas(274) Error: Error while linking

lgmounter.pas(274) Fatal: There were 1 errors compiling module, stopping

Fatal: Compilation aborted

I copied libc.so and libdl.so from the target into the directory /home/luca/mipslibs

I also had to copy crtbegin.o crtend.o crti.o crtn.o from an openwrt buildroot for the target (is that correct? I couldn't find them on the target)

What I tried:

1) putting this in /etc/fpc.cfg

#ifdef cpumips
-Fl/home/luca/mipslibs
#endif

2) adding a file in /etc/ld.so.conf.d with /home/luca/mipslibs and running ldconfig

3) putting in the PATH a custom mips-gnu-linux-ld that adds an --rpath=/home/luca/mipslibs/ before calling ld [*]

but the error message is always the same.

What am I doing wrong?

Bye

Luca

Reply by email

Luca Olivetti
to Luca Olivetti

El 8/10/18 a les 16:25, Luca Olivetti ha escrit:

3) putting in the PATH a custom mips-gnu-linux-ld that adds an --rpath=/home/luca/mipslibs/ before calling ld [*]

Duh, instead of --rpath I used --library-path and it got me further

Free Pascal Compiler version 3.0.4 [2018/10/07] for mips Copyright (c) 1993-2017 by Florian Klaempfl and others Target OS: Linux for MIPSEB
Compiling lgmounter.pas
Assembling lgmounter
Linking lgmounter
/usr/bin/mips-linux-gnu-ld: warning: link.res contains output sections; did you forget -T?
/usr/bin/mips-linux-gnu-ld: skipping incompatible
/usr/lib/x86_64-linux-gnu/crti.o when searching for /usr/lib/x86_64-linux-gnu/crti.o
/usr/bin/mips-linux-gnu-ld: cannot find /usr/lib/x86_64-linux-gnu/crti.o lgmounter.pas(274) Error: Error while linking
lgmounter.pas(274) Fatal: There were 1 errors compiling module, stopping Fatal: Compilation aborted

Then I modified link.res to reference crti.o

$ mips-linux-gnu-ld link.res
/usr/bin/mips-linux-gnu-ld: warning: link.res contains output sections; did you forget -T?
/usr/bin/mips-linux-gnu-ld: skipping incompatible
/usr/lib/x86_64-linux-gnu/crtn.o when searching for /usr/lib/x86_64-linux-gnu/crtn.o
/usr/bin/mips-linux-gnu-ld: cannot find /usr/lib/x86_64-linux-gnu/crtn.o

Did the same for crtn.o

$ mips-linux-gnu-ld link.res
/usr/bin/mips-linux-gnu-ld: warning: link.res contains output sections; did you forget -T?
/usr/bin/mips-linux-gnu-ld: /home/luca/mipslibs/crti.o: warning: linking abicalls files with non-abicalls files
/usr/bin/mips-linux-gnu-ld: Warning: a.out uses -mhard-float (set by /usr/local/lib/fpc/3.0.4/units/mips-linux/rtl/cprt0.o), /home/luca/mipslibs/crtbegin.o uses -msoft-float
/usr/bin/mips-linux-gnu-ld: lgmounter.o: warning: linking abicalls files with non-abicalls files
/usr/bin/mips-linux-gnu-ld: synaser.o: warning: linking abicalls files with non-abicalls files
/usr/bin/mips-linux-gnu-ld: synafpc.o: warning: linking abicalls files with non-abicalls files
/usr/bin/mips-linux-gnu-ld: synautil.o: warning: linking abicalls files with non-abicalls files
/usr/bin/mips-linux-gnu-ld: Warning: a.out uses -mhard-float (set by /usr/local/lib/fpc/3.0.4/units/mips-linux/rtl/cprt0.o), /home/luca/mipslibs/crtend.o uses -msoft-float
/usr/local/lib/fpc/3.0.4/units/mips-linux/rtl/cprt0.o: In function `_start': (.text+0x60): undefined reference to `__libc_csu_init' (.text+0x64): undefined reference to `__libc_csu_fini' (.text+0x74): undefined reference to `__libc_start_main' lgmounter.o: In function `P$LGMOUNTER_$$_LOG$ANSISTRING': lgmounter.pas:(.text.n_p$lgmounter_$$_log$ansistring+0x9c): undefined reference to `syslog'
/usr/local/lib/fpc/3.0.4/units/mips-linux/rtl/dynlibs.o: In function `DYNLIBS_$$_DOLOADLIBRARY$RAWBYTESTRING$$LONGINT': dynlibs.pas:(.text.n_dynlibs_$$_doloadlibrary$rawbytestring$$longint+0x28): undefined reference to `dlopen'
/usr/local/lib/fpc/3.0.4/units/mips-linux/rtl/dynlibs.o: In function `DYNLIBS_$$_GETPROCEDUREADDRESS$LONGINT$ANSISTRING$$POINTER': dynlibs.pas:(.text.n_dynlibs_$$_getprocedureaddress$longint$ansistring$$pointer+0x24): undefined reference to `dlsym'
/usr/local/lib/fpc/3.0.4/units/mips-linux/rtl/dynlibs.o: In function `DYNLIBS_$$_UNLOADLIBRARY$LONGINT$$BOOLEAN':
dynlibs.pas:(.text.n_dynlibs_$$_unloadlibrary$longint$$boolean+0x18): undefined reference to `dlclose'
/usr/local/lib/fpc/3.0.4/units/mips-linux/rtl/dynlibs.o: In function `DYNLIBS_$$_GETLOADERRORSTR$$SHORTSTRING':
dynlibs.pas:(.text.n_dynlibs_$$_getloaderrorstr$$shortstring+0x20): undefined reference to `dlerror'
/usr/local/lib/fpc/3.0.4/units/mips-linux/rtl/dl.o: In function `DL_$$_UNIXGETMODULEBYADDR$POINTER$POINTER$OPENSTRING': dl.pp:(.text.n_dl_$$_unixgetmodulebyaddr$pointer$pointer$openstring+0x60): undefined reference to `dladdr'

Bye

Luca

Reply by email