Skip to content

Commit

Permalink
Fix static linking and dockerfile
Browse files Browse the repository at this point in the history
  • Loading branch information
RedstoneWizard08 committed Jan 30, 2023
1 parent 3ec6114 commit 71bfcd2
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
8 changes: 4 additions & 4 deletions packages/grpc-tools/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ PROJECT("grpc-tools")

SET(CMAKE_OSX_DEPLOYMENT_TARGET "11.7" CACHE STRING "Minimum OS X deployment version" FORCE)

if(COMMAND CMAKE_POLICY)
IF(COMMAND CMAKE_POLICY)
CMAKE_POLICY(SET CMP0003 NEW)
ENDIF(COMMAND CMAKE_POLICY)

# MSVC runtime library flags are selected by an abstraction.
if(COMMAND CMAKE_POLICY AND POLICY CMP0091)
IF(COMMAND CMAKE_POLICY AND POLICY CMP0091)
CMAKE_POLICY(SET CMP0091 NEW)
ENDIF()

Expand All @@ -22,8 +22,8 @@ SET(PROTOBUF_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/deps/protobuf)

ADD_SUBDIRECTORY(${PROTOBUF_ROOT_DIR}/cmake deps/protobuf)

SET(CMAKE_EXE_LINKER_FLAGS "-static-libstdc++")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-stack-protector")
SET(CMAKE_EXE_LINKER_FLAGS "-static-libstdc++ -static -Wl,-Bstatic")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fno-stack-protector -static -Wl,-Bstatic")

ADD_EXECUTABLE(grpc_node_plugin
src/node_generator.cc
Expand Down
8 changes: 7 additions & 1 deletion tools/release/native/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# NOTE: We don't have to worry about glibc versions
# because we use static linking during the
# compile step.
# (See packages/grpc-tools/CMakeLists.txt#L25)

FROM ubuntu:22.04

RUN apt-get update
Expand All @@ -9,7 +14,8 @@ RUN apt-get install -y cmake curl build-essential \
gcc-i686-linux-gnu g++-i686-linux-gnu tar file \
gcc-x86-64-linux-gnu g++-x86-64-linux-gnu binutils \
gcc-aarch64-linux-gnu g++-aarch64-linux-gnu make \
gcc g++ gzip bash
gcc g++ gzip bash libc6-amd64-i386-cross \
libc6-dev-amd64-i386-cross

RUN mkdir /usr/local/nvm
ENV NVM_DIR /usr/local/nvm
Expand Down

1 comment on commit 71bfcd2

@yinzara
Copy link

@yinzara yinzara commented on 71bfcd2 May 5, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that this commit could be the cause of #2338 though I'm not 100% sure.
It's one of the only recent change to how its built and linked.

Please sign in to comment.