Recent

Author Topic: Error while linking  (Read 4170 times)

Arvur

  • New Member
  • *
  • Posts: 48
    • My GitHub
Error while linking
« on: November 09, 2017, 01:26:10 pm »
I'm trying to compile shared library under Mac OS X El Captain and receive
Code: Pascal  [Select][+][-]
  1. (9015) Linking /Users/Administrator/Projects/Tokens/bin/libnpbssplugin.dylib
  2. ld: illegal text-relocation to '_$NPPLUGIN$_Ld4' in /Users/Administrator/Projects/Tokens/dcu/i386-darwin/NPPlugin.o from '_NPPLUGIN_$$_HANDLENPNEXCEPTION$ANSISTRING$EXCEPTION' in /Users/Administrator/Projects/Tokens/dcu/i386-darwin/NPPlugin.o for architecture i386
  3. An error occurred while linking
  4. npBSSPlugin.dpr(192) Error: (9013) Error while linking
  5.  

I've found similar problem here:
Quote
just add other link flag:
Code: Pascal  [Select][+][-]
  1. -read_only_relocs suppress

But I don't see how to pass this flag to linker. Any solutions? Thanks!

P.S. Lazarus 1.6.4, FPC 3.0.2

Eugene Loza

  • Hero Member
  • *****
  • Posts: 663
    • My games in Pascal
Re: Error while linking
« Reply #1 on: November 09, 2017, 02:31:19 pm »
Quote
how to pass this flag to linker
see attached screenshoot. Project - Project Options - Custom Options - Custom Options field
However
Quote
Error while linking
problem may be also caused by recent Linux-related FPC 3.0.2 packaging bug. Try newer Lazarus&FPC version, e.g. 1.8RC5+FPC3.0.4.
My FOSS games in FreePascal&CastleGameEngine: https://decoherence.itch.io/ (Sources: https://gitlab.com/EugeneLoza)

Arvur

  • New Member
  • *
  • Posts: 48
    • My GitHub
Re: Error while linking
« Reply #2 on: November 10, 2017, 09:15:50 am »
I suppose linker param should be passed this way (see screenshot). But it says space is delimiter - so I cannot put flag to param.

[SOLVED] The problem was in -Cg- option. Linker failed without PIC code.

To look deeper:
Option -Cg- was used to compile some asm-code (it produced error "PIC-safe...").
But Delphi XE6 compiled this code for Mac OS without error. So asm itself is Ok.
Moreover! Lazarus compiled this code on Linux perfectly.

Maybe I should make some short sample for bugtracker?

 

TinyPortal © 2005-2018