#1 2015-04-17 07:56:41

Thomas-Acia
Member
From: Metz (France)
Registered: 2015-04-16
Posts: 79

Error while linking

Hi,

I think a lot of us already had this error but I didn't find how to solve it.
When I compile with Windows, it works perfectly but with Linux, sometimes I have "Error: Error while linking".
So I don't know if it's a library problem or something else.

1429257190-sans-titre.png

Thank you !


Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits

Offline

#2 2015-04-17 08:45:17

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

Re: Error while linking

I never had this error.

You wrote that it occurred "sometimes"...
Pretty weird for a linking issue.

Try to recompile the .o using the .sh script, and change the .a files from our .7z using the files supplied with your distribution.

Offline

#3 2015-04-17 09:02:47

Thomas-Acia
Member
From: Metz (France)
Registered: 2015-04-16
Posts: 79

Re: Error while linking

For example, the Sample 1 of SQLite3 is working well.
But here, I tried the 21st and he didn't compile.

I just re-executed the script. Same result ..


I found this error on the Internet but nothing interesting for my case

Last edited by Thomas-Acia (2015-04-17 09:04:14)


Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits

Offline

#4 2015-04-17 10:41:20

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Error while linking

I can confirm this error.
When crosscompiling with CT5.3 from Windows to Linux ARM.
I will investigate further and report back.

Edit:
Happens also when compiling for Linux i386.

Common:
Static linking of (latest) sqlite gives this error.
Dynamic linking: all ok.

Last edited by AOG (2015-04-17 10:51:45)

Offline

#5 2015-04-17 14:24:11

Thomas-Acia
Member
From: Metz (France)
Registered: 2015-04-16
Posts: 79

Re: Error while linking

AOG wrote:

Edit:
Happens also when compiling for Linux i386.

Yes, I tried to compile for Linux i386 too.

AOG wrote:

Common:
Static linking of (latest) sqlite gives this error.
Dynamic linking: all ok.

I resolved my problem !

I add this : {$DEFINE NOSQLITE3STATIC} at the top of Synopse.inc

So, when I include Synopse.inc, it's working well.


Delphi 2010 - Delphi XE5 (x64 Apps) - CodeTyphon - Typhon IDE v 5.7 - FPC 3.1.1 - mORMot 1.18
Windows 7 - VirtualBox : Linux Debian 8.5 Jessie 32 bits

Offline

#6 2015-04-18 07:36:53

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Error while linking

Found the problem AND the solution !

On Linux, with FPC / CT you need this for servers (because they use threads)

{$DEFINE UseCThreads}

uses
{$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
{$ENDIF}{$ENDIF}

as first unit in your program uses statement !

Offline

#7 2015-04-18 08:07:27

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

Re: Error while linking

... as written in the documentation...
wink

http://synopse.info/files/html/Synopse% … l#TITL_143

Offline

#8 2015-04-19 11:53:51

AOG
Member
Registered: 2014-02-24
Posts: 490

Re: Error while linking

Sure !

Can we cut a deal here ?

If you add this

{$ifdef FPC} // we may be on Kylix or upcoming Delphi for Linux
  {$ifdef Unix} // we may also be on Darwin / OSX
  // if you use threads: always needed for servers
  cthreads,
  // widestring manager if needed !!
  // could also be put in another unit ... but doc states: as early as possible
  cwstring, // optional
  {$endif}
{$endif}

into all the server sample dpr files,
then I promise I will (try to) make the Lazarus lpi files for these samples to run out-of-the-box !

cool

Offline

#9 2015-04-19 17:08:19

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

Re: Error while linking

I've updated SynDprUses.inc to set cthreads and cwstring units for FPC
- also included SynDprUses.inc in all samples .dpr uses clause.
See http://synopse.info/fossil/info/af455043fb

I think it is the easiest to manage compiler-specific units at .dpr level.

Hope it helps!
smile

Offline

Board footer

Powered by FluxBB