[Lazarus] GTK3 widgets on macOS?

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

[Lazarus] GTK3 widgets on macOS?

Free Pascal - Lazarus mailing list
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

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] GTK3 widgets on macOS?

Free Pascal - Lazarus mailing list
Ryan Joseph via lazarus <[hidden email]> schrieb am Mo., 25. Nov. 2019, 19:37:
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 

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] GTK3 widgets on macOS?

Free Pascal - Lazarus mailing list


> On Nov 25, 2019, at 2:07 PM, Sven Barth via lazarus <[hidden email]> 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

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] GTK3 widgets on macOS?

Free Pascal - Lazarus mailing list
Ryan Joseph via lazarus <[hidden email]> schrieb am Mo., 25. Nov. 2019, 20:19:


> On Nov 25, 2019, at 2:07 PM, Sven Barth via lazarus <[hidden email]> 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 

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus
Reply | Threaded
Open this post in threaded view
|

Re: [Lazarus] GTK3 widgets on macOS?

Free Pascal - Lazarus mailing list


> On Nov 25, 2019, at 6:03 PM, Sven Barth via lazarus <[hidden email]> 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

--
_______________________________________________
lazarus mailing list
[hidden email]
https://lists.lazarus-ide.org/listinfo/lazarus