-
Notifications
You must be signed in to change notification settings - Fork 12
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MacOS cannot find libadwaita #167
Comments
It seems like the shared library file is missing. From the pkg-config output I would assume that it is supposed to be in |
The dynlib is in that location, so I am assuming this is correct? (I am on Apple Silicon, so not sure if that's relevant or not here.) Contents of /opt/homebrew/Cellar/libadwaita/1.5.2/lib
I have not tried using gcc to link anything as this is my first foray into GTK. |
Alright, I tested with a sample Adwaita program (below) in plain C. The program compiled and ran fine with the following compile command: gcc $(pkg-config --cflags libadwaita-1) -o libadwaitatest-0 libadwaitatest-0.c $(pkg-config --libs libadwaita-1) However, the nim compiler uses clang. On MacOS, gcc is kind of a "wrapper" for clang so I don't think this is the issue, but I thought I'd bring it up. Here is the test program I compiled and ran (libadwaitatest-0.c): #include <adwaita.h>
static void
activate_cb (GtkApplication *app)
{
GtkWidget *window = gtk_application_window_new (app);
GtkWidget *label = gtk_label_new ("Hello World");
gtk_window_set_title (GTK_WINDOW (window), "Hello");
gtk_window_set_default_size (GTK_WINDOW (window), 200, 200);
gtk_window_set_child (GTK_WINDOW (window), label);
gtk_window_present (GTK_WINDOW (window));
}
int
main (int argc,
char *argv[])
{
g_autoptr (AdwApplication) app = NULL;
app = adw_application_new ("org.example.Hello", G_APPLICATION_FLAGS_NONE);
g_signal_connect (app, "activate", G_CALLBACK (activate_cb), NULL);
return g_application_run (G_APPLICATION (app), argc, argv);
} |
UPDATE: I was wrong -- I changed that line myself and the same error about not finding the adwaita library and it is now looking for libadwaita-1 that is still not found. ---- I was wrong below here ---- Notice that it says it cannot find the library "adwaita-1"? png-config can't either: pkg-config --libs adwaita-1 returns: Package adwaita-1 was not found in the pkg-config search path.
Perhaps you should add the directory containing `adwaita-1.pc'
to the PKG_CONFIG_PATH environment variable
No package 'adwaita-1' found The package on MacOS is libadwaita-1, and as above, pkg-config --libs libadwaita-1 returns the library info. Could it be line 31 in the /owlkettle/bindings/adw.nim using {.passl: "-ladwaita-1".} instead of {.passl: "-llibadwaita-1".}? |
UPDATE: I created a PR #168 to fix this issue. Hopefully this is the correct way. OR the existing code will compile by adding:
OK, I found the problem! But I don't know the fix. The issue is that the libadwaita library path is NOT included in the list of library paths when compiling. Here is a snippet that shows the library paths from the compilation using nim and Adwaita:
Notice that "-llibadwaita-1" is in the list of libraries, but the path is not. Adding the following will result in a successful compilation:
What I don't know is why nim isn't adding this. |
I am trying a simple window and trying to use Adwaita. The error I get when running "nim c..." is:
I have GTK4 and libAdwaita installed via brew. The code for the app is simple:
If I use GTK4 itself by removing the "adw.brew..." and just using "brew...", and removing the adw import the code runs fine.
pkg-build shows the following output when running "pkg-config --libs libadwaita-1"
Am I doing something wrong or is MacOS not supporting Adwaita, or any other clues?
Thanks in advance!
The text was updated successfully, but these errors were encountered: