Lazarus
Free Pascal => General => Topic started by: Чебурашка on January 19, 2023, 12:03:23 pm
Title:
shared library statically linked
Post by:
Чебурашка
on
January 19, 2023, 12:03:23 pm
Hello,
I have a lpi that produces a .so (say acertain.so) that works.
Currently if I do
Code: Pascal
[Select]
[+]
[-]
file
acertain
.
so
acertain
.
so
:
ELF
64
-
bit LSB shared
object
,
x86
-
64
,
version
1
(
SYSV
)
,
dynamically linked
,
not
stripped
I would like it to be statically linked, so I modify lpi to include -Xt -XS, but result is still
Code: Pascal
[Select]
[+]
[-]
file
acertain
.
so
acertain
.
so
:
ELF
64
-
bit LSB shared
object
,
x86
-
64
,
version
1
(
SYSV
)
,
dynamically linked
,
not
stripped
Is it possible to obtain statically linked for a .so like it happens for executables? In example below I give to compilet -Xt -XS and is does the job for a standard linux program.
Code: Bash
[Select]
[+]
[-]
user_tt
@
development:~
/
tmp
/
test-static-linking$
file
project1
project1: ELF
64
-bit LSB executable, x86-
64
, version
1
(
SYSV
)
, statically linked,
for
GNU
/
Linux 2.4.0, with debug_info, not stripped
Thanks
Title:
Re: shared library statically linked
Post by:
marcov
on
January 19, 2023, 12:05:30 pm
What does ldd <the .so> say ?
Title:
Re: shared library statically linked
Post by:
Чебурашка
on
January 19, 2023, 12:08:29 pm
Quote from: marcov on January 19, 2023, 12:05:30 pm
What does ldd <the .so> say ?
Code: Bash
[Select]
[+]
[-]
user_tt@development:~$
ldd
fpc-build
/
bin
/
x86_64-linux
/
libXXXXXXXXXX-x86_64-linux.so
/
lib64
/
ld-linux-x86-
64
.so.2
(
0x00007f9fa4725000
)
linux-vdso.so.1
(
0x00007ffffd926000
)
libpthread.so.0 =
>
/
lib
/
x86_64-linux-gnu
/
libpthread.so.0
(
0x00007f9fa41c2000
)
libdl.so.2 =
>
/
lib
/
x86_64-linux-gnu
/
libdl.so.2
(
0x00007f9fa41bc000
)
libc.so.6 =
>
/
lib
/
x86_64-linux-gnu
/
libc.so.6
(
0x00007f9fa3fe7000
)
Title:
Re: shared library statically linked
Post by:
Чебурашка
on
January 19, 2023, 12:11:00 pm
I tried creating a lpi containing the following library code:
Code: Pascal
[Select]
[+]
[-]
library
externalobject
;
{$mode objfpc}{$H+}
uses
Classes
{ you can add units after this }
;
procedure
sayYes
(
m
:
string
)
;
begin
Writeln
(
m
)
;
end
;
exports
SayYes
;
begin
end
.
But -Xt -XS do not result in a statically linked .so either.
TinyPortal
© 2005-2018