#1 2022-04-27 02:13:46

scutlemon
Member
Registered: 2022-04-18
Posts: 13

Linux Lazarus mORMot linking error 2

Dear ,
    I have erorr such as https://synopse.info/forum/viewtopic.php?id=4863 .

    my lpr file as :
uses
{$I SynDprUses.inc}


    I run command :  fpc.exe -Tlinux -Px86_64 -MObjFPC -Scghi -Cg -O1 -l -vewnhibq ........ blackir_test5 blackir.lpr
    reply error : 
        blackir.lpr(64,1) Error: () Error while linking
        blackir.lpr(64,1) Fatal: (10026) There were 1 errors compiling module, stopping


     then I follow the above methods (https://synopse.info/forum/viewtopic.php?id=4863)  and add the following to the LPR file:
uses
  {$IFDEF UNIX}
  cthreads,
  {$ENDIF}

{$I SynDprUses.inc}


    The following error is :
        SynDprUses.inc(4,15) Error: (5002) Duplicate identifier "CTHREADS"
        blackir.lpr(10,42) Error: (5002) Duplicate
        blackir.lpr(10,42) Hint: (5003) Identifier already defined in unit BLACKIR: blackir.lpr at line 5


     I see there error cthreads had in SynDprUses.inc.

     What can I do for it ?
     Thanks a lot.

Offline

#2 2022-04-27 08:02:45

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

Re: Linux Lazarus mORMot linking error 2

I am not able to reproduce it here - I use Linux as main target since years with no problem.

Which FPC version are you using?
Are you sure you got the latest mORMot source code, and the latest associated static files?

Offline

#3 2022-04-27 11:24:26

scutlemon
Member
Registered: 2022-04-18
Posts: 13

Re: Linux Lazarus mORMot linking error 2

I think I had mixing mORMot with mORMot2(look like  https://synopse.info/forum/viewtopic.php?id=5856).

    The original code is estimated to be mormot, which can be normally compiled to Linux programs.

    And then I added code and used JWT function, which can run in Delphi environment.

Now there is a problem with complie. Error report after adjustment:
C:\lazarus32\ccr\mORMot\static\x86_64-linux\..\..\static\x86_64-linux\sha512-x64sse4.o: In function `sha512_sse4':
sha512_sse4.asm:(.text+0x0): multiple definition of `sha512_sse4'
C:\lazarus32\ccr\mORMot\static\x86_64-linux\sha512-x64sse4.o:sha512_sse4.asm:(.text+0x0): first defined here
C:\lazarus32\ccr\mORMot\static\x86_64-linux\..\..\static\x86_64-linux\crc32c64.o: In function `crc32_iscsi_01':
z:\Temp\crc//crc32_iscsi_01.asm:91: multiple definition of `crc32_iscsi_01'
C:\lazarus32\ccr\mORMot\static\x86_64-linux\crc32c64.o:z:\Temp\crc//crc32_iscsi_01.asm:91: first defined here
C:\lazarus32\ccr\mORMot\static\x86_64-linux\..\..\static\x86_64-linux\crc32c64.o: In function `crc32_iscsi_01_slver_01030015':
z:\Temp\crc//crc32_iscsi_01.asm:571: multiple definition of `crc32_iscsi_01_slver_01030015'
C:\lazarus32\ccr\mORMot\static\x86_64-linux\crc32c64.o:z:\Temp\crc//crc32_iscsi_01.asm:571: first defined here
C:\lazarus32\ccr\mORMot\static\x86_64-linux\..\..\static\x86_64-linux\crc32c64.o: In function `crc32_iscsi_01_slver_01030015':
z:\Temp\crc//crc32_iscsi_01.asm:571: multiple definition of `crc32_iscsi_01_slver'
C:\lazarus32\ccr\mORMot\static\x86_64-linux\crc32c64.o:z:\Temp\crc//crc32_iscsi_01.asm:571: first defined here
C:\e\SS2\SysDataManager\mymormot_test\lib\x86_64-linux\mormot.crypt.ecc256r1.o: In function `MORMOT.CRYPT.ECC256R1_$$_GETRANDOMNUMBER$THASH256$$LONGINT':
mormot.crypt.ecc256r1.pas:(.text.n_mormot.crypt.ecc256r1_$$_getrandomnumber$thash256$$longint+0x0): multiple definition of `getRandomNumber'
C:\e\SS2\SysDataManager\mymormot_test\lib\x86_64-linux\SynEcc.o:SynEcc.pas:(.text.n_synecc_$$_getrandomnumber$thash256$$longint+0x0): first defined here
C:\lazarus32\ccr\mORMot\static\x86_64-linux\..\..\static\x86_64-linux\ecclin64O2.o: In function `ecc_make_key':
/home/user/lib/ecc/ecc.c:1003: multiple definition of `ecc_make_key'
C:\lazarus32\ccr\mORMot\static\x86_64-linux\ecclin64O2.o:/home/user/lib/ecc/ecc.c:1003: first defined here
C:\lazarus32\ccr\mORMot\static\x86_64-linux\..\..\static\x86_64-linux\ecclin64O2.o: In function `ecdh_shared_secret':
/home/user/lib/ecc/ecc.c:1036: multiple definition of `ecdh_shared_secret'
C:\lazarus32\ccr\mORMot\static\x86_64-linux\ecclin64O2.o:/home/user/lib/ecc/ecc.c:1036: first defined here
C:\lazarus32\ccr\mORMot\static\x86_64-linux\..\..\static\x86_64-linux\ecclin64O2.o: In function `ecdsa_sign':
/home/user/lib/ecc/ecc.c:1130: multiple definition of `ecdsa_sign'
C:\lazarus32\ccr\mORMot\static\x86_64-linux\ecclin64O2.o:/home/user/lib/ecc/ecc.c:1130: first defined here
C:\lazarus32\ccr\mORMot\static\x86_64-linux\..\..\static\x86_64-linux\ecclin64O2.o: In function `ecdsa_verify':
/home/user/lib/ecc/ecc.c:1177: multiple definition of `ecdsa_verify'
C:\lazarus32\ccr\mORMot\static\x86_64-linux\ecclin64O2.o:/home/user/lib/ecc/ecc.c:1177: first defined here
C:\e\SS2\SysDataManager\mymormot_test\blackir.lpr(66,1) Error: (9013) Error while linking
C:\e\SS2\SysDataManager\mymormot_test\blackir.lpr(66,1) Fatal: (10026) There were 1 errors compiling module, stopping
Fatal: (1018) Compilation aborted
Error: C:\lazarus32\fpcupdeluxe\fpc\bin\i386-win32\ppcrossx64.exe returned an error exitcode

    Whether the code needs to be adjusted to mormot2. Is it upward compatible?

    thanks  .

Offline

#4 2022-04-27 15:36:16

scutlemon
Member
Registered: 2022-04-18
Posts: 13

Re: Linux Lazarus mORMot linking error 2

I had disable any definition . Then , The rest report errors :
C:\e\SS2\SysDataManager\mymormot_test\lib\x86_64-linux\mormot.crypt.ecc256r1.o: In function `MORMOT.CRYPT.ECC256R1_$$_GETRANDOMNUMBER$THASH256$$LONGINT':
mormot.crypt.ecc256r1.pas:(.text.n_mormot.crypt.ecc256r1_$$_getrandomnumber$thash256$$longint+0x0): multiple definition of `getRandomNumber'
C:\e\SS2\SysDataManager\mymormot_test\lib\x86_64-linux\SynEcc.o:SynEcc.pas:(.text.n_synecc_$$_getrandomnumber$thash256$$longint+0x0): first defined here
C:\e\SS2\SysDataManager\mymormot_test\blackir.lpr(66,1) Error: (9013) Error while linking
C:\e\SS2\SysDataManager\mymormot_test\blackir.lpr(66,1) Fatal: (10026) There were 1 errors compiling module, stopping
Fatal: (1018) Compilation aborted
Error: C:\lazarus32\fpcupdeluxe\fpc\bin\i386-win32\ppcrossx64.exe returned an error exitcode

It is like mormot.crypt.ecc256r1.o and SynEcc.o has same _getrandomnumber.  But I can not modify o file. sad

What can I do ?

Offline

#5 2022-04-28 02:48:34

scutlemon
Member
Registered: 2022-04-18
Posts: 13

Re: Linux Lazarus mORMot linking error 2

It is not use mormot.crypt.jwt  in the old code .  above error is reported after use mormot.crypt.jwt.

C:\e\SS2\SysDataManager\mymormot_test\lib\x86_64-linux\mormot.crypt.ecc256r1.o: In function `MORMOT.CRYPT.ECC256R1_$$_GETRANDOMNUMBER$THASH256$$LONGINT':
mormot.crypt.ecc256r1.pas:(.text.n_mormot.crypt.ecc256r1_$$_getrandomnumber$thash256$$longint+0x0): multiple definition of `getRandomNumber'
C:\e\SS2\SysDataManager\mymormot_test\lib\x86_64-linux\SynEcc.o:SynEcc.pas:(.text.n_synecc_$$_getrandomnumber$thash256$$longint+0x0): first defined here
C:\e\SS2\SysDataManager\mymormot_test\blackir.lpr(66,1) Error: (9013) Error while linking
C:\e\SS2\SysDataManager\mymormot_test\blackir.lpr(66,1) Fatal: (10026) There were 1 errors compiling module, stopping
Fatal: (1018) Compilation aborted
Error: C:\lazarus32\fpcupdeluxe\fpc\bin\i386-win32\ppcrossx64.exe returned an error exitcode


Is there any way to remove this multiple definition?

Offline

#6 2022-04-28 06:54:11

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

Re: Linux Lazarus mORMot linking error 2

Your project is clearly mixing mORMot 1 and mORMot 2 units: SynEcc is mORMot 1, and mormot.crypt.ecc256r1 is mORmot 2.

Fix your project to use only mORMot 2 units.

Offline

#7 2022-04-28 09:28:29

scutlemon
Member
Registered: 2022-04-18
Posts: 13

Re: Linux Lazarus mORMot linking error 2

I think so.
I'll try modify it.
I'm not sure how to modify it.
Thanks.

Offline

#8 2022-12-11 09:50:10

scutlemon
Member
Registered: 2022-04-18
Posts: 13

Re: Linux Lazarus mORMot linking error 2

ab wrote:

Your project is clearly mixing mORMot 1 and mORMot 2 units: SynEcc is mORMot 1, and mormot.crypt.ecc256r1 is mORmot 2.

Fix your project to use only mORMot 2 units.

How can I get  or download the mORMot 2 units ?

Offline

#9 2022-12-11 10:14:55

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

Re: Linux Lazarus mORMot linking error 2

https://github.com/synopse/mORMot2#quick-start

Download the last release from https://github.com/synopse/mORMot2/releases
and unzip the source and the statics into a folder.

Then install the mormot2 package in Lazarus.

On Lazarus, use packages, and set the package as dependency on your project(s).
There are mormot1 and mormot2 packages, so if you do so, you won't mix sources.

Offline

#10 2022-12-11 11:43:18

scutlemon
Member
Registered: 2022-04-18
Posts: 13

Re: Linux Lazarus mORMot linking error 2

thank you very much . I will try it .

Offline

#11 2022-12-12 11:43:19

scutlemon
Member
Registered: 2022-04-18
Posts: 13

Re: Linux Lazarus mORMot linking error 2

Hello , I meet a error , and hope get the help . thanks .
I run fpc.exe , but return Error: (9016) Util x86_64-linux-ld.exe not found, switching to external linking. The x86_64-linux-ld.exe file is in x86_64-linux direction. How can it run ?

I run the command is : C:\e\lazarus32\fpcupdeluxe\fpc\bin\i386-win32\fpc.exe -Tlinux -Px86_64 -MObjFPC -Scghi -Cg -O1 -l -vewnhibq -FiD:\demo\y\code\blackir\mymormot\lib\x86_64-linux\ -FiC:\e\SS2\ziliao\net\mormot2 -FuD:\demo\y\com\mORMot2-sqlite.3.38.1\src\core\ -FuD:\demo\y\com\mORMot2-sqlite.3.38.1\src\crypt\ -FuD:\demo\y\code\blackir\mymormot\jiekou -FUD:\demo\y\code\blackir\mymormot\lib\x86_64-linux\ -FED:\demo\y\code\blackir\mymormot\ -oD:\demo\y\code\blackir\mymormot\blackir_test6 blackir.lpr

output is :
Hint: (11030) Start of reading config file C:\e\lazarus32\fpcupdeluxe\fpc\bin\i386-win32\fpc.cfg
Hint: (11031) End of reading config file C:\e\lazarus32\fpcupdeluxe\fpc\bin\i386-win32\fpc.cfg
Free Pascal Compiler version 3.2.1-r48511 [2021/02/05] for x86_64
Copyright (c) 1993-2020 by Florian Klaempfl and others
(1002) Target OS: Linux for x86-64
(3104) Compiling blackir.lpr
D:\demo\y\code\blackir\mymormot\blackir.lpr(5,28) Hint: (5023) Unit "uSendMail" not used in blackir
D:\demo\y\code\blackir\mymormot\blackir.lpr(5,39) Hint: (5023) Unit "offlinefile" not used in blackir
D:\demo\y\code\blackir\mymormot\blackir.lpr(5,52) Hint: (5023) Unit "DePrtCoderEx" not used in blackir
D:\demo\y\code\blackir\mymormot\blackir.lpr(64,1) Warning: (9011) Object .\static\x86_64-linux\sqlite3.o not found, Linking may fail !
D:\demo\y\code\blackir\mymormot\blackir.lpr(64,1) Warning: (9012) Library libgcc.a not found, Linking may fail !
D:\demo\y\code\blackir\mymormot\blackir.lpr(64,1) Warning: (9011) Object static\x86_64-linux\sha512-x64sse4.o not found, Linking may fail !
D:\demo\y\code\blackir\mymormot\blackir.lpr(64,1) Warning: (9011) Object static\x86_64-linux\crc32c64.o not found, Linking may fail !
D:\demo\y\code\blackir\mymormot\blackir.lpr(64,1) Warning: (9011) Object static\x86_64-linux\ecclin64O2.o not found, Linking may fail !
D:\demo\y\code\blackir\mymormot\blackir.lpr(64,1) Warning: (9011) Object ..\..\static\x86_64-linux\sha512-x64sse4.o not found, Linking may fail !
D:\demo\y\code\blackir\mymormot\blackir.lpr(64,1) Warning: (9011) Object ..\..\static\x86_64-linux\crc32c64.o not found, Linking may fail !
(9015) Linking D:\demo\y\code\blackir\mymormot\blackir_test6
D:\demo\y\code\blackir\mymormot\blackir.lpr(64,1) Warning: (9034) "crti.o" not found, this will probably cause a linking failure
D:\demo\y\code\blackir\mymormot\blackir.lpr(64,1) Warning: (9034) "crtbeginS.o" not found, this will probably cause a linking failure
D:\demo\y\code\blackir\mymormot\blackir.lpr(64,1) Warning: (9034) "crtendS.o" not found, this will probably cause a linking failure
D:\demo\y\code\blackir\mymormot\blackir.lpr(64,1) Warning: (9034) "crtn.o" not found, this will probably cause a linking failure
D:\demo\y\code\blackir\mymormot\blackir.lpr(64,1) Error: (9016) Util x86_64-linux-ld.exe not found, switching to external linking
D:\demo\y\code\blackir\mymormot\blackir.lpr(64,1) Fatal: (10026) There were 1 errors compiling module, stopping
Fatal: (1018) Compilation aborted
Error: C:\e\lazarus32\fpcupdeluxe\fpc\bin\i386-win32\ppcrossx64.exe returned an error exitcode

Last edited by scutlemon (2022-12-12 11:44:18)

Offline

#12 2022-12-12 13:29:46

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

Re: Linux Lazarus mORMot linking error 2

Use the mORMot package, as I wrote.
Your paths are not correct, especially about the static files.

Please follow the forum rules, and don't post such console output into a thread, but use a gist.

Offline

Board footer

Powered by FluxBB