Recent

Author Topic: libsqlite3.so vs libsqlite3.a  (Read 5857 times)

Pascal

  • Hero Member
  • *****
  • Posts: 806
Re: libsqlite3.so vs libsqlite3.a
« Reply #15 on: October 24, 2018, 08:26:39 pm »
I believe that is what -Xr is for.

Makes sense. I'll try that tomorrow.
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

Pascal

  • Hero Member
  • *****
  • Posts: 806
Re: libsqlite3.so vs libsqlite3.a
« Reply #16 on: October 25, 2018, 12:42:21 pm »
-Xr does not help here.

The linker always adds the complete path where it found the lib to the executable. Instead it should just leave the library name (without path).

@DonAlfredo: Can you check the linker sources if there is a way to suppress this behaviour?
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1059
Re: libsqlite3.so vs libsqlite3.a
« Reply #17 on: October 25, 2018, 12:51:04 pm »
Would you mind adding this into your fpc.cfg ?
(changing the paths towards your setup naturally)

Code: Pascal  [Select]
  1. #IFDEF FPC_CROSSCOMPILING
  2. #IFDEF AIX
  3. #IFDEF CPUPOWERPC64
  4. # Inserted by fpcup 25-10-2018 09:30:42
  5. -FDC:\fpclazbydeluxe\trunk\cross\bin\powerpc-aix\
  6. -XPpowerpc-aix-
  7. -Xd
  8. -FlC:\fpclazbydeluxe\trunk\cross\lib\powerpc64-aix\
  9. -XRC:\fpclazbydeluxe\trunk\cross\lib\powerpc64-aix
  10. -Xr/usr/lib
  11. #ENDIF
  12. #ENDIF
  13. #ENDIF
  14.  

Ps:
Hacking through the linker sources is not my favorite way of spending precious programming time. The hacks until now were not that hard, but preventing a basic functionality of the linker will not be easy. And besides, it should not be necessary: cross-compiling should work on AIX as it works on other Linux and Unix systems. Meaning: we have to dig deeper ... ;-)

Pascal

  • Hero Member
  • *****
  • Posts: 806
Re: libsqlite3.so vs libsqlite3.a
« Reply #18 on: October 25, 2018, 01:34:54 pm »
Again: Many thanks for your efforts!

I changed my fpc.cfg:
Code: Pascal  [Select]
  1. #IFDEF FPC_CROSSCOMPILING
  2. #IFDEF AIX
  3. #IFDEF CPUPOWERPC64
  4. # Inserted by fpcup 25-10-2018 09:30:42
  5. -FDC:\freepascal\fpc\binutils\i386-win32\
  6. -XPpowerpc-aix-
  7. -Xd
  8. -FlC:\freepascal\cross\aix\
  9. -XRC:\freepascal\cross\aix\
  10. -Xr/usr/lib
  11. #ENDIF
  12. #ENDIF
  13. #ENDIF

And removed all custom options from project/mode.

Result of run:
Code: Text  [Select]
  1. exec(): 0509-036 Das Programm tools/unixtest kann wegen der folgenden Fehler nicht geladen werden:
  2.         0509-150   Das abhängige Modul C:\freepascal\cross\aix\/lib/libsqlite3.so konnte nicht geladen werden.
  3.         0509-022 Das Modul C:\freepascal\cross\aix\/lib/libsqlite3.so kann nicht geladen werden.
  4.         0509-026 Systemfehler: Eine Datei oder ein Verzeichnis des Pfadnamens ist nicht vorhanden.

laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

Pascal

  • Hero Member
  • *****
  • Posts: 806
Re: libsqlite3.so vs libsqlite3.a
« Reply #19 on: October 25, 2018, 01:39:42 pm »
With option "-s" i can see the linker call:
Code: Text  [Select]
  1. C:\freepascal\fpc\trunk\bin\i386-win32\powerpc64-aix-ld.exe -bpT:0x10000000 -bpD:0x20000000 -btextro   -L. -o C:\freepascal\projects\unixtest\unixtest C:\freepascal\projects\unixtest\link.res -b64 --sysroot=C:\freepascal\cross\aix\

"-Xr/usr/lib" ssems to have no effect here.
I tried "-k-rpath-link /usr/lib" and "-k-rpath /usr/lib". Both have no effet on the binary.
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1059
Re: libsqlite3.so vs libsqlite3.a
« Reply #20 on: October 25, 2018, 01:45:11 pm »
Did you do a Clean and Build ?
But I guess you did ... ;-)

Now I am (nearly) out of ideas ! Few remain.

It would be nice if I could get access to an (or yours) AIX server through SSH. Makes testing easier.

Second, I am preparing a new release of fpcupdeluxe. It will build a cross-compiler for AIX. With settings I know about. I would like you to try to use that to install FPC and Lazarus, and the AIX cross-compiler. But please be patient. The release will take another couple of hours. Will inform you !

