Skip to content
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

Errors when updating to the newest version #26

Closed
fosini opened this issue Jun 27, 2018 · 20 comments
Closed

Errors when updating to the newest version #26

fosini opened this issue Jun 27, 2018 · 20 comments

Comments

@fosini
Copy link

fosini commented Jun 27, 2018

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:

In file included from /usr/local/go/pkg/src/github.com/bakape/thumbnailer/build_flags_gpl.go:10:
/usr/local/go/pkg/src/github.com/bakape/thumbnailer/libimagequant/libimagequant.c:158:30: warning: implicitly declaring library function 'vsnprintf' with type 'int (char *, unsigned long, const char *, struct __va_list_tag *)' [-Wimplicit-function-declaration]
/usr/local/go/pkg/src/github.com/bakape/thumbnailer/libimagequant/libimagequant.c:158:30: note: include the header <stdio.h> or explicitly provide a declaration for 'vsnprintf'
# github.com/bakape/thumbnailer
In file included from init.c:2:
In file included from /usr/local/Cellar/graphicsmagick/1.3.28_1/include/GraphicsMagick/magick/api.h:87:
/usr/local/Cellar/graphicsmagick/1.3.28_1/include/GraphicsMagick/magick/memory.h:17:48: warning: '__alloc_size__' attribute only applies to functions [-Wignored-attributes]
/usr/local/Cellar/graphicsmagick/1.3.28_1/include/GraphicsMagick/magick/common.h:188:70: note: expanded from macro 'MAGICK_FUNC_ALLOC_SIZE_1ARG'
In file included from init.c:2:
In file included from /usr/local/Cellar/graphicsmagick/1.3.28_1/include/GraphicsMagick/magick/api.h:87:
/usr/local/Cellar/graphicsmagick/1.3.28_1/include/GraphicsMagick/magick/memory.h:19:60: warning: '__alloc_size__' attribute only applies to functions [-Wignored-attributes]
/usr/local/Cellar/graphicsmagick/1.3.28_1/include/GraphicsMagick/magick/common.h:188:70: note: expanded from macro 'MAGICK_FUNC_ALLOC_SIZE_1ARG'
# github.com/bakape/thumbnailer
video.c:41:23: warning: address of array 'f->data' will always evaluate to 'true' [-Wpointer-bool-conversion]
video.c:79:59: warning: duplicate 'const' declaration specifier [-Wduplicate-decl-specifier]
video.c:124:39: warning: address of array 'frames[0]->data' will always evaluate to 'true' [-Wpointer-bool-conversion]
# github.com/bakape/thumbnailer
error: invalid value 'c++17' in '-std=c++17'

Can anyone help me with this? I just don't know what to do.

@fosini fosini changed the title Errors when updating to the newest versionn Errors when updating to the newest version Jun 27, 2018
@bakape
Copy link
Owner

bakape commented Jun 27, 2018

I changed some dependencies. You need a C++17 compiler and GraphicsMagick++ installed on your system.

@fosini
Copy link
Author

fosini commented Jun 27, 2018

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.

@bakape
Copy link
Owner

bakape commented Jun 27, 2018

Are you cross-compiling?

@fosini
Copy link
Author

fosini commented Jun 27, 2018

Yes, I am.

@bakape
Copy link
Owner

bakape commented Jun 27, 2018

Well that is very odd, considering it's on the Go side. Try checking for integrity with git status.

@fosini
Copy link
Author

fosini commented Jun 27, 2018

I already did. Everything works fine when I do not use the GOOS=linux option :(

@bakape
Copy link
Owner

bakape commented Jun 27, 2018 via email

@fosini
Copy link
Author

fosini commented Jun 29, 2018

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.

@bakape
Copy link
Owner

bakape commented Jun 29, 2018 via email

@fosini
Copy link
Author

fosini commented Jun 29, 2018

Thanks for your quick response. I'm running Ubuntu 16.04.4 LTS.

@bakape
Copy link
Owner

bakape commented Jun 29, 2018 via email

@fosini
Copy link
Author

fosini commented Jun 30, 2018

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

@bakape
Copy link
Owner

bakape commented Jun 30, 2018 via email

@fosini
Copy link
Author

fosini commented Jun 30, 2018

The latest version is already installed :(
Thank you for trying to help me!

@fosini
Copy link
Author

fosini commented Jul 2, 2018

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!

@bakape
Copy link
Owner

bakape commented Jul 2, 2018

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.

@fosini
Copy link
Author

fosini commented Jul 2, 2018

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!

@fosini
Copy link
Author

fosini commented Jul 2, 2018

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.

@bakape
Copy link
Owner

bakape commented Jul 2, 2018

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.

@fosini
Copy link
Author

fosini commented Jul 4, 2018

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!

@fosini fosini closed this as completed Jul 4, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants