Когда я пытаюсь получить одну из моих библиотек на моем компьютере с Linux следующей командой:
go get -t github.com/bakape/thumbnailer
тогда я получаю это сообщение об ошибке:
- # github.com/bakape/thumbnailer / usr / bin / ld: / usr / bin / ld: /usr/local/lib/libGraphicsMagick.a(magick_libGraphicsMagick_la-blob.o): неопределенная ссылка на символ gzclose '
//lib/x86_64-linux-gnu/libz.so.1: ошибка при добавлении символов: DSO отсутствует в командной строке
collect2: ошибка: ld вернул 1 статус выхода
Люди, которые столкнулись с этой ошибкой, сказали, что это ошибка компоновки, и исправили ее, добавив некоторые дополнительные теги в Makefile. Я тоже так делал, но у меня это не получалось. Я перепробовал так много решений, но мне кажется, что ничего не работает.
Я использую следующую библиотеку:
https://github.com/bakape/thumbnailer
Это Makefile:
clean:
rm -f testdata/*_thumb.*
Создатель упомянул недокументированные зависимости zlib. Все они установлены:
zlib1g is already the newest version (1:1.2.8.dfsg-2ubuntu4.1).
zlib1g-dev is already the newest version (1:1.2.8.dfsg-2ubuntu4.1).
-
ubuntu@root:~$ ls -F -sh /lib/x86_64-linux-gnu/libz.*
0 /lib/x86_64-linux-gnu/libz.so.1@ 104K /lib/x86_64-linux-gnu/libz.so.1.2.8
Вот полный процесс установки:
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