Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / lazarus / 2019-11

GTK3 widgets on macOS?

5 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Ryan Joseph

Is it possible to build projects using the GTK3 widget set while on Mac? I know GTK3 is cross platform itself so it should be possible to use this instead of the Cocoa widgets right?

I try to build and I get pretty far until there is a linker error looking for a .so file:

Error: ld: library not found for -lgtk-3.so.0

On macOS I would expect this to be a framework, not a .so file. Any ideas?

Regards,
Ryan Joseph

Reply by email

Sven Barth
to Ryan Joseph

Ryan Joseph via lazarus schrieb am Mo., 25.
Nov. 2019, 19:37:

Show quoted text 11 lines
Is it possible to build projects using the GTK3 widget set while on Mac? I know GTK3 is cross platform itself so it should be possible to use this instead of the Cocoa widgets right? I try to build and I get pretty far until there is a linker error looking for a .so file: Error: ld: library not found for -lgtk-3.so.0 On macOS I would expect this to be a framework, not a .so file. Any ideas?

You'll likely expect wrong considering that GTK is rather Unix centric and doesn't like to deal with the platformisms of other platforms (both Windows and macOS).
You'll likely have to look for a libgtk.3.dylib or so and you'll need to adjust the import library names in the GTK3 units.

Regards,
Sven

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20191125/355f23c9/attachment.html>

Reply by email

Ryan Joseph
to Sven Barth
Show quoted text 5 lines
On Nov 25, 2019, at 2:07 PM, Sven Barth via lazarus wrote: You'll likely expect wrong considering that GTK is rather Unix centric and doesn't like to deal with the platformisms of other platforms (both Windows and macOS). You'll likely have to look for a libgtk.3.dylib or so and you'll need to adjust the import library names in the GTK3 units.

I see in LazGdk3.pas there is a $LINKLIB line which is wrong. On my system at /usr/local/Cellar/gtk+3/3.24.5/lib there is a libgtk-3.dylib which I can link to. I changde these to this:

{$LINKLIB libgtk-3.dylib}
{$LINKLIB libgdk-3.dylib}

I then added -Fl/usr/local/Cellar/gtk+3/3.24.5/lib to the command line but I still get a linker error "Error: ld: library not found for -lgtk-3"

For proof:

ls /usr/local/Cellar/gtk+3/3.24.5/lib
girepository-1.0 libgailutil-3.dylib libgtk-3.0.dylib gtk-3.0 libgdk-3.0.dylib libgtk-3.dylib libgailutil-3.0.dylib libgdk-3.dylib pkgconfig

Is that not correct?

Regards,
Ryan Joseph

Reply by email

Sven Barth
to Ryan Joseph

Ryan Joseph via lazarus schrieb am Mo., 25.
Nov. 2019, 20:19:

Show quoted text 31 lines
> On Nov 25, 2019, at 2:07 PM, Sven Barth via lazarus < > wrote: > > You'll likely expect wrong considering that GTK is rather Unix centric and doesn't like to deal with the platformisms of other platforms (both Windows and macOS). > You'll likely have to look for a libgtk.3.dylib or so and you'll need to adjust the import library names in the GTK3 units. > I see in LazGdk3.pas there is a $LINKLIB line which is wrong. On my system at /usr/local/Cellar/gtk+3/3.24.5/lib there is a libgtk-3.dylib which I can link to. I changde these to this: {$LINKLIB libgtk-3.dylib} {$LINKLIB libgdk-3.dylib} I then added -Fl/usr/local/Cellar/gtk+3/3.24.5/lib to the command line but I still get a linker error "Error: ld: library not found for -lgtk-3" For proof: ls /usr/local/Cellar/gtk+3/3.24.5/lib girepository-1.0 libgailutil-3.dylib libgtk-3.0.dylib gtk-3.0 libgdk-3.0.dylib libgtk-3.dylib libgailutil-3.0.dylib libgdk-3.dylib pkgconfig Is that not correct?

Should be. 🤔

Would you please compile with -sh option which will generate a ppas.sh file (I think) in the output directory (I think as well) which will contain the command line the linker will be called with and check that? Maybe you can then pass some verbosity switch to the linker to find out what goes wrong...

Regards,
Sven

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20191126/9d031a48/attachment-0001.html>

Reply by email

Ryan Joseph
to Sven Barth
Show quoted text 6 lines
On Nov 25, 2019, at 6:03 PM, Sven Barth via lazarus wrote: Should be. 🤔 Would you please compile with -sh option which will generate a ppas.sh file (I think) in the output directory (I think as well) which will contain the command line the linker will be called with and check that? Maybe you can then pass some verbosity switch to the linker to find out what goes wrong...

Maybe I'm just doing Lazarus wrong. It appears -sh is already enabled because I get a ppaslink.sh.

#!/bin/sh
DoExitAsm ()
{ echo "An error occurred while assembling $1"; exit 1; } DoExitLink ()
{ echo "An error occurred while linking $1"; exit 1; } OFS=$IFS
IFS="
"
/usr/bin/ld /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/lib/crt1.10.5.o -multiply_defined suppress -L. -o /Users/ryanjoseph/Desktop/lazgtktest/project1 `cat /Users/ryanjoseph/Desktop/lazgtktest/link.res` if [ $? != 0 ]; then DoExitLink ; fi
IFS=$OFS

Here's the full command line copied from Lazarus.

/usr/local/bin/fpc
-MObjFPC
-Scghi
-O1
-gw
-gl
-l
-vewnhibq
-Filib/x86_64-darwin
-Fl/usr/local/Cellar/gtk+3/3.24.5/lib
-Fu../../Developer/lazarus/lcl/units/x86_64-darwin/gtk3 -Fu../../Developer/lazarus/lcl/units/x86_64-darwin -Fu../../Developer/lazarus/components/lazutils/lib/x86_64-darwin -Fu../../Developer/lazarus/packager/units/x86_64-darwin -Fu.
-FUlib/x86_64-darwin
-FE.
-oproject1
-dLCL
-dLCLgtk3

Regards,
Ryan Joseph

Reply by email