diff --git a/README.md b/README.md index 934d88e..129ef50 100644 --- a/README.md +++ b/README.md @@ -107,12 +107,11 @@ db load succeed: 9263 ### Static build ```bash -sudo bash ./prepare.sh - -export CGO_CFLAGS="-g -Wall -I./clamav-mussels-cookbook/mussels/install/include" -export CGO_LDFLAGS="-L./clamav-mussels-cookbook/mussels/install/lib -lclamav_static -lbz2_static -lclammspack_static -lclamunrar_iface_static -lclamunrar_static -lcrypto -ljson-c -lpcre2-8 -lpcre2-posix -lssl -lxml2 -lz -lm -ldl -lstdc++" - -CGO_ENABLED=1 go build --ldflags '--extldflags "-static -fpic"' main.go +$ sudo bash ./prepare.sh +$ SRCDIR=$(pwd) +$ export CGO_CFLAGS="-g -Wall -I${SRCDIR}/clamav-mussels-cookbook/mussels/install/include" +$ export CGO_LDFLAGS="-L${SRCDIR}/clamav-mussels-cookbook/mussels/install/lib -lclamav_static -lbz2_static -lclammspack_static -lclamunrar_iface_static -lclamunrar_static -lcrypto -ljson-c -lpcre2-8 -lpcre2-posix -lssl -lxml2 -lz -lm -ldl -lstdc++" +$ CGO_ENABLED=1 go build --ldflags '--extldflags "-static -fpic"' main.go ``` diff --git a/README_CN.md b/README_CN.md index 0cc559b..e09494d 100644 --- a/README_CN.md +++ b/README_CN.md @@ -107,12 +107,11 @@ db load succeed: 9263 ### 静态编译 ```bash -sudo bash ./prepare.sh - -export CGO_CFLAGS="-g -Wall -I./clamav-mussels-cookbook/mussels/install/include" -export CGO_LDFLAGS="-L./clamav-mussels-cookbook/mussels/install/lib -lclamav_static -lbz2_static -lclammspack_static -lclamunrar_iface_static -lclamunrar_static -lcrypto -ljson-c -lpcre2-8 -lpcre2-posix -lssl -lxml2 -lz -lm -ldl -lstdc++" - -CGO_ENABLED=1 go build --ldflags '--extldflags "-static -fpic"' main.go +$ sudo bash ./prepare.sh +$ SRCDIR=$(pwd) +$ export CGO_CFLAGS="-g -Wall -I${SRCDIR}/clamav-mussels-cookbook/mussels/install/include" +$ export CGO_LDFLAGS="-L${SRCDIR}/clamav-mussels-cookbook/mussels/install/lib -lclamav_static -lbz2_static -lclammspack_static -lclamunrar_iface_static -lclamunrar_static -lcrypto -ljson-c -lpcre2-8 -lpcre2-posix -lssl -lxml2 -lz -lm -ldl -lstdc++" +$ CGO_ENABLED=1 go build --ldflags '--extldflags "-static -fpic"' main.go ``` ## 参考