Recent

Author Topic: ld: library 'gtk-3' not found  (Read 596 times)

gferluga

  • Newbie
  • Posts: 2
ld: library 'gtk-3' not found
« on: March 26, 2025, 11:39:39 am »
Hello community:

I'm on MacBook ARM M2 and trying to compile a simple program.
This is the command line:

fpc -B -O2 -FEbin -Mdelphi -Fusrc/fpcunits src/ti99.pas -obin/emul99 -k-lgtk-3 -k-lcairo -k-lglib-2.0

I'm getting a GTK3 library not found issue.

Assembling ti99
Linking bin/emul99
ld: warning: -multiply_defined is obsolete
-macosx_version_min has been renamed to -macos_version_min
ld: library 'gtk-3' not found
An error occurred while linking
ti99.pas(310,31) Error: Error while linking
ti99.pas(310,31) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /opt/homebrew/bin/ppca64 returned an error exitcode

GTK3 has bee installed via brew install gtk+3 pygobject3

Please advise and thanks in advance.

Thaddy

  • Hero Member
  • *****
  • Posts: 16812
  • Ceterum censeo Trump esse delendam
Re: ld: library 'gtk-3' not found
« Reply #1 on: March 26, 2025, 12:17:28 pm »
Leave the default widgetset alone: on mac do not compile for gtk3.
(unless you use trunk from today, you can't use gtk3 on mac nor on may other platforms wth the current release, it is also stupid)

May I ask why you want gtk3? (this time without using expletives)
You may have a valid reason...
I can test on a mini M4 for you.
« Last Edit: March 26, 2025, 12:20:55 pm by Thaddy »
Changing servers. thaddy.com may be temporary unreachable but restored when the domain name transfer is done.

gferluga

  • Newbie
  • Posts: 2
Re: ld: library 'gtk-3' not found
« Reply #2 on: March 26, 2025, 12:46:56 pm »
Thank you for your quick reply  :D

This is what I found in the distribution scripts.
https://github.com/statpascal/emul99.git

The original development was done on Linux.

Thx.

Thaddy

  • Hero Member
  • *****
  • Posts: 16812
  • Ceterum censeo Trump esse delendam
Re: ld: library 'gtk-3' not found
« Reply #3 on: March 26, 2025, 01:09:03 pm »
No my core question is : why gtk-3?
Because that is a) not a default on mac and b)with a default Laz 3/4 unstable/not working.
If you do not specify a widgetset Laz will work perfectly fine on an M4, so also on an M2 like yours.
Note I am always using trunk, so there are cases where I am wrong.
« Last Edit: March 26, 2025, 01:12:57 pm by Thaddy »
Changing servers. thaddy.com may be temporary unreachable but restored when the domain name transfer is done.

Nimbus

  • New Member
  • *
  • Posts: 30
Re: ld: library 'gtk-3' not found
« Reply #4 on: March 26, 2025, 01:56:12 pm »
As I understand this has nothing to do with Lazarus or its widgeset at all. The man is trying to build a program, which externs to libgtk3 (and libsdl2, and libc) in its units. No LCL.

gferluga,
There are a few things to keep in mind:
  • The project is clearly designed for linux, you can see it has depencency library names hard-coded as 'libgtk-3.so', 'libgobject-2.0.so', 'libSDL2.so'. For macos, you usually need shared libraries with .dylib extension, not .so. Moreower, they need to match the architecture of your system (aarch64 in case of Apple M2).
  • If you got those dylib files installed somewhere, you need to tell the compiler where it can find them, using the -Fl<path> key
  • If I remember correctly, in macos FPC also requires $LINKLIB directive for each of linked libraries, e.g. {$LINKLIB SDL2}
  • For the compiled program to run, the dylibs also must be in a location known to the OS, so that they can be loaded.
There's really no guarantee this will work anyway, but you can give it a try. Hope that helps.

Thaddy

  • Hero Member
  • *****
  • Posts: 16812
  • Ceterum censeo Trump esse delendam
Re: ld: library 'gtk-3' not found
« Reply #5 on: March 26, 2025, 05:56:23 pm »
Hope that helps.
No. Ill informed regarding the issue at hand and complicating things.
You should listen either to me or better Zejlko who is working his ass of to make it work and examine the commits in the Lazarus repository.
You did not do that.
Anyway on the M platform, why gtk3? Makes no sense.
So my question stands... Why gtk3? You should use the default for the platform because of a uniform GUI across applications.
« Last Edit: March 26, 2025, 06:01:21 pm by Thaddy »
Changing servers. thaddy.com may be temporary unreachable but restored when the domain name transfer is done.

zeljko

  • Hero Member
  • *****
  • Posts: 1735
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: ld: library 'gtk-3' not found
« Reply #6 on: March 26, 2025, 07:10:52 pm »
Hello community:

I'm on MacBook ARM M2 and trying to compile a simple program.
This is the command line:

fpc -B -O2 -FEbin -Mdelphi -Fusrc/fpcunits src/ti99.pas -obin/emul99 -k-lgtk-3 -k-lcairo -k-lglib-2.0

I'm getting a GTK3 library not found issue.

Assembling ti99
Linking bin/emul99
ld: warning: -multiply_defined is obsolete
-macosx_version_min has been renamed to -macos_version_min
ld: library 'gtk-3' not found
An error occurred while linking
ti99.pas(310,31) Error: Error while linking
ti99.pas(310,31) Fatal: There were 1 errors compiling module, stopping
Fatal: Compilation aborted
Error: /opt/homebrew/bin/ppca64 returned an error exitcode

GTK3 has bee installed via brew install gtk+3 pygobject3

Please advise and thanks in advance.
Have you installed gtk3 dev packages ? I assume not.

 

TinyPortal © 2005-2018