Skip to content

Commit

Permalink
[build] Force cgo static linkage with libstdc++ required by InfoLogger
Browse files Browse the repository at this point in the history
  • Loading branch information
teo committed Mar 14, 2019
1 parent d0bb532 commit d0d9e82
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ ROOT_DIR:=$(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))

HOST_GOOS=$(shell go env GOOS)
HOST_GOARCH=$(shell go env GOARCH)
CGO_LDFLAGS=CGO_LDFLAGS="$(ROOT_DIR)/vendor/infoLoggerForGo/infoLoggerForGo.a -lstdc++"
CGO_LDFLAGS=CGO_LDFLAGS="$(ROOT_DIR)/vendor/infoLoggerForGo/infoLoggerForGo.a -static-libstdc++ -static-libgcc"
BUILD_FLAGS=$(CGO_LDFLAGS) $(BUILD_ENV_FLAGS)
REPOPATH = github.com/AliceO2Group/Control

Expand Down Expand Up @@ -118,6 +118,10 @@ vendor: tools/dep
@./tools/dep ensure
@mkdir -p vendor/infoLoggerForGo
@cp ${INFOLOGGER_ROOT}/lib/infoLoggerForGo.* vendor/infoLoggerForGo/
# For cgo, *.a means C, so by default it will use gcc when linking against it. For
# this reason, we must create a dummy *.cpp file in the package dir to force cgo to
# use g++ instead of gcc.
@touch vendor/infoLoggerForGo/infoLoggerForGo.cpp

tools: tools/dep tools/protoc

Expand Down

0 comments on commit d0d9e82

Please sign in to comment.