SwiftGD icon indicating copy to clipboard operation
SwiftGD copied to clipboard

Apple Silicon M1 compatibility

Open n3d1117 opened this issue 3 years ago • 8 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?

n3d1117 avatar Apr 16 '21 18:04 n3d1117

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

vitalz avatar Apr 26 '21 11:04 vitalz

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

miroslavkovac avatar Aug 07 '21 18:08 miroslavkovac

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

mynona avatar Jan 14 '23 11:01 mynona

any news on this? ran into it just now

adam-rocska avatar Mar 03 '23 12:03 adam-rocska

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$ 

adam-rocska avatar Mar 03 '23 12:03 adam-rocska

.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 avatar Apr 17 '23 14:04 zhtut

@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 avatar Apr 17 '23 14:04 adam-rocska

@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!

twostraws avatar Apr 17 '23 14:04 twostraws