Skip to content

Commit f639efd

Browse files
Merge pull request lithiumFlower#6 from lithiumFlower/osx-compatibility
Mac static libstdc++ and statc libgcc
2 parents 9e58ad0 + 1a5bc02 commit f639efd

File tree

3 files changed

+4
-17
lines changed

3 files changed

+4
-17
lines changed

Makefile

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -18,10 +18,6 @@ ifeq ($(ARCH),x86-linux)
1818
else
1919
UNAME = $(shell uname)
2020
ifeq ($(UNAME),Darwin)
21-
STD_LIB = libstdc++.6.dylib
22-
GCC_LIB = libgcc_s.1.dylib
23-
STD_LIB_PATH = /usr/local/opt/gcc/lib/gcc/10/$(STD_LIB)
24-
GCC_LIB_PATH = /usr/local/lib/gcc/10/$(GCC_LIB)
2521
STRIP = strip -x
2622
ARCH = i386-x86_64-macosx
2723
SOEXT = .dylib
@@ -89,18 +85,7 @@ ifeq ($(WIN),1)
8985
else
9086
ifeq ($(UNAME),Darwin)
9187
$(STRIP) build/*.dylib
92-
cp $(STD_LIB_PATH) build/
93-
cp $(GCC_LIB_PATH) build/
9488
chmod +xwr build/*.dylib
95-
install_name_tool \
96-
-change $(STD_LIB_PATH) @rpath/$(STD_LIB) \
97-
-change $(GCC_LIB_PATH) @rpath/$(GCC_LIB) \
98-
build/libdoctotext.dylib
99-
install_name_tool \
100-
-change $(GCC_LIB_PATH) @rpath/$(GCC_LIB) \
101-
build/$(STD_LIB)
102-
install_name_tool -id @rpath/$(STD_LIB) build/$(STD_LIB)
103-
install_name_tool -id @rpath/$(GCC_LIB) build/$(GCC_LIB)
10489
install_name_tool -id @rpath/libdoctotext.dylib build/libdoctotext.dylib
10590
echo './doctotext "$$@"' > build/doctotext.sh
10691
else

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ Install the following through homebrew:
4646
- doxygen, libffi, libxml2, zlib, xz, gcc
4747
libffi, libxml2, zlib, and xz will be statically linked through their /usr/local/opt/ -> /usr/local/Cellar/ symlinks
4848

49-
The Makefile will use the full path to GNU g++ 10 (installed through `brew install gcc` at `/usr/local/bin/g++-10`). If you have different version edit the makefile and change the `src/Makefile` `CXX` setting for Darwin, as well as the corresponding main `Makefile` `STD_LIB_PATH` and `GCC_LIB_PATH`.
49+
The Makefile will use the full path to GNU g++ 10 (installed through `brew install gcc` at `/usr/local/bin/g++-10`). If you have different version edit the makefile and change the `src/Makefile` `CXX` setting for Darwin.
50+
5051

5152
Note that the system gcc and g++ *will not work*. The system gcc and g++ compile against Mac's `libc++` which is Mac's implementation of a c++11 compatible standard library. Unfortunately because we are linking with precompiled libs distributed by SILVERCODERS which were compiled pre c++11 with GNU g++ we must use GNU g++ for its ability to be abi compatible with pre c++11 libraries linked against the gnu `libstdc++`. Mac removed their GNU compatibility and distributed headers as of Xcode 10.
5253

src/Makefile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,8 @@ else
6060
/usr/local/opt/zlib/lib/libz.a \
6161
/usr/local/opt/xz/lib/liblzma.a \
6262
/usr/lib/libiconv.dylib \
63-
-framework CoreServices
63+
-framework CoreServices \
64+
-static-libgcc -static-libstdc++
6465
else
6566
CXX = g++
6667
STRIP = strip

0 commit comments

Comments
 (0)