#1 2021-04-25 19:00:32

danielkuettner
Member
From: Germany
Registered: 2014-08-06
Posts: 330

linker issue under linux with static libs

I'm using mORMot but for OpenSslVerify I've used mormon.crypt.openssl from mORMot2 with actual static libs from get_latest_static.sh.
After compiling following error comes from linker:

Linking fpc/bin/x86_64-linux/SOneSrv
/usr/bin/ld: //home/daniel/mORMot2/src/crypt/../../static/x86_64-linux/sha512-x64sse4.o: in function `sha512_sse4':
(.text+0x0): multiple definition of `sha512_sse4'; static/x86_64-linux/sha512-x64sse4.o:(.text+0x0): first defined here
/usr/bin/ld: //home/daniel/mORMot2/src/crypt/../../static/x86_64-linux/crc32c64.o: in function `crc32_iscsi_01':
(.text+0x0): multiple definition of `crc32_iscsi_01'; static/x86_64-linux/crc32c64.o:(.text+0x0): first defined here
/usr/bin/ld: //home/daniel/mORMot2/src/crypt/../../static/x86_64-linux/crc32c64.o: in function `crc32_iscsi_01_slver_01030015':
(.text+0x1566): multiple definition of `crc32_iscsi_01_slver_01030015'; static/x86_64-linux/crc32c64.o:(.text+0x1566): first defined here
/usr/bin/ld: //home/daniel/mORMot2/src/crypt/../../static/x86_64-linux/crc32c64.o: in function `crc32_iscsi_01_slver_01030015':
(.text+0x1566): multiple definition of `crc32_iscsi_01_slver'; static/x86_64-linux/crc32c64.o:(.text+0x1566): first defined here
Error: Error while linking
Fatal: There were 1 errors compiling module, stopping

mORMot2/test/build_fpc.sh compiles and links without errors.

Offline

#2 2021-04-26 07:02:17

mpv
Member
From: Ukraine
Registered: 2012-03-24
Posts: 1,534
Website

Re: linker issue under linux with static libs

try to search a linker path (LD_LIBRARY_PATH) for sha512-x64sse4.* - I think you have an old version somethere

Offline

#3 2021-04-26 07:36:34

danielkuettner
Member
From: Germany
Registered: 2014-08-06
Posts: 330

Re: linker issue under linux with static libs

LD_LIBRARY_PATH was empty. I've set it to /home/daniel/mORMot2/static/x86_64-linux where sha512-x64sse4.o and others are located, but same errors.
My guess is that it comes from mixing mORMot with mORMot2. I've also tried to replace SynCrypto but its also used in mORMot.pas.

There seems to be a declaration of a variable or function in a header file, which is included in more than one *.c file.

Last edited by danielkuettner (2021-04-26 07:52:41)

Offline

#4 2021-04-26 08:46:11

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: linker issue under linux with static libs

mORMot 1 and mORMot 2 statics are not compatible.

Here is what I usually do:
For mORMot 1, I put the static folders hard-coded in each project option;
For mORMot 2, I use the Lazarus package.

Offline

#5 2021-04-26 08:52:13

danielkuettner
Member
From: Germany
Registered: 2014-08-06
Posts: 330

Re: linker issue under linux with static libs

Thanks @mpv and @ab.

I had to disable

{.$L static/x86_64-linux/sha512-x64sse4.o}
{.$L static/x86_64-linux/crc32c64.o}

in SynCrypto.pas.

Now the linker is happy again

Offline

#6 2021-04-26 09:22:16

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: linker issue under linux with static libs

It is weird, I don't have any such problem here...

Offline

#7 2021-04-26 09:25:31

danielkuettner
Member
From: Germany
Registered: 2014-08-06
Posts: 330

Re: linker issue under linux with static libs

And you are also mixing mORMot and mORMot2?

Offline

#8 2021-04-26 10:36:07

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,182
Website

Re: linker issue under linux with static libs

Oh no, you should never mix both of them in the same project!
There would be plenty of problems for sure - starting indeed with static linking issues.

Offline

#9 2021-04-26 10:46:22

danielkuettner
Member
From: Germany
Registered: 2014-08-06
Posts: 330

Re: linker issue under linux with static libs

You also shouldn't drink alcohol. But sometimes it's worth doing it.

Offline

#10 2021-04-26 12:05:36

tbo
Member
Registered: 2015-04-20
Posts: 335

Re: linker issue under linux with static libs

danielkuettner wrote:

You also shouldn't drink alcohol. But sometimes it's worth doing it.

Is it any wonder then if you wake up hung-over? wink

With best regards
Thomas

Offline

Board footer

Powered by FluxBB