I use this for installing SDL2 from source to get x64 version of SDL2.a and SDL2main.a:
21:15:21 / $ brew install --build-from-source sdl2
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> New Formulae
libbitcoin-explorer
==> Updated Formulae
gnupg-pkcs11-scd gofabric8 hg-fast-export hledger mednafen
==> Downloading https://libsdl.org/release/SDL2-2.0.5.tar.gz
######################################################################## 100,0%
==> ./configure --prefix=/usr/local/Cellar/sdl2/2.0.5 --without-x
==> make install
🍺 /usr/local/Cellar/sdl2/2.0.5: 84 files, 3.9MB, built in 49 seconds
21:16:20 / $ cd /usr/local/Cellar/sdl2/2.0.5/lib
21:16:30 /usr/local/Cellar/sdl2/2.0.5/lib $ ls
cmake libSDL2-2.0.0.dylib libSDL2.a libSDL2.dylib libSDL2_test.a libSDL2main.a pkgconfig
21:16:31 /usr/local/Cellar/sdl2/2.0.5/lib $ ld libSDL2.a
ld: warning: -arch not specified
ld: warning: -macosx_version_min not specified, assuming 10.10
Undefined symbols for architecture x86_64:
"start", referenced from:
implicit entry/start for main executable
ld: symbol(s) not found for inferred architecture x86_64
21:16:35 /usr/local/Cellar/sdl2/2.0.5/lib $
But looks like it doesn’t compatible with the x86_64 architecture. What should I do to avoid this problem?
If I go this way I get another problem - it can’t be compiled with gcc7 or gcc6 due to compilation errors:
$ brew install --build-from-source sdl2 --cc=gcc-7
==> Downloading https://libsdl.org/release/SDL2-2.0.5.tar.gz
Already downloaded: /Users/abc/Library/Caches/Homebrew/sdl2-2.0.5.tar.gz
==> ./configure --prefix=/usr/local/Cellar/sdl2/2.0.5 --without-x
==> make install
Last 15 lines from /Users/abc/Library/Logs/Homebrew/sdl2/02.make:
make: *** [build/SDL_atomic.lo] Error 1
make: *** [build/SDL_log.lo] Error 1
make: *** [build/SDL_assert.lo] Error 1
make: *** [build/SDL_error.lo] Error 1
make: *** [build/SDL_spinlock.lo] Error 1
make: *** [build/SDL_hints.lo] Error 1
make: *** [build/SDL_audio.lo] Error 1
gcc-7: error: unrecognized command line option '-fpascal-strings'; did you mean '-Wwrite-strings'?
gcc-7: error: unrecognized command line option '-fpascal-strings'; did you mean '-Wwrite-strings'?
gcc-7: error: unrecognized command line option '-fpascal-strings'; did you mean '-Wwrite-strings'?
make: *** [build/SDL_audiodev.lo] Error 1
gcc-7: error: unrecognized command line option '-fpascal-strings'; did you mean '-Wwrite-strings'?
make: *** [build/SDL_wave.lo] Error 1
make: *** [build/SDL_mixer.lo] Error 1
make: *** [build/SDL_audiotypecvt.lo] Error 1