Skip to content
This repository was archived by the owner on Oct 12, 2022. It is now read-only.

Commit 0b43ad6

Browse files
committed
Link shared druntime library and test runner against lib[std]c++
1 parent 51409ad commit 0b43ad6

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

posix.mak

+7-3
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,10 @@ SHARED=$(if $(findstring $(OS),linux freebsd dragonflybsd),1,)
6363

6464
LINKDL=$(if $(findstring $(OS),linux),-L-ldl,)
6565

66+
# link shared libraries and test runner executables against the C++ runtime library,
67+
# for the core.stdcpp.* bindings
68+
LINKCXX=$(if $(findstring $(OS),osx),-L-lc++,-L-lstdc++)
69+
6670
MAKEFILE = $(firstword $(MAKEFILE_LIST))
6771

6872
DDOCFLAGS=-conf= -c -w -o- -Isrc -Iimport -version=CoreDdoc
@@ -245,7 +249,7 @@ $(DRUNTIMESO) $(DRUNTIMESOLIB) dll: DFLAGS+=-version=Shared -fPIC
245249
dll: $(DRUNTIMESOLIB)
246250

247251
$(DRUNTIMESO): $(OBJS) $(SRCS) $(DMD)
248-
$(DMD) -shared -debuglib= -defaultlib= -of$(DRUNTIMESO) $(DFLAGS) $(SRCS) $(OBJS) $(LINKDL) -L-lpthread -L-lm
252+
$(DMD) -shared -debuglib= -defaultlib= -of$(DRUNTIMESO) $(DFLAGS) $(SRCS) $(OBJS) $(LINKDL) $(LINKCXX) -L-lpthread -L-lm
249253

250254
$(DRUNTIMESOLIB): $(OBJS) $(SRCS) $(DMD)
251255
$(DMD) -c -fPIC -of$(DRUNTIMESOOBJ) $(DFLAGS) $(SRCS)
@@ -296,15 +300,15 @@ $(addprefix $(ROOT)/unittest/,$(DISABLED_TESTS)) :
296300
ifeq (,$(SHARED))
297301

298302
$(ROOT)/unittest/test_runner: $(OBJS) $(SRCS) src/test_runner.d $(DMD)
299-
$(DMD) $(UDFLAGS) $(UTFLAGS) -of$@ src/test_runner.d $(SRCS) $(OBJS) -debuglib= -defaultlib= -L-lpthread -L-lm
303+
$(DMD) $(UDFLAGS) $(UTFLAGS) -of$@ src/test_runner.d $(SRCS) $(OBJS) -debuglib= -defaultlib= $(LINKCXX) -L-lpthread -L-lm
300304

301305
else
302306

303307
UT_DRUNTIME:=$(ROOT)/unittest/libdruntime-ut$(DOTDLL)
304308

305309
$(UT_DRUNTIME): UDFLAGS+=-version=Shared -fPIC
306310
$(UT_DRUNTIME): $(OBJS) $(SRCS) $(DMD)
307-
$(DMD) $(UDFLAGS) -shared $(UTFLAGS) -of$@ $(SRCS) $(OBJS) $(LINKDL) -debuglib= -defaultlib= -L-lpthread -L-lm
311+
$(DMD) $(UDFLAGS) -shared $(UTFLAGS) -of$@ $(SRCS) $(OBJS) $(LINKDL) -debuglib= -defaultlib= $(LINKCXX) -L-lpthread -L-lm
308312

309313
$(ROOT)/unittest/test_runner: $(UT_DRUNTIME) src/test_runner.d $(DMD)
310314
$(DMD) $(UDFLAGS) -of$@ src/test_runner.d -L$(UT_DRUNTIME) -debuglib= -defaultlib= -L-lpthread -L-lm

0 commit comments

Comments
 (0)