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

Allow to configure min-sdk-version for macOS and iOS #50

Open
aking opened this issue Jan 15, 2020 · 6 comments
Open

Allow to configure min-sdk-version for macOS and iOS #50

aking opened this issue Jan 15, 2020 · 6 comments

Comments

@aking
Copy link

aking commented Jan 15, 2020

Just did a fresh clone and run. Seem to get the following error when running a sample:

=== run 'imgui-glfw' (config: osx-xcode-debug, project: sokol-samples):
dyld: lazy symbol binding failed: Symbol not found: _objc_opt_respondsToSelector
  Referenced from: /Users/aking/projects/sokol/fips-deploy/sokol-samples/osx-xcode-debug/imgui-glfw (which was built for Mac OS X 10.15)
  Expected in: /usr/lib/libobjc.A.dylib

dyld: Symbol not found: _objc_opt_respondsToSelector
  Referenced from: /Users/aking/projects/sokol/fips-deploy/sokol-samples/osx-xcode-debug/imgui-glfw (which was built for Mac OS X 10.15)
  Expected in: /usr/lib/libobjc.A.dylib

aking@gem:~/projects/sokol/sokol-samples$ ./fips run triangle-glfw
=== run 'triangle-glfw' (config: osx-xcode-debug, project: sokol-samples):
dyld: lazy symbol binding failed: Symbol not found: _objc_opt_respondsToSelector
  Referenced from: /Users/aking/projects/sokol/fips-deploy/sokol-samples/osx-xcode-debug/triangle-glfw (which was built for Mac OS X 10.15)
  Expected in: /usr/lib/libobjc.A.dylib

dyld: Symbol not found: _objc_opt_respondsToSelector
  Referenced from: /Users/aking/projects/sokol/fips-deploy/sokol-samples/osx-xcode-debug/triangle-glfw (which was built for Mac OS X 10.15)
  Expected in: /usr/lib/libobjc.A.dylib```

The sequence of events:
> mkdir sokol
> cd sokol
> git clone [email protected]:floooh/sokol-samples
> cd sokol-samples
> ./fips build
> ./fips list targets
> ./fips run imgui-glfw  (see above)
> ./fips run triangle-glfw  (see above)

aking@gem:~/projects/sokol/sokol-samples$ python --version
Python 2.7.17
aking@gem:~/projects/sokol/sokol-samples$ cmake --version
cmake version 3.16.2

CMake suite maintained and supported by Kitware (kitware.com/cmake).
aking@gem:~/projects/sokol/sokol-samples$ make --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0
aking@gem:~/projects/sokol/sokol-samples$ xcodebuild -version
Xcode 11.2.1
Build version 11B500
aking@gem:~/projects/sokol/sokol-samples$ uname -a
Darwin gem.local 18.7.0 Darwin Kernel Version 18.7.0: Sun Dec  1 18:59:03 PST 2019; root:xnu-4903.278.19~1/RELEASE_X86_64 x86_64
aking@gem:~/projects/sokol/sokol-samples$

macOS Mojave Version 10.14.6.  Not sure why it's building for macOS 10.15 when I'm on 10.14.6?

Edit:
Just tried a metal build:
aking@gem:~/projects/sokol/sokol-samples$ ./fips run triangle-metal
=== run 'triangle-metal' (config: metal-osx-xcode-debug, project: sokol-samples):
application requires at least OS X version 10.15.0 (10.15), but is being run on 10.14.6 ( 10.14.6/18G2022), and so is exiting.aking@gem:~/projects/sokol/sokol-samples$
@floooh
Copy link
Owner

floooh commented Jan 15, 2020

Ok, weird, building with the 10.15 SDK on 10.14 would give that behaviour though, but as far as I'm aware this shouldn't be hardcoded anywhere in the code or build system.

What's the console output when you do run the following?

> xcrun --sdk macosx --show-sdk-path

On my machine (with latest Xcode and Catalina) it shows:

/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk

On your machine it should show .../MacOSX10.14.sdk, or even lower instead.

@aking
Copy link
Author

aking commented Jan 15, 2020

Here's what I get (osx 10.14.6 & xcode 11.2.1):

sokol/sokol-samples$ xcrun --sdk macosx --show-sdk-path
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk
aking@gem:~/projects/sokol/sokol-samples$ ls -al /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
total 0
drwxr-xr-x  5 aking  staff  160 Nov 20 09:43 .
drwxr-xr-x  6 aking  staff  192 Nov  5 21:12 ..
drwxr-xr-x  4 aking  staff  128 Nov  3 12:23 DriverKit19.0.sdk
drwxr-xr-x  8 aking  staff  256 Nov  3 12:23 MacOSX.sdk
lrwxr-xr-x  1 aking  staff   10 Nov 20 09:42 MacOSX10.15.sdk -> MacOSX.sdk
aking@gem:~/projects/sokol/sokol-samples$

I do use this xcode all the time for building projects for work (and personal stuff), so I do know it's not broken. I'll scan the plist and see if anything pops out at me

@aking
Copy link
Author

aking commented Jan 15, 2020

I opened up the xcodeproj file and after changing the Project 'macOS Deployment Target' to 'macOS 10.14', I can now run the samples. I guess there's some CMake/fips(?) setting to set a minimum macOS Deployment Target value?

image

@floooh
Copy link
Owner

floooh commented Jan 16, 2020

I guess there's some CMake/fips(?) setting to set a minimum macOS Deployment Target value?

There shouldn't be but I'll sift through the code again to check :)

I guess (as you said) that either cmake or Xcode default to the newest available SDK if no other option is present. cmake has a special variable CMAKE_OSX_DEPLOYMENT_TARGET (https://cmake.org/cmake/help/v3.16/variable/CMAKE_OSX_DEPLOYMENT_TARGET.html), but I'm not explicitely setting this anywhere.

@aking
Copy link
Author

aking commented Jan 16, 2020

I had a look at that cmake page you linked and saw a comment about the MACOSX_DEPLOYMENT_TARGET environment variable. So, I deleted everything and started with a fresh clone but set that variable first:

export MACOSX_DEPLOYMENT_TARGET=10.14

Then I did the './fips build' - now './fips run triangle-glfw' (and others) run fine. Thanks for the pointer! Not sure if you want to mention that or not in the readme? Or maybe set it per project when you know the build works on older OS versions. Thanks!

@floooh
Copy link
Owner

floooh commented Jan 17, 2020

Or maybe set it per project when you know the build works on older OS versions.

Yeah, maybe similar to how the TeamID for iOS projects is currently set (./fips set iosteam xxxx)... this stores the key-value pair in the project-local .fips-settings.yml file, something like ./fips set macos_min_sdk_version 10.14...

I'll rename this ticket and keep it open as reminder.

@floooh floooh changed the title Samples not running on Mojave? Allow to configure min-sdk-version for macOS and iOS Jan 17, 2020
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

2 participants