[toolchain] Make occlum-go support gcc/glibc option

In default, occlum-go uses musl-gcc. Users can configure
occlum-go to use gcc like below.
" CC=gcc occlum-go build "
This commit is contained in:
Zheng, Qi 2022-12-07 17:07:04 +08:00 committed by volcano
parent 77ff07f522
commit a5cdcc8045
3 changed files with 3 additions and 3 deletions

@ -36,7 +36,7 @@ override_dh_install:
rm -rf $(install_dir)/.git* rm -rf $(install_dir)/.git*
cat > $(install_dir)/bin/occlum-go <<EOF cat > $(install_dir)/bin/occlum-go <<EOF
#!/bin/bash #!/bin/bash
OCCLUM_GCC="\$$(which occlum-gcc)" OCCLUM_GCC="\$${CC:-\$$(which occlum-gcc)}"
OCCLUM_GOFLAGS="-buildmode=pie \$$GOFLAGS" OCCLUM_GOFLAGS="-buildmode=pie \$$GOFLAGS"
CC=\$$OCCLUM_GCC GOFLAGS=\$$OCCLUM_GOFLAGS /opt/occlum/toolchains/golang/bin/go "\$$@" CC=\$$OCCLUM_GCC GOFLAGS=\$$OCCLUM_GOFLAGS /opt/occlum/toolchains/golang/bin/go "\$$@"
EOF EOF

@ -49,7 +49,7 @@ mv go-go%{GO_VERSION} %{buildroot}%{INSTALL_DIR}/golang
rm -rf %{buildroot}%{INSTALL_DIR}/golang/.git* rm -rf %{buildroot}%{INSTALL_DIR}/golang/.git*
cat > %{buildroot}%{INSTALL_DIR}/golang/bin/occlum-go <<EOF cat > %{buildroot}%{INSTALL_DIR}/golang/bin/occlum-go <<EOF
#!/bin/bash #!/bin/bash
OCCLUM_GCC="\$(which occlum-gcc)" OCCLUM_GCC="\${CC:-\$(which occlum-gcc)}"
OCCLUM_GOFLAGS="-buildmode=pie \$GOFLAGS" OCCLUM_GOFLAGS="-buildmode=pie \$GOFLAGS"
CC=\$OCCLUM_GCC GOFLAGS=\$OCCLUM_GOFLAGS %{INSTALL_DIR}/golang/bin/go "\$@" CC=\$OCCLUM_GCC GOFLAGS=\$OCCLUM_GOFLAGS %{INSTALL_DIR}/golang/bin/go "\$@"
EOF EOF

@ -28,7 +28,7 @@ mv ${BUILD_DIR} ${INSTALL_DIR}
# Generate the wrappers for Go # Generate the wrappers for Go
cat > ${INSTALL_DIR}/bin/occlum-go <<EOF cat > ${INSTALL_DIR}/bin/occlum-go <<EOF
#!/bin/bash #!/bin/bash
OCCLUM_GCC="\$(which occlum-gcc)" OCCLUM_GCC="\${CC:-\$(which occlum-gcc)}"
OCCLUM_GOFLAGS="-buildmode=pie \$GOFLAGS" OCCLUM_GOFLAGS="-buildmode=pie \$GOFLAGS"
CC=\$OCCLUM_GCC GOFLAGS=\$OCCLUM_GOFLAGS ${INSTALL_DIR}/bin/go "\$@" CC=\$OCCLUM_GCC GOFLAGS=\$OCCLUM_GOFLAGS ${INSTALL_DIR}/bin/go "\$@"
EOF EOF