diff --git a/components/hab/habitat/plan.sh b/components/hab/habitat/plan.sh index 4cf976e179..2fc84f8f90 100644 --- a/components/hab/habitat/plan.sh +++ b/components/hab/habitat/plan.sh @@ -69,6 +69,12 @@ do_prepare() { # variables. export PROTOC="$(pkg_path_for protobuf)/bin/protoc" export PROTOC_INCLUDE="$(pkg_path_for protobuf)/include" + + # rust 1.46.0 enabled Position Independent Executables(PIE) for x86_64-unknown-linux-musl. + # This causes the compiled binary to segfault when building with GCC versions that + # support it. While we should investigate if there is something in the way we compile + # GCC which causes this. Setting relocation-model to static suppresses PIE. + export RUSTFLAGS='-C relocation-model=static' } do_build() { diff --git a/components/pkg-export-container/habitat/plan.sh b/components/pkg-export-container/habitat/plan.sh index 92065862c2..5a3987d364 100644 --- a/components/pkg-export-container/habitat/plan.sh +++ b/components/pkg-export-container/habitat/plan.sh @@ -79,6 +79,12 @@ do_prepare() { # better refactoring may be called for. export PROTOC="$(pkg_path_for protobuf)/bin/protoc" export PROTOC_INCLUDE="$(pkg_path_for protobuf)/include" + + # rust 1.46.0 enabled Position Independent Executables(PIE) for x86_64-unknown-linux-musl. + # This causes the compiled binary to segfault when building with GCC versions that + # support it. While we should investigate if there is something in the way we compile + # GCC which causes this. Setting relocation-model to static suppresses PIE. + export RUSTFLAGS='-C relocation-model=static' } do_build() { diff --git a/components/pkg-export-tar/habitat/plan.sh b/components/pkg-export-tar/habitat/plan.sh index 399722f3d9..de66257b32 100644 --- a/components/pkg-export-tar/habitat/plan.sh +++ b/components/pkg-export-tar/habitat/plan.sh @@ -64,6 +64,12 @@ do_prepare() { PLAN_TAR_PKG_IDENT=$(pkg_path_for tar | sed "s,^$HAB_PKG_PATH/,,") export PLAN_TAR_PKG_IDENT build_line "Setting PLAN_TAR_PKG_IDENT=$PLAN_TAR_PKG_IDENT" + + # rust 1.46.0 enabled Position Independent Executables(PIE) for x86_64-unknown-linux-musl. + # This causes the compiled binary to segfault when building with GCC versions that + # support it. While we should investigate if there is something in the way we compile + # GCC which causes this. Setting relocation-model to static suppresses PIE. + export RUSTFLAGS='-C relocation-model=static' } do_build() { diff --git a/components/sup/static/plan.sh b/components/sup/static/plan.sh index dbc61f6db0..7d0daf4116 100644 --- a/components/sup/static/plan.sh +++ b/components/sup/static/plan.sh @@ -25,4 +25,10 @@ do_prepare() { # package proper--it won't find its way into the final binaries. export LD_LIBRARY_PATH=$(pkg_path_for gcc)/lib build_line "Setting LD_LIBRARY_PATH=$LD_LIBRARY_PATH" + + # rust 1.46.0 enabled Position Independent Executables(PIE) for x86_64-unknown-linux-musl. + # This causes the compiled binary to segfault when building with GCC versions that + # support it. While we should investigate if there is something in the way we compile + # GCC which causes this. Setting relocation-model to static suppresses PIE. + export RUSTFLAGS='-C relocation-model=static' }