Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: OSX Sierra static runtime broken  (Read 6639 times)

0 Members and 1 Guest are viewing this topic.

Milerius

  • Newbie
  • *
  • Posts: 23
    • View Profile
OSX Sierra static runtime broken
« on: June 18, 2018, 02:55:36 pm »
Hello

Today I wanted to use SFML in static on my mac, only it seems that I crash immediately at the launch of the program. So I decided to reproduce the error with an all-fresh build of the sfml.

Here is the procedure:
Code: [Select]
git clone https://github.com/SFML/SFML
mkdir build && cd build
cmake -DBUILD_SHARED_LIBS:BOOL=OFF -DSFML_BUILD_EXAMPLES:BOOL=ON ..
make -j
cd examples/window
./window
There is the fullstacktrace:

Code: [Select]
2018-06-18 14:46:19.399 window[11527:6544367] -[SFOpenGLView enableKeyRepeat]: unrecognized selector sent to instance 0x7fe0b762c5c0
2018-06-18 14:46:19.399 window[11527:6544367] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[SFOpenGLView enableKeyRepeat]: unrecognized selector sent to instance 0x7fe0b762c5c0'
*** First throw call stack:
(
0   CoreFoundation                      0x00007fff41f37fcb __exceptionPreprocess + 171
1   libobjc.A.dylib                     0x00007fff68bd5c76 objc_exception_throw + 48
2   CoreFoundation                      0x00007fff41fd0a24 -[NSObject(NSObject) doesNotRecognizeSelector:] + 132
3   CoreFoundation                      0x00007fff41eae610 ___forwarding___ + 1456
4   CoreFoundation                      0x00007fff41eadfd8 _CF_forwarding_prep_0 + 120
5   window                              0x000000010af7f34a -[SFOpenGLView initWithFrame:fullscreen:] + 122
6   window                              0x000000010af808c5 -[SFWindowController setupWindowWithMode:andStyle:] + 437
7   window                              0x000000010af801e4 -[SFWindowController initWithMode:andStyle:] + 356
8   window                              0x000000010af82a96 _ZN2sf4priv15WindowImplCocoaC2ENS_9VideoModeERKNS_6StringEmRKNS_15ContextSettingsE + 230
9   window                              0x000000010af761f3 _ZN2sf4priv10WindowImpl6createENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE + 67
10  window                              0x000000010af75215 _ZN2sf6Window6createENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE + 469
11  window                              0x000000010af752d7 _ZN2sf6WindowC1ENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE + 119
12  window                              0x000000010af6f74d main + 173
13  window                              0x000000010af6f694 start + 52
)
libc++abi.dylib: terminating with uncaught exception of type NSException
[1]    11527 abort      ./window

Computer:
macOs High Sierra 10.13.3

Compiler:
Code: [Select]
./clang++ -v
clang version 6.0.0 (tags/RELEASE_600/final)
Target: x86_64-apple-darwin17.4.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin

There seems to be an error in the objective-c code, I do not know if it's a regression since 2.5.0 I've never used SFML in static on this platform before

Thanks you for your help !
« Last Edit: June 18, 2018, 03:06:18 pm by Milerius »

eXpl0it3r

  • SFML Team
  • Hero Member
  • *****
  • Posts: 11030
    • View Profile
    • development blog
    • Email
Re: OSX Sierra static runtime broken
« Reply #1 on: June 19, 2018, 05:59:38 pm »
I asked Hiura again and he confirmed that static linking is not supported on macOS.
Official FAQ: https://www.sfml-dev.org/faq.php
Official Discord Server: https://discord.gg/nr4X7Fh
——————————————————————
Dev Blog: https://duerrenberger.dev/blog/

Jonny

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • Email
Re: OSX Sierra static runtime broken
« Reply #2 on: June 21, 2018, 04:52:50 am »
Might not be officially supported, but does work - Milerius can you try adding -all_load to your other linker flags?

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: OSX Sierra static runtime broken
« Reply #3 on: June 21, 2018, 06:29:29 am »
You'll have to make sure it doesn't change the load order of SFML libraries and the one from the system or you might have some issues. Frankly, seen how easy it is to create an application bundle, I wouldn't spend my time on something that isn't officially supported and could break at any moment or on a slightly different environment.  ;)
SFML / OS X developer

Jonny

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • Email
Re: OSX Sierra static runtime broken
« Reply #4 on: June 21, 2018, 07:34:16 am »
there's a bit of ambiguity here if I understand correctly:

static libraries are supported by Apple (and presumably by SFML too?)

statically linked binaries are not supported by Apple (and therefore not by SFML either?)

I think OP is trying the former? I wouldn't claim to be an expert, so please correct me if I'm wrong

Hiura

  • SFML Team
  • Hero Member
  • *****
  • Posts: 4321
    • View Profile
    • Email
Re: OSX Sierra static runtime broken
« Reply #5 on: June 21, 2018, 11:04:27 pm »
No, you "statically" link against static libraries. There's only one concept, which SFML does support at all and that is not recommended by Apple on macOS (iOS is somewhat different).
SFML / OS X developer

Jonny

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • Email
Re: OSX Sierra static runtime broken
« Reply #6 on: June 23, 2018, 01:07:21 am »
https://developer.apple.com/library/archive/qa/qa1118/_index.html

along with other resources is where I was getting the info from. And indeed, if I try and create a statically linked binary, I get the expected error.

Using SFML static libraries however doesn't error, and has the expected behaviour (in that the binary works without including the SFML libs)

Jonny

  • Full Member
  • ***
  • Posts: 114
    • View Profile
    • Email
Re: OSX Sierra static runtime broken
« Reply #7 on: August 27, 2018, 12:50:51 pm »
Milerius, Give this Pull request a try if you can. It should solve the issue: https://github.com/SFML/SFML/pull/1485

 

anything