Recent

Author Topic: Cannot linking project at MAC OS X  (Read 2846 times)

dmpozhidaev

  • Newbie
  • Posts: 2
Cannot linking project at MAC OS X
« on: November 24, 2019, 05:45:36 pm »
Hi

I try build some a Lazarus project at MAC OS and have no success at linking state

Compiler say about an error:
ld: library not found for -lmagic
An error occurred while linking
FreeShip.dpr(311,0) Error: Error while linking

libmagic is installed to /usr/local/lib
LD_LIBRARY_PATH is set too
May be I dont install correctly Lazarus?

The project is https://github.com/markmal/freeship-plus-in-lazarus
It is a nice program for small boat developers.

Please help me

Jonas Maebe

  • Hero Member
  • *****
  • Posts: 1059
Re: Cannot linking project at MAC OS X
« Reply #1 on: November 24, 2019, 05:57:19 pm »
LD_LIBRARY_PATH is never used by anything on macOS (and it's not used by the compiler to find libraries on other platforms either). Use the compiler's -Fl command line option to make it search a custom directory.

However, there is a bug in FPC 3.0.4 (and 3.0.4a) that breaks -Fl in combination with a non-empty -XR command line parameter, and on macOS 10.14 the default fpc.cfg configuration file contains this parameter because some files are no longer installed in the same location as on previous OS versions.

The easiest way to work around it is probably to pass "-XR -WM10.8" on the command line. This will
a) clear the custom sysroot (-XR parameter), so -Fl parameters work again
b) set the minimum required target version to macOS 10.8. In that case, the files that have been moved on macOS 10.14 are not required, which is why setting the -XR parameter to empty again won't cause troubles

You don't need an explicit -Fl/usr/local/lib in this case, because that directory is searched by default (when a custom sysroot is specified with -XR, the usr/local/lib directory under this sysroot is searched by default instead).

dmpozhidaev

  • Newbie
  • Posts: 2
Re: Cannot linking project at MAC OS X
« Reply #2 on: November 24, 2019, 08:54:14 pm »
Thank you very much for your very fast answer!
Project was linked! :)

 

TinyPortal © 2005-2018