Ps:
To add linker options, do:
-k-rpath-link -k/usr/lib

Pascal

  • Hero Member
  • *****
  • Posts: 806
Re: libsqlite3.so vs libsqlite3.a
« Reply #21 on: October 25, 2018, 02:02:31 pm »
Did you do a Clean and Build ?
But I guess you did ... ;-)

Now I am (nearly) out of ideas ! Few remain.

It would be nice if I could get access to an (or yours) AIX server through SSH. Makes testing easier.

Second, I am preparing a new release of fpcupdeluxe. It will build a cross-compiler for AIX. With settings I know about. I would like you to try to use that to install FPC and Lazarus, and the AIX cross-compiler. But please be patient. The release will take another couple of hours. Will inform you !

Ps:
To add linker options, do:
-k-rpath-link -k/usr/lib

We have to somehow leave out -XR. The problem we have then is that "crt0_64.o" is not found as it is added to the link.res as absolute path ("\lib\crt0_64.o") so it will not use the seach pathes. Were does this absolute path come from?

With symlink from /lib to /freepascal/cross/aix/lib i got it linking but the resolved path is still added to the binary.

laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

Pascal

  • Hero Member
  • *****
  • Posts: 806
Re: libsqlite3.so vs libsqlite3.a
« Reply #22 on: October 25, 2018, 03:09:48 pm »
I removed the absolute path to crt0_64.o from compiler/systems/t_aix.pas.
The object gets found now by the linker but the binary still includes the complete path to libsqlite3.so.

Code: Text  [Select]
  1. exec(): 0509-036 Das Programm tools/unixtest kann wegen der folgenden Fehler nicht geladen werden:
  2.         0509-150   Das abhängige Modul C:\freepascal\cross\aix\lib\/libsqlite3.so konnte nicht geladen werden.
  3.         0509-022 Das Modul C:\freepascal\cross\aix\lib\/libsqlite3.so kann nicht geladen werden.
  4.         0509-026 Systemfehler: Eine Datei oder ein Verzeichnis des Pfadnamens ist nicht vorhanden.
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1059
Re: libsqlite3.so vs libsqlite3.a
« Reply #23 on: October 25, 2018, 04:15:52 pm »
New try, with all standard options.

Please add this into the linker options.
-rpath /usr/lib
(see included picture)

The -Xr option is ignored by FPC for AIX ... do not ask why.

If I look at the generated binary, the /usr/lib library searchpatch is added !

Pascal

  • Hero Member
  • *****
  • Posts: 806
Re: libsqlite3.so vs libsqlite3.a
« Reply #24 on: October 25, 2018, 04:20:39 pm »
New try, with all standard options.

Please add this into the linker options.
-rpath /usr/lib
(see included picture)

The -Xr option is ignored by FPC for AIX ... do not ask why.

If I look at the generated binary, the /usr/lib library searchpatch is added !

I did that already and i also could see "/usr/lib" in the binary but right after this string there is the found path of libsqlite3.so in the binary ("C:\freepascal\cross\aix\lib").
I found no way to get it out of the binary!

This drives me nuts  %)
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1059
Re: libsqlite3.so vs libsqlite3.a
« Reply #25 on: October 25, 2018, 04:25:51 pm »
I see something different. There is a zero between the path and the library. Meaning two different strings. Its not an absolute path.
See picture.

Pascal

  • Hero Member
  • *****
  • Posts: 806
Re: libsqlite3.so vs libsqlite3.a
« Reply #26 on: October 25, 2018, 04:28:17 pm »
I see something different. There is a zero between the path and the library. Meaning two different strings. Its not an absolute path.
See picture.

Yes, right but system puts the final string together from path-string and pathdelimiter and library-string  :(
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

Pascal

  • Hero Member
  • *****
  • Posts: 806
Re: libsqlite3.so vs libsqlite3.a
« Reply #27 on: October 25, 2018, 06:19:19 pm »
The linker should omit the pathes in the binary if -rpath is specified!

Is there an option for that or for omitting the pathes to the shared libs in general?
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

Pascal

  • Hero Member
  • *****
  • Posts: 806
Re: libsqlite3.so vs libsqlite3.a
« Reply #28 on: October 26, 2018, 08:40:43 am »
While trying to link the static libsqlite3.a the linker refused to link a 64 bit version and only accepts the 32 bit version.
If this 64 bit binary finds the 32 bit libsqlite3.a on the system it loads and starts.
Strange!
Why does the linker not accept the 64 bit static libs?
laz trunk - fpc trunk 32bit - Windows 10 Pro x64 (1803)

DonAlfredo

  • Hero Member
  • *****
  • Posts: 1059
Re: libsqlite3.so vs libsqlite3.a
« Reply #29 on: October 26, 2018, 09:07:17 am »
The 64bit version is only a link towards the 32bit version.
The libs are suitable for boths architectures.