twostraws / SwiftGD

A simple Swift wrapper for libgd

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Apple Silicon M1 compatibility

n3d1117 opened this issue · comments

Hello! I'm having trouble compiling this project on a mac with M1 processor.
I successfully installed gd with brew install gd.

When compiling I get the error 'gd.h' file not found; it looks like SPM is not picking up headers correctly

$ pkg-config --cflags gdlib                                   
-I/opt/homebrew/Cellar/gd/2.3.2/include
$ ls /usr/local/include | grep gd 
gd.h
gd_color_map.h
gd_errors.h
gd_io.h
gdcache.h
gdfontg.h
gdfontl.h
gdfontmb.h
gdfonts.h
gdfontt.h
gdfx.h
gdpp.h

Is there any workaround available or am I doing something wrong?

I also noticed this error in XCode even for Intel i7 in past.

Anybody knows how to fix this? Or perhaps how other frameworks have done it for M1?

commented

Will this repository be updated for M1 / M2 / later intel?

any news on this? ran into it just now

I doubt it has anything to do with an Apple Silicon, since it's failing on my i9 too ¯_(ツ)_/¯

Inspired by @n3d1117 here are my pkg-config stuff:

Rocska-MBP:~ rocskaadam$ pkg-config --cflags gdlib
-I/Users/rocskaadam/Cellar/gd/2.3.3_4/include
Rocska-MBP:~ rocskaadam$ ls -la /Users/rocskaadam/Cellar/gd/2.3.3_4/include | grep gd
-rw-r--r--   1 rocskaadam  staff  60218 Sze 11  2021 gd.h
-rw-r--r--   1 rocskaadam  staff    478 Sze 11  2021 gd_color_map.h
-rw-r--r--   1 rocskaadam  staff   1503 Sze 11  2021 gd_errors.h
-rw-r--r--   1 rocskaadam  staff   2931 Sze 11  2021 gd_io.h
-rw-r--r--   1 rocskaadam  staff   2994 Sze 11  2021 gdcache.h
-rw-r--r--   1 rocskaadam  staff    553 Sze 11  2021 gdfontg.h
-rw-r--r--   1 rocskaadam  staff    551 Sze 11  2021 gdfontl.h
-rw-r--r--   1 rocskaadam  staff    519 Sze 11  2021 gdfontmb.h
-rw-r--r--   1 rocskaadam  staff    515 Sze 11  2021 gdfonts.h
-rw-r--r--   1 rocskaadam  staff    546 Sze 11  2021 gdfontt.h
-rw-r--r--   1 rocskaadam  staff    496 Sze 11  2021 gdfx.h
-rw-r--r--   1 rocskaadam  staff  51975 Sze 11  2021 gdpp.h
Rocska-MBP:~ rocskaadam$ 
commented

.package(url: "https://github.com/twostraws/SwiftGD.git", branch: "main"),
use main branch worked for me

The reason for the error is that gd.h and the gd library have the same name, so the system doesn't know which one to choose.

@zhtut I switched to https://github.com/t-ae/Swim

Much better quality, much better API, written by a much better programmer.

I'll unsubscribe from this thread now, just wanted to put that link out here if anyone else is playing around with this toy, it's better to check on Swim.

@adam-rocska It's possible to leave comments without being a jerk about it. I'm glad you found an alternative you're happy with!