Recent

Author Topic: [Solved] Help with linking error  (Read 9986 times)

VTwin

  • Hero Member
  • *****
  • Posts: 1227
  • Former Turbo Pascal 3 user
[Solved] Help with linking error
« on: January 09, 2014, 02:54:26 pm »
Hello,

I am trying to get working versions of several programs on Linux. These programs work well on both Mac and Windows Lazarus distributions. I am starting with Ubuntu 12.04 Desktop 64 bit, using the Lazarus amd64 distribution:

fpc_2.6.2-0_amd64.deb
fpc-src_2.6.2-0_amd64.deb
lazarus_1.0.14-0_amd64.deb

running on Mac OS 10.6.8 in a Parallels 7 virtual machine. I am able to compile and run the default Lazarus "hello" application, however when I attempt to compile one of my programs, I get the following errors:

Code: [Select]
Note: DWARF debug information cannot be used with smart linking on this target, switching to static linking
/usr/bin/ld: unrecognised emulation mode: acosx_version_min
Supported emulations: elf_x86_64 elf32_x86_64 elf_i386 i386linux elf_l1om elf_k1om
PicTracker.lpr(26,1) Error: Error while linking
PicTracker.lpr(26,1) Fatal: There were 1 errors compiling module, stopping

I am not sure what this means, or where to begin tracking down this error. Any assistance would be greatly appreciated.

Cheers,
Frederick
« Last Edit: January 09, 2014, 10:28:52 pm by Frederick »
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 15.3.2: Lazarus 3.8 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 3.8 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 3.8 (64 bit on VBox)

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Help with linking error
« Reply #1 on: January 09, 2014, 02:59:07 pm »
My guess: in project options you probably set widgetset etc to an OSX widgetset like Cocoa or Carbon. Other options are target OS or processor.
You can try adding a new build mode with gtk widgetset, or removing the explicit widgetset (etc) selection and choosing default.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

VTwin

  • Hero Member
  • *****
  • Posts: 1227
  • Former Turbo Pascal 3 user
Re: Help with linking error
« Reply #2 on: January 09, 2014, 03:19:01 pm »
Thanks BigChimp,

In Compiler Options, if I click on the link "Select another LCL widget set (macro LCLWidgetType)". There is no explicit LCLWidgetType set. The Mac build uses the default Carbon, and Windows is also default.

I just tried setting LCLWidgetType to gtk, and get the same error message. Also with gtk2.

Cheers,
Frederick
« Last Edit: January 09, 2014, 03:25:22 pm by Frederick »
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 15.3.2: Lazarus 3.8 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 3.8 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 3.8 (64 bit on VBox)

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: Help with linking error
« Reply #3 on: January 09, 2014, 04:13:28 pm »
Hmmm, no more spontaneous ideas. If the project is not confidential, you could publish the project (project/publish project) to a new directory so you only have source code files there, zip it up and add it to a post.

Will be glad to have a look on Windows and perhaps a Linux VM for you.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

VTwin

  • Hero Member
  • *****
  • Posts: 1227
  • Former Turbo Pascal 3 user
Re: Help with linking error
« Reply #4 on: January 09, 2014, 05:12:55 pm »
Thanks BigChimp,

That is a very kind offer! The code is not open source, but not especially confidential. I will try compiling a couple of the other projects and see if that gives me any leads. The "acosx_version_min" leads me to suspect a math library incompatibility, but that is just a hunch.

I have working Mac and Windows versions, the Windows version I compile using Parallels 7 and a XP virtual machine. No problems there.

I'll report back on any progress, hopefully today, and then may take you up on your offer.

Many thanks!

Cheers,
Frederick

“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 15.3.2: Lazarus 3.8 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 3.8 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 3.8 (64 bit on VBox)

VTwin

  • Hero Member
  • *****
  • Posts: 1227
  • Former Turbo Pascal 3 user
Re: Help with linking error
« Reply #5 on: January 09, 2014, 09:14:17 pm »
BigChimp,

I found my error after a bit of poking around. I had set the compiler "Custom option" to include:

-k-macosx_version_min -k10.5
-XR/Developer/SDKs/MacOSX10.5.sdk/

and also had the conditional macro:

if TargetOS = 'darwin' then begin
  UsageCustomOptions += ' -k-macosx_version_min -k10.5';
  UsageCustomOptions += ' -XR/Developer/SDKs/MacOSX10.5.sdk/';
end;   

The Windows compiler ignored both, but the Linux compiler tried to interpret the custom options, hence the mystery error: acosx_version_min, which I misinterpreted as a math library link problem.  :-[

Deleting those two lines from the custom options solved the problem. The program is compiling and running now, so I just need to tweak the code a bit now.

Many thanks!

Cheers,
Frederick
 
“Talk is cheap. Show me the code.” -Linus Torvalds

Free Pascal Compiler 3.2.2
macOS 15.3.2: Lazarus 3.8 (64 bit Cocoa M1)
Ubuntu 18.04.3: Lazarus 3.8 (64 bit on VBox)
Windows 7 Pro SP1: Lazarus 3.8 (64 bit on VBox)

BigChimp

  • Hero Member
  • *****
  • Posts: 5740
  • Add to the wiki - it's free ;)
    • FPCUp, PaperTiger scanning and other open source projects
Re: [Solved] Help with linking error
« Reply #6 on: January 10, 2014, 11:37:30 am »
Well, I can understand why you were thanking maths ;)

Glad you got it sorted out!

note:  (yes, Captain Obvious here)
Code: [Select]
if TargetOS = 'darwin' then begin
  UsageCustomOptions += ' -k-macosx_version_min -k10.5';
  UsageCustomOptions += ' -XR/Developer/SDKs/MacOSX10.5.sdk/';
end;
should explicitly test for OSX so shouldn't be a factor. It's probably the recommended way to make sure your project remains cross platform.
Want quicker answers to your questions? Read http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way_to_ask_questions_in_the_forum.3F

Open source including papertiger OCR/PDF scanning:
https://bitbucket.org/reiniero

Lazarus trunk+FPC trunk x86, Windows x64 unless otherwise specified

 

TinyPortal © 2005-2018