Closed fosini closed 6 years ago
I changed some dependencies. You need a C++17 compiler and GraphicsMagick++ installed on your system.
After hours of trying, I finally managed to fix everything, thanks a lot.
However, I still have one problem. If I try to build the app using the following command:
GOOS=linux GOARCH=amd64 go build -o application application.go
then I receive following error message and the build fails:
github.com/0xSeven/thumbnailer /usr/local/go/pkg/src/github.com/0xSeven/thumbnailer/main.go:20:2: undefined: Image
Do you know how I can possibly fix that? I can run it without any problems in the IDE, but when I try to build it manually, I get this error message.
Anyways, thanks a lot for the help.
Are you cross-compiling?
Yes, I am.
Well that is very odd, considering it's on the Go side. Try checking for integrity with git status
.
I already did. Everything works fine when I do not use the GOOS=linux
option :(
Odd.
On 27 June 2018 at 21:56, 0xSeven notifications@github.com wrote:
I already did. Everything works fine when I do not use the GOOS=linux option :(
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bakape/thumbnailer/issues/26#issuecomment-400792003, or mute the thread https://github.com/notifications/unsubscribe-auth/AHfPsDjG8Rx3cnhavvoCUPYyIqfEL7uOks5uA9VrgaJpZM4U5oYb .
Hello bakape. I switched to a linux envrionment now and when I try to run/build my app, I get following error message:
# github.com/0xSeven/thumbnailer
/usr/bin/ld: /usr/local/lib/libGraphicsMagick.a(magick_libGraphicsMagick_la-shear.o): undefined reference to symbol 'trunc@@GLIBC_2.2.5'
//lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
I don't know what to do anymore, I tried everything I can to get this thing running. Please bakape, I beg you for help or hints. I'm just a go noob who tries to launch his first go app on an amazon ec2. Please, sir.
What distro+version is the running in the EC2 instance?
On 29 June 2018 at 17:22, 0xSeven notifications@github.com wrote:
Hello bakape. I switched to a linux envrionment now and when I try to run/build my app, I get following error message:
github.com/0xSeven/thumbnailer
/usr/bin/ld http://github.com/0xSeven/thumbnailer/usr/bin/ld: /usr/local/lib/libGraphicsMagick.a(magick_libGraphicsMagick_la-shear.o): undefined reference to symbol 'trunc@@GLIBC_2.2.5' //lib/x86_64-linux-gnu/libm.so.6: error adding symbols: DSO missing from command line
I don't know what to do anymore, I tried everything I can to get this thing running. Please bakape, I beg you for help or hints. I'm just a go noob who tries to launch his first go app on an amazon ec2. Please.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bakape/thumbnailer/issues/26#issuecomment-401369522, or mute the thread https://github.com/notifications/unsubscribe-auth/AHfPsC1yW0Xru35gV7av34x5ZIC-UL9Pks5uBjg2gaJpZM4U5oYb .
Thanks for your quick response. I'm running Ubuntu 16.04.4 LTS.
github.com/0xSeven/thumbnailer http://github.com/0xSeven/thumbnailer/usr/bin/ld
Oh, it's a different repo. I think you are missing some CFLAGS. See https://github.com/bakape/thumbnailer/blob/master/thumbnailer.go#L3-L8
On 29 June 2018 at 17:28, 0xSeven notifications@github.com wrote:
Thanks for your quick response. I'm running Ubuntu 16.04.4 LTS.
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bakape/thumbnailer/issues/26#issuecomment-401371151, or mute the thread https://github.com/notifications/unsubscribe-auth/AHfPsIoEsOX_pmEHzC_9tTLDeTyvAmGVks5uBjl7gaJpZM4U5oYb .
Hello bakape! I was using a 2 months old fork that was 12 commits behind the master. Well, I upgraded now everything to this repo, the newest version, and I'm still getting an undefined reference to symbol 'gzxclose' error (a different one this time):
-# github.com/bakape/thumbnailer
/usr/bin/ld: /usr/local/lib/libGraphicsMagick.a(magick_libGraphicsMagick_la-blob.o): undefined reference to symbol 'gzclose'
//lib/x86_64-linux-gnu/libz.so.1: error adding symbols: DSO missing from command line
Try installing zlib dev package. Might be an undocumented dependency on my part.
On 30 June 2018 at 15:53, 0xSeven notifications@github.com wrote:
Hello bakape! I was using a 2 months old fork that was 12 commits behind the master. Well, I upgraded now everything to this repo, the newest version, and I'm still getting an undefined reference to symbol 'gzxclose' error (a different one this time):
-# github.com/bakape/thumbnailer /usr/bin/ld http://github.com/bakape/thumbnailer/usr/bin/ld: /usr/local/lib/libGraphicsMagick.a(magick_libGraphicsMagick_la-blob.o): undefined reference to symbol 'gzclose' //lib/x86_64-linux-gnu/libz.so.1: error adding symbols: DSO missing from command line
— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/bakape/thumbnailer/issues/26#issuecomment-401539440, or mute the thread https://github.com/notifications/unsubscribe-auth/AHfPsCQ0SvCRIy2ir8ynztO_h8P4_LLEks5uB3TcgaJpZM4U5oYb .
The latest version is already installed :( Thank you for trying to help me!
Hello bakape. I found out, that my EC2 instance (Ubuntu, 16.04.4 LTS) is unable to even get the library. If I type in the following command:
`go get -t github.com/bakape/thumbnailer
then I'm getting the same error message:
`-# github.com/bakape/thumbnailer /usr/bin/ld: /usr/bin/ld: /usr/local/lib/libGraphicsMagick.a(magick_libGraphicsMagick_la-blob.o): undefined reference to symbol 'gzclose' //lib/x86_64-linux-gnu/libz.so.1: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status
I even created several SO Posts, one of them is: https://stackoverflow.com/questions/51091789/undefined-reference-to-symbol-gzclose-error-when-getting-library-go
After days of trying to fix this, I strongly believe that the library's Makefile or build-flags is causing this error.
Greetings!
Just to be sure, run go get -u -v -x github.com/bakape/thumbnailer
and post the output here.
I strongly believe that the library's Makefile is causing this error.
What made you think that? AFAIK Go does not take into account any Makefiles in the project.
This is the raw output of the command:
ubuntu@root:~$ go get -u -v -x github.com/bakape/thumbnailer
cd /home/ubuntu/go/src/github.com/bakape/thumbnailer
git config remote.origin.url
github.com/bakape/thumbnailer (download)
cd /home/ubuntu/go/src/github.com/bakape/thumbnailer
git pull --ff-only
cd /home/ubuntu/go/src/github.com/bakape/thumbnailer
git submodule update --init --recursive
cd /home/ubuntu/go/src/github.com/bakape/thumbnailer
git show-ref
cd /home/ubuntu/go/src/github.com/bakape/thumbnailer
git submodule update --init --recursive
WORK=/tmp/go-build312713059
github.com/bakape/thumbnailer
mkdir -p $WORK/github.com/bakape/thumbnailer/_obj/
mkdir -p $WORK/github.com/bakape/
cd /home/ubuntu/go/src/github.com/bakape/thumbnailer
pkg-config --cflags libavcodec libavutil libavformat GraphicsMagick++ libavcodec libavutil libavformat libswscale
pkg-config --libs libavcodec libavutil libavformat GraphicsMagick++ libavcodec libavutil libavformat libswscale
CGO_LDFLAGS="-g" "-O2" "-lm" "-L/usr/local/lib" "-lGraphicsMagick++" "-lGraphicsMagick" "-lavcodec" "-lavutil" "-lavformat" "-lswscale" /usr/local/go/pkg/tool/linux_amd64/cgo -objdir $WORK/github.com/bakape/thumbnailer/_obj/ -importpath github.com/bakape/thumbnailer -- -I/usr/local/include/GraphicsMagick -I/usr/include/x86_64-linux-gnu -I $WORK/github.com/bakape/thumbnailer/_obj/ -g -O2 -I/home/ubuntu/go/src/github.com/bakape/thumbnailer/libimagequant -std=c11 -std=c11 -O3 -D_POSIX_C_SOURCE -std=c11 audio.go buf.go build_flags_gpl.go ffmpeg.go meta.go thumbnailer.go video.go
cd $WORK
gcc -fdebug-prefix-map=a=b -c trivial.c
gcc -gno-record-gcc-switches -c trivial.c
cd $WORK/github.com/bakape/thumbnailer/_obj
gcc -I /home/ubuntu/go/src/github.com/bakape/thumbnailer -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I/usr/local/include/GraphicsMagick -I/usr/include/x86_64-linux-gnu -I ./ -g -O2 -I/home/ubuntu/go/src/github.com/bakape/thumbnailer/libimagequant -std=c11 -std=c11 -O3 -D_POSIX_C_SOURCE -std=c11 -o ./_cgo_export.o -c _cgo_export.c
gcc -I /home/ubuntu/go/src/github.com/bakape/thumbnailer -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I/usr/local/include/GraphicsMagick -I/usr/include/x86_64-linux-gnu -I ./ -g -O2 -I/home/ubuntu/go/src/github.com/bakape/thumbnailer/libimagequant -std=c11 -std=c11 -O3 -D_POSIX_C_SOURCE -std=c11 -o ./audio.cgo2.o -c audio.cgo2.c
gcc -I /home/ubuntu/go/src/github.com/bakape/thumbnailer -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I/usr/local/include/GraphicsMagick -I/usr/include/x86_64-linux-gnu -I ./ -g -O2 -I/home/ubuntu/go/src/github.com/bakape/thumbnailer/libimagequant -std=c11 -std=c11 -O3 -D_POSIX_C_SOURCE -std=c11 -o ./buf.cgo2.o -c buf.cgo2.c
gcc -I /home/ubuntu/go/src/github.com/bakape/thumbnailer -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I/usr/local/include/GraphicsMagick -I/usr/include/x86_64-linux-gnu -I ./ -g -O2 -I/home/ubuntu/go/src/github.com/bakape/thumbnailer/libimagequant -std=c11 -std=c11 -O3 -D_POSIX_C_SOURCE -std=c11 -o ./build_flags_gpl.cgo2.o -c build_flags_gpl.cgo2.c
gcc -I /home/ubuntu/go/src/github.com/bakape/thumbnailer -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I/usr/local/include/GraphicsMagick -I/usr/include/x86_64-linux-gnu -I ./ -g -O2 -I/home/ubuntu/go/src/github.com/bakape/thumbnailer/libimagequant -std=c11 -std=c11 -O3 -D_POSIX_C_SOURCE -std=c11 -o ./ffmpeg.cgo2.o -c ffmpeg.cgo2.c
gcc -I /home/ubuntu/go/src/github.com/bakape/thumbnailer -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I/usr/local/include/GraphicsMagick -I/usr/include/x86_64-linux-gnu -I ./ -g -O2 -I/home/ubuntu/go/src/github.com/bakape/thumbnailer/libimagequant -std=c11 -std=c11 -O3 -D_POSIX_C_SOURCE -std=c11 -o ./meta.cgo2.o -c meta.cgo2.c
gcc -I /home/ubuntu/go/src/github.com/bakape/thumbnailer -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I/usr/local/include/GraphicsMagick -I/usr/include/x86_64-linux-gnu -I ./ -g -O2 -I/home/ubuntu/go/src/github.com/bakape/thumbnailer/libimagequant -std=c11 -std=c11 -O3 -D_POSIX_C_SOURCE -std=c11 -o ./thumbnailer.cgo2.o -c thumbnailer.cgo2.c
gcc -I /home/ubuntu/go/src/github.com/bakape/thumbnailer -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I/usr/local/include/GraphicsMagick -I/usr/include/x86_64-linux-gnu -I ./ -g -O2 -I/home/ubuntu/go/src/github.com/bakape/thumbnailer/libimagequant -std=c11 -std=c11 -O3 -D_POSIX_C_SOURCE -std=c11 -o ./video.cgo2.o -c video.cgo2.c
cd /home/ubuntu/go/src/github.com/bakape/thumbnailer
gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I/usr/local/include/GraphicsMagick -I/usr/include/x86_64-linux-gnu -I $WORK/github.com/bakape/thumbnailer/_obj/ -g -O2 -I/home/ubuntu/go/src/github.com/bakape/thumbnailer/libimagequant -std=c11 -std=c11 -O3 -D_POSIX_C_SOURCE -std=c11 -o $WORK/github.com/bakape/thumbnailer/_obj/audio.o -c audio.c
gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I/usr/local/include/GraphicsMagick -I/usr/include/x86_64-linux-gnu -I $WORK/github.com/bakape/thumbnailer/_obj/ -g -O2 -I/home/ubuntu/go/src/github.com/bakape/thumbnailer/libimagequant -std=c11 -std=c11 -O3 -D_POSIX_C_SOURCE -std=c11 -o $WORK/github.com/bakape/thumbnailer/_obj/ffmpeg.o -c ffmpeg.c
gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I/usr/local/include/GraphicsMagick -I/usr/include/x86_64-linux-gnu -I $WORK/github.com/bakape/thumbnailer/_obj/ -g -O2 -I/home/ubuntu/go/src/github.com/bakape/thumbnailer/libimagequant -std=c11 -std=c11 -O3 -D_POSIX_C_SOURCE -std=c11 -o $WORK/github.com/bakape/thumbnailer/_obj/init.o -c init.c
gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I/usr/local/include/GraphicsMagick -I/usr/include/x86_64-linux-gnu -I $WORK/github.com/bakape/thumbnailer/_obj/ -g -O2 -I/home/ubuntu/go/src/github.com/bakape/thumbnailer/libimagequant -std=c11 -std=c11 -O3 -D_POSIX_C_SOURCE -std=c11 -o $WORK/github.com/bakape/thumbnailer/_obj/meta.o -c meta.c
gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I/usr/local/include/GraphicsMagick -I/usr/include/x86_64-linux-gnu -I $WORK/github.com/bakape/thumbnailer/_obj/ -g -O2 -I/home/ubuntu/go/src/github.com/bakape/thumbnailer/libimagequant -std=c11 -std=c11 -O3 -D_POSIX_C_SOURCE -std=c11 -o $WORK/github.com/bakape/thumbnailer/_obj/video.o -c video.c
g++ -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I/usr/local/include/GraphicsMagick -I/usr/include/x86_64-linux-gnu -I $WORK/github.com/bakape/thumbnailer/_obj/ -g -O2 -I/home/ubuntu/go/src/github.com/bakape/thumbnailer/libimagequant -I/home/ubuntu/go/src/github.com/bakape/thumbnailer/lodepng -std=c++17 -O3 -o $WORK/github.com/bakape/thumbnailer/_obj/compress_png.cc.o -c compress_png.cc
g++ -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I/usr/local/include/GraphicsMagick -I/usr/include/x86_64-linux-gnu -I $WORK/github.com/bakape/thumbnailer/_obj/ -g -O2 -I/home/ubuntu/go/src/github.com/bakape/thumbnailer/libimagequant -I/home/ubuntu/go/src/github.com/bakape/thumbnailer/lodepng -std=c++17 -O3 -o $WORK/github.com/bakape/thumbnailer/_obj/thumbnailer.cc.o -c thumbnailer.cc
g++ -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I/usr/local/include/GraphicsMagick -I/usr/include/x86_64-linux-gnu -I $WORK/github.com/bakape/thumbnailer/_obj/ -g -O2 -I/home/ubuntu/go/src/github.com/bakape/thumbnailer/libimagequant -I/home/ubuntu/go/src/github.com/bakape/thumbnailer/lodepng -std=c++17 -O3 -o $WORK/github.com/bakape/thumbnailer/_obj/util.cc.o -c util.cc
cd $WORK/github.com/bakape/thumbnailer/_obj
gcc -I /home/ubuntu/go/src/github.com/bakape/thumbnailer -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -I/usr/local/include/GraphicsMagick -I/usr/include/x86_64-linux-gnu -I ./ -g -O2 -I/home/ubuntu/go/src/github.com/bakape/thumbnailer/libimagequant -std=c11 -std=c11 -O3 -D_POSIX_C_SOURCE -std=c11 -o ./_cgo_main.o -c _cgo_main.c
cd /home/ubuntu/go/src/github.com/bakape/thumbnailer
g++ -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK=/tmp/go-build -gno-record-gcc-switches -o $WORK/github.com/bakape/thumbnailer/_obj/_cgo_.o $WORK/github.com/bakape/thumbnailer/_obj/_cgo_main.o $WORK/github.com/bakape/thumbnailer/_obj/_cgo_export.o $WORK/github.com/bakape/thumbnailer/_obj/audio.cgo2.o $WORK/github.com/bakape/thumbnailer/_obj/buf.cgo2.o $WORK/github.com/bakape/thumbnailer/_obj/build_flags_gpl.cgo2.o $WORK/github.com/bakape/thumbnailer/_obj/ffmpeg.cgo2.o $WORK/github.com/bakape/thumbnailer/_obj/meta.cgo2.o $WORK/github.com/bakape/thumbnailer/_obj/thumbnailer.cgo2.o $WORK/github.com/bakape/thumbnailer/_obj/video.cgo2.o $WORK/github.com/bakape/thumbnailer/_obj/audio.o $WORK/github.com/bakape/thumbnailer/_obj/ffmpeg.o $WORK/github.com/bakape/thumbnailer/_obj/init.o $WORK/github.com/bakape/thumbnailer/_obj/meta.o $WORK/github.com/bakape/thumbnailer/_obj/video.o $WORK/github.com/bakape/thumbnailer/_obj/compress_png.cc.o $WORK/github.com/bakape/thumbnailer/_obj/thumbnailer.cc.o $WORK/github.com/bakape/thumbnailer/_obj/util.cc.o -g -O2 -lm -L/usr/local/lib -lGraphicsMagick++ -lGraphicsMagick -lavcodec -lavutil -lavformat -lswscale
# github.com/bakape/thumbnailer
/usr/bin/ld: /usr/local/lib/libGraphicsMagick.a(magick_libGraphicsMagick_la-blob.o): undefined reference to symbol 'gzclose'
//lib/x86_64-linux-gnu/libz.so.1: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status
Well, people who encountered the same error fixed this by modifying the Makefile.
Best regards!
Hey bakape. Sorry if I keep annoying you, but please help me one last time.
On the last few lines the: g++ -I . -fPIC -m64 -pthread x ......... command
- is there any way to provide a -lz option when using go get? I think adding -lz at the end will fix everything.
Well, people who encountered the same error fixed this by modifying the Makefile.
Because they actually use makefiles to build.
/usr/local/lib/libGraphicsMagick.a
You built a local static GraphicsMagick, so any incompatibility stems from this. Try adding -extldflags="-lz"
to the command line.
All those errors really are because of the static GraphicsMagick build. Now everything runs fine. I love you, dude! You helped me so much in my life, thank you so much!
Hello, I just updated to the newest version and I get a bunch of error messages when I try to start my go application now. Everything was working perfectly fine before the upgrade.
This is the list of all error messages:
Can anyone help me with this? I just don't know what to do.