Skip to content

Commit

Permalink
fix: copy over required libraries so native build will work (#282)
Browse files Browse the repository at this point in the history
* fix: copy over required libraries so native build will work

* fix: copy over required libraries so native build will work - remove shared libs

* fix: change multiple wgets to ln & fix all dockerfiles

---------

Co-authored-by: vimystic <[email protected]>
  • Loading branch information
PFC-developer and vimystic authored Oct 7, 2024
1 parent 9885965 commit fee412d
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 6 deletions.
10 changes: 5 additions & 5 deletions dockerfile/cosmos/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ RUN set -eux;\
LIBDIR=/usr/aarch64-linux-musl/lib;\
mkdir -p $LIBDIR;\
export CC=aarch64-linux-musl-gcc CXX=aarch64-linux-musl-g++;\
fi;\
fi;\
elif [ "${TARGETARCH}" = "amd64" ]; then\
export ARCH=x86_64;\
if [ "${BUILDARCH}" != "amd64" ]; then\
Expand All @@ -64,10 +64,10 @@ RUN set -eux;\
WASMVM_REPO=$(echo $WASMVM_VERSION | awk '{print $1}');\
WASMVM_VERS=$(echo $WASMVM_VERSION | awk '{print $2}');\
wget -O $LIBDIR/libwasmvm_muslc.a https://${WASMVM_REPO}/releases/download/${WASMVM_VERS}/libwasmvm_muslc.${ARCH}.a;\
cp $LIBDIR/libwasmvm_muslc.a $LIBDIR/libwasmvm.x86_64.a;\
cp $LIBDIR/libwasmvm_muslc.a $LIBDIR/libwasmvm_muslc.x86_64.a;\
cp $LIBDIR/libwasmvm_muslc.a $LIBDIR/libwasmvm.aarch64.a;\
cp $LIBDIR/libwasmvm_muslc.a $LIBDIR/libwasmvm_muslc.aarch64.a;\
ln $LIBDIR/libwasmvm_muslc.a $LIBDIR/libwasmvm.x86_64.a;\
ln $LIBDIR/libwasmvm_muslc.a $LIBDIR/libwasmvm_muslc.x86_64.a;\
ln $LIBDIR/libwasmvm_muslc.a $LIBDIR/libwasmvm.aarch64.a;\
ln $LIBDIR/libwasmvm_muslc.a $LIBDIR/libwasmvm_muslc.aarch64.a;\
fi;\
export GOOS=linux GOARCH=$TARGETARCH CGO_ENABLED=1 LDFLAGS='-linkmode external -extldflags "-static"';\
if [ ! -z "$PRE_BUILD" ]; then sh -c "${PRE_BUILD}"; fi;\
Expand Down
1 change: 1 addition & 0 deletions dockerfile/cosmos/local.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ RUN set -eux; \
WASMVM_REPO=$(echo $WASMVM_VERSION | awk '{print $1}');\
WASMVM_VERS=$(echo $WASMVM_VERSION | awk '{print $2}');\
wget -O /lib/libwasmvm_muslc.a https://${WASMVM_REPO}/releases/download/${WASMVM_VERS}/libwasmvm_muslc.$(uname -m).a;\
ln /lib/libwasmvm_muslc.a /lib/libwasmvm_muslc.$(uname -m).a;\
fi;

ARG BUILD_DIR
Expand Down
3 changes: 2 additions & 1 deletion dockerfile/cosmos/localcross.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ RUN set -eux;\
LIBDIR=/usr/aarch64-linux-musl/lib;\
mkdir -p $LIBDIR;\
export CC=aarch64-linux-musl-gcc CXX=aarch64-linux-musl-g++;\
fi;\
fi;\
elif [ "${TARGETARCH}" = "amd64" ]; then\
export ARCH=x86_64;\
if [ "${BUILDARCH}" != "amd64" ]; then\
Expand All @@ -62,6 +62,7 @@ RUN set -eux;\
WASMVM_REPO=$(echo $WASMVM_VERSION | awk '{print $1}');\
WASMVM_VERS=$(echo $WASMVM_VERSION | awk '{print $2}');\
wget -O $LIBDIR/libwasmvm_muslc.a https://${WASMVM_REPO}/releases/download/${WASMVM_VERS}/libwasmvm_muslc.${ARCH}.a;\
ln $LIBDIR/libwasmvm_muslc.a $LIBDIR/libwasmvm_muslc.$(uname -m).a;\
fi;\
export GOOS=linux GOARCH=$TARGETARCH CGO_ENABLED=1 LDFLAGS='-linkmode external -extldflags "-static"';\
if [ ! -z "$PRE_BUILD" ]; then sh -c "${PRE_BUILD}"; fi;\
Expand Down
1 change: 1 addition & 0 deletions dockerfile/cosmos/native.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ RUN set -eux;\
WASMVM_REPO=$(echo $WASMVM_VERSION | awk '{print $1}');\
WASMVM_VERS=$(echo $WASMVM_VERSION | awk '{print $2}');\
wget -O /lib/libwasmvm_muslc.a https://${WASMVM_REPO}/releases/download/${WASMVM_VERS}/libwasmvm_muslc.$(uname -m).a;\
ln /lib/libwasmvm_muslc.a /lib/libwasmvm_muslc.$(uname -m).a;\
fi;\
export CGO_ENABLED=1 LDFLAGS='-linkmode external -extldflags "-static"';\
if [ ! -z "$PRE_BUILD" ]; then sh -c "${PRE_BUILD}"; fi;\
Expand Down

0 comments on commit fee412d

Please sign in to comment.