Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Native dialog troubles on mac m1

This thread is locked; no one can reply to it. rss feed Print
Native dialog troubles on mac m1
_jagged
Member #17,124
September 2019

Hello everyone, I've just got allegro working on my m1 mac (big thanks to siegelord) but I'm having issues with the native dialog addon. Here's how I'm compiling, and the errors I'm getting:

edit woops, I didn't link the native dialog header, now I get this:

jagged@jaggeds-Mac-mini snake % gcc snake.c -o snake -lallegro -lallegro_primitives -lallegro_main -lallegro_native_dialog -I /opt/homebrew/Cellar/allegro/5.2.7.0/include -L /opt/homebrew/Cellar/allegro/5.2.7.0/lib

ld: library not found for -lallegro_native_dialog
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Does anybody know what's going on here? The header is definitely there. Everything else is working great. Thanks in advance.

Peter Hull
Member #1,136
March 2001

It's just called allegro_dialog.
Can you not use pkg-config on your system?
gcc snake.c -o snake $(pkg-config --libs --cflags allegro-5 allegro_primitives-5 allegro_main-5 allegro_dialog-5)

SiegeLord
Member #7,827
October 2006
avatar

It's -lallegro_dialog.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

_jagged
Member #17,124
September 2019

Jeez, I don't know how I missed that. Works fine now, thanks guys. Peter, I've never used pkg-config (I just looked it up) but when I try your input suggestion I get 'allegro5/allegro.h' file not found.

Peter Hull
Member #1,136
March 2001

Sometimes this whole computer business makes me very weary. Why can't things just work for everyone?

From your paths it looks like your Allegro came from homebrew and homebrew should also have provided the matching database for pkg-config. What does it print out if you run pkg-config --cflags allegro-5 on the command line? (as you probably know pkg-config just prints out the options you should have typed yourself, that's why it's always used in backticks or $( ... ))

_jagged
Member #17,124
September 2019

The output was: zsh: command not found: pkg-config.

I installed pkg-config through brew and now it works fine. I'm not sure why I didn't get an error telling me I didn't have pkg-config when I used:
gcc snake.c -o snake $(pkg-config --libs --cflags allegro-5 allegro_primitives-5 allegro_main-5 allegro_dialog-5). Instead it just said allegro5/allegro.h could not be found.

Peter Hull
Member #1,136
March 2001

Let's take that as a victory!

I didn't know this but I checked - if you $(...) with a non-existent command, zsh prints an error message, substitutes nothing at all and then goes on to run the outer command. So as if you'd typed simply gcc snake.c -o snake.

I think this explains what happened, but it should still have printed "zsh: command not found: pkg-config", maybe you missed it in all the excitement? ;)

David_056
Member #20,045
April 2021

Did any of you purchase books online ? I am a fan of Read light novels, so would love to know the info regarding this.

Peter Hull
Member #1,136
March 2001

David_056: what?

Go to: