Skip to content
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

The following addition will make sure GKlib compiles on macOS with gcc #43

Open
gctwnl opened this issue Feb 14, 2025 · 0 comments
Open

Comments

@gctwnl
Copy link

gctwnl commented Feb 14, 2025

When gcc is installed on macOS, e.g. via MacPorts, it is often compiled against a specific sysroot. E.g. the current MacPorts gcc14 is compiled against /Library/Developer/CommandLineTools/SDKs/MacOSX14.sdk. But on macOS, cmake will get the sysroot from Xcode: Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX15.2.sdk

In such a case (as is now the case of GKlib), compiling with gcc will fail, e.g. as gcc's 'stdlib' overrides are incompatible with the given sysroot

This addition in the Makefile will fix this and let cmake pick up the correct sysroot:

*** Makefile	Fri Feb 14 09:55:36 2025
--- Makefile.org	Fri Feb 14 09:55:22 2025
***************
*** 61,64 ****
--- 61,70 ----
      CONFIG_FLAGS += -DNO_X86=$(cputype)
  endif
+ ifeq ($(systype), Darwin)
+     sysroot = $(shell $(cc) -print-sysroot || echo not-set)
+     ifneq ($(sysroot), not-set)
+ 	CONFIG_FLAGS += -DCMAKE_OSX_SYSROOT=$(sysroot)
+     endif
+ endif
  
  define run-config
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant