-
Notifications
You must be signed in to change notification settings - Fork 38
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Problems when building the binary #47
Comments
Switched to ...
# github.com/vkuznecovas/mouthful/vendor/github.com/mattn/go-sqlite3
vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go:18: undefined: SQLiteConn
vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go:26: undefined: SQLiteConn
vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go:27: undefined: namedValue
vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go:29: undefined: namedValue
vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go:35: undefined: SQLiteConn
vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go:36: undefined: namedValue
vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go:44: undefined: SQLiteConn
vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go:49: undefined: SQLiteConn
vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go:54: undefined: SQLiteStmt
vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go:63: undefined: SQLiteStmt
vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go:36: too many errors
... |
This is not an issue with mouthful per-se it's an issue with one of its dependencies, github.com/mattn/go-sqlite3. Go-sqlite3 is a pain to cross build for, you gotta have a toolchain to build it for another os. What OS are you building the container on? |
I'm bulding it on Linux (Manjaro 17.1.7) with Docker CE v18.03, any way i can help you solve this? @vkuznecovas |
Care to try with CGO_ENABLED=1 ? |
Sure i can, btw any specific version to build this? Go 1.8 and later? 1.10? |
@vkuznecovas, first attempt to build with golang 1.8 successful
FROM golang:1.8-alpine
ARG GOARCH
ARG GOARM
ARG MOUTHFUL_VER
ENV CGO_ENABLED=${CGO_ENABLED:-1} \
GOARCH=${GOARCH:-} \
GOARM=${GOARM:-} \
GOOS=${GOOS:-linux} \
MOUTHFUL_VER=${MOUTHFUL_VER:-1.0.2}
RUN set -ex; \
apk add --no-cache bash build-base curl file git && \
echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && \
echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories && \
apk add --no-cache upx nodejs nodejs-npm && \
go get -d github.com/vkuznecovas/mouthful && \
curl -sSL https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 -o /usr/bin/dep && \
chmod +x /usr/bin/dep
WORKDIR /go/src/github.com/vkuznecovas/mouthful
RUN git checkout $MOUTHFUL_VER && \
chmod +x build.sh && \
./build.sh && \
cd dist/ && \
file mouthful && \
upx --best mouthful && \
file mouthful
FROM alpine:3.7
COPY --from=0 /go/src/github.com/vkuznecovas/mouthful/dist/ /
EXPOSE 8080
CMD ["/mouthful"] Added
$ docker build -t mouthful .
Sending build context to Docker daemon 4.096kB
Step 1/12 : FROM golang:1.8-alpine
---> 4cb86d3661bf
Step 2/12 : ARG GOARCH
---> Using cache
---> 64939569ca50
Step 3/12 : ARG GOARM
---> Using cache
---> 1684d0891686
Step 4/12 : ARG MOUTHFUL_VER
---> Using cache
---> c39a0bd3b7af
Step 5/12 : ENV CGO_ENABLED=${CGO_ENABLED:-1} GOARCH=${GOARCH:-} GOARM=${GOARM:-} GOOS=${GOOS:-linux} MOUTHFUL_VER=${MOUTHFUL_VER:-1.0.2}
---> Using cache
---> 594204077365
Step 6/12 : RUN set -ex; apk add --no-cache bash build-base curl file git && echo "http://dl-cdn.alpinelinux.org/alpine/edge/community" >> /etc/apk/repositories && echo "http://dl-cdn.alpinelinux.org/alpine/edge/main" >> /etc/apk/repositories && apk add --no-cache upx nodejs nodejs-npm && go get -d github.com/vkuznecovas/mouthful && curl -sSL https://github.com/golang/dep/releases/download/v0.4.1/dep-linux-amd64 -o /usr/bin/dep && chmod +x /usr/bin/dep
---> Using cache
---> 92c81d7452c0
Step 7/12 : WORKDIR /go/src/github.com/vkuznecovas/mouthful
---> Using cache
---> d8c76624cb9d
Step 8/12 : RUN git checkout $MOUTHFUL_VER && chmod +x build.sh && ./build.sh && cd dist/ && file mouthful && upx --best mouthful && file mouthful
---> Running in 4a48e4056d56
Note: checking out '1.0.2'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b <new-branch-name>
HEAD is now at 216eccc... removed redundant logging
> [email protected] install /go/src/github.com/vkuznecovas/mouthful/client/node_modules/node-sass
> node scripts/install.js
Downloading binary from https://github.com/sass/node-sass/releases/download/v4.5.3/linux_musl-x64-57_binding.node
Download complete
Binary saved to /go/src/github.com/vkuznecovas/mouthful/client/node_modules/node-sass/vendor/linux_musl-x64-57/binding.node
Caching binary to /root/.npm/node-sass/4.5.3/linux_musl-x64-57_binding.node
> [email protected] postinstall /go/src/github.com/vkuznecovas/mouthful/client/node_modules/preact
> node -e "console.log('\u001b[35m\u001b[1mLove Preact? You can now donate to our open collective:\u001b[22m\u001b[39m\n > \u001b[34mhttps://opencollective.com/preact/donate\u001b[0m')"
Love Preact? You can now donate to our open collective:
> https://opencollective.com/preact/donate
> [email protected] postinstall /go/src/github.com/vkuznecovas/mouthful/client/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js
> [email protected] postinstall /go/src/github.com/vkuznecovas/mouthful/client/node_modules/simplehttp2server
> node lib/install.js
> [email protected] postinstall /go/src/github.com/vkuznecovas/mouthful/client/node_modules/node-sass
> node scripts/build.js
Binary found at /go/src/github.com/vkuznecovas/mouthful/client/node_modules/node-sass/vendor/linux_musl-x64-57/binding.node
Testing binary
Binary is fine
> [email protected] postinstall /go/src/github.com/vkuznecovas/mouthful/client/node_modules/preact-cli
> node -p 'require("./check.js")()'
true
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 1592 packages in 42.109s
> [email protected] build /go/src/github.com/vkuznecovas/mouthful/client
> preact build --no-prerender --clean --template src/index.ejs --service-worker false
(node:89) DeprecationWarning: Chunk.modules is deprecated. Use Chunk.getNumberOfModules/mapModules/forEachModule/containsModule instead.
Total precache size is about 110 kB for 5 resources.
npm WARN deprecated [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
> [email protected] postinstall /go/src/github.com/vkuznecovas/mouthful/admin/node_modules/preact
> node -e "console.log('\u001b[35m\u001b[1mLove Preact? You can now donate to our open collective:\u001b[22m\u001b[39m\n > \u001b[34mhttps://opencollective.com/preact/donate\u001b[0m')"
Love Preact? You can now donate to our open collective:
> https://opencollective.com/preact/donate
> [email protected] postinstall /go/src/github.com/vkuznecovas/mouthful/admin/node_modules/uglifyjs-webpack-plugin
> node lib/post_install.js
> [email protected] postinstall /go/src/github.com/vkuznecovas/mouthful/admin/node_modules/simplehttp2server
> node lib/install.js
> [email protected] postinstall /go/src/github.com/vkuznecovas/mouthful/admin/node_modules/preact-cli
> node -p 'require("./check.js")()'
true
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
added 1787 packages in 46.889s
> [email protected] build /go/src/github.com/vkuznecovas/mouthful/admin
> preact build
Total precache size is about 51.3 kB for 6 resources.
mouthful: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib/ld-musl-x86_64.so.1, not stripped
Ultimate Packer for eXecutables
Copyright (C) 1996 - 2017
UPX 3.94 Markus Oberhumer, Laszlo Molnar & John Reiser May 12th 2017
File size Ratio Format Name
-------------------- ------ ----------- -----------
26995064 -> 7621240 28.23% linux/amd64 mouthful
Packed 1 file.
mouthful: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically linked, stripped
Removing intermediate container 4a48e4056d56
---> 48195ebd4fef
Step 9/12 : FROM alpine:3.7
---> 3fd9065eaf02
Step 10/12 : COPY --from=0 /go/src/github.com/vkuznecovas/mouthful/dist/ /
---> f74e6b003899
Step 11/12 : EXPOSE 8080
---> Running in c4f0e011cfba
Removing intermediate container c4f0e011cfba
---> 217a7ecbac7b
Step 12/12 : CMD ["/mouthful"]
---> Running in 1414d1f70af5
Removing intermediate container 1414d1f70af5
---> a8f1e13af887
Successfully built a8f1e13af887
Successfully tagged mouthful:latest
$ docker run --rm -p 8080:8080 mouthful
panic: Please change the config.Moderation.AdminPassword value in config. Do not leave the default there
goroutine 1 [running]:
main.main()
/go/src/github.com/vkuznecovas/mouthful/main.go:40 +0x486 Most likely i'll change the default config location to somewhere else, if you agree, so i can add something like |
I think anything above 1.8 GO should work. Nice to see you got it built. Do make a PR with the default config change :) |
Will do, but before I'm gonna test it out |
I'm building a Docker image for mouthful, everything went well until it attempts to build the binary
Dockerfile
Output
It all seems the problem is at
vendor/github.com/mattn/go-sqlite3/sqlite3_go18.go:18:10: undefined: SQLiteConn
.The text was updated successfully, but these errors were encountered: