Lymphatus / libcaesium

The Caesium compression library written in Rust (with a C interface)
Apache License 2.0
128 stars 23 forks source link

Error when running make #3

Closed noodlebreak closed 7 years ago

noodlebreak commented 7 years ago

Hi.

I'm using Ubuntu 14.04.

I installed the dependencies using install.sh,

(2064)-> sudo ./install.sh 
Cloning into 'mozjpeg'...
remote: Counting objects: 13739, done.
remote: Total 13739 (delta 0), reused 0 (delta 0), pack-reused 13739
Receiving objects: 100% (13739/13739), 9.49 MiB | 128.00 KiB/s, done.
Resolving deltas: 100% (9582/9582), done.
Checking connectivity... done.
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force 
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
configure.ac:18: installing './ar-lib'
configure.ac:16: installing './compile'
configure.ac:23: installing './config.guess'
configure.ac:23: installing './config.sub'
configure.ac:8: installing './install-sh'
configure.ac:23: error: required file './ltmain.sh' not found
configure.ac:8: installing './missing'
Makefile.am: installing './depcomp'
autoreconf: automake failed with exit status: 1
autoreconf: Entering directory `.'
autoreconf: configure.ac: not using Gettext
autoreconf: running: aclocal --force 
autoreconf: configure.ac: tracing
autoreconf: running: libtoolize --copy --force
libtoolize: putting auxiliary files in `.'.
libtoolize: copying file `./ltmain.sh'
libtoolize: Consider adding `AC_CONFIG_MACRO_DIR([m4])' to configure.ac and
libtoolize: rerunning libtoolize, to keep the correct libtool macros in-tree.
libtoolize: Consider adding `-I m4' to ACLOCAL_AMFLAGS in Makefile.am.
autoreconf: running: /usr/bin/autoconf --force
autoreconf: running: /usr/bin/autoheader --force
autoreconf: running: automake --add-missing --copy --force-missing
autoreconf: Leaving directory `.'
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports nested variables... (cached) yes
checking for style of include used by make... GNU
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking how to run the C preprocessor... gcc -E
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking whether gcc understands -c and -o together... (cached) yes
checking dependency style of gcc... (cached) gcc3
checking for ar... ar
checking the archiver (ar) interface... ar
checking dependency style of gcc... gcc3
checking the archiver (ar) interface... (cached) ar
checking build system type... x86_64-unknown-linux-gnu
checking host system type... x86_64-unknown-linux-gnu
checking how to print strings... printf
checking for a sed that does not truncate output... /bin/sed
checking for grep that handles long lines and -e... /bin/grep
checking for egrep... /bin/grep -E
checking for fgrep... /bin/grep -F
checking for ld used by gcc... /usr/bin/ld
checking if the linker (/usr/bin/ld) is GNU ld... yes
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 1572864
checking whether the shell understands some XSI constructs... yes
checking whether the shell understands "+="... yes
checking how to convert x86_64-unknown-linux-gnu file names to x86_64-unknown-linux-gnu format... func_convert_file_noop
checking how to convert x86_64-unknown-linux-gnu file names to toolchain format... func_convert_file_noop
checking for /usr/bin/ld option to reload object files... -r
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for archiver @FILE support... @
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for mt... mt
checking if mt is a manifest tool... no
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... no
checking for gcc option to produce PIC... -fPIC -DPIC
checking if gcc PIC flag -fPIC -DPIC works... yes
checking if gcc static flag -static works... yes
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/usr/bin/ld -m elf_x86_64) supports shared libraries... yes
checking whether -lc should be explicitly linked in... no
checking dynamic linker characteristics... GNU/Linux ld.so
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking whether ln -s works... yes
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking size of size_t... 8
checking whether compiler supports pointers to undefined structures... yes
checking whether __SUNPRO_C is declared... no
checking for pow in -lm... yes
checking for libpng... yes
checking for ANSI C header files... (cached) yes
checking stddef.h usability... yes
checking stddef.h presence... yes
checking for stddef.h... yes
checking for stdlib.h... (cached) yes
checking locale.h usability... yes
checking locale.h presence... yes
checking for locale.h... yes
checking for string.h... (cached) yes
checking for sys/types.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking whether char is unsigned... no
checking for inline... inline
checking for size_t... yes
checking for unsigned char... yes
checking for unsigned short... yes
checking if right shift is signed... yes
checking for memset... yes
checking for memcpy... yes
checking libjpeg API version... 6.2
checking whether to include in-memory source/destination managers... yes
checking libjpeg shared library version... 62.2.0
checking whether the linker supports version scripts... yes (GNU style)
checking whether to use version script when building mozjpeg... yes
checking for inline... inline __attribute__((always_inline))
checking whether to include arithmetic encoding support... yes
checking whether to include arithmetic decoding support... yes
checking whether to use 12-bit samples... no
checking whether to build TurboJPEG C wrapper... yes
checking whether to build TurboJPEG Java wrapper... no
checking if we have SIMD optimisations for cpu type... yes (x86_64)
checking for nasm... no
checking for nasmw... no
checking for yasm... no
configure: error: no nasm (Netwide Assembler) found
make: *** No targets specified and no makefile found.  Stop.
Cloning into 'zopfli'...
remote: Counting objects: 518, done.
remote: Total 518 (delta 0), reused 0 (delta 0), pack-reused 518
Receiving objects: 100% (518/518), 429.77 KiB | 45.00 KiB/s, done.
Resolving deltas: 100% (286/286), done.
Checking connectivity... done.
gcc src/zopfli/blocksplitter.c src/zopfli/cache.c src/zopfli/deflate.c src/zopfli/gzip_container.c src/zopfli/hash.c src/zopfli/katajainen.c src/zopfli/lz77.c src/zopfli/squeeze.c src/zopfli/tree.c src/zopfli/util.c src/zopfli/zlib_container.c src/zopfli/zopfli_lib.c -W -Wall -Wextra -ansi -pedantic -lm -O2 -Wno-unused-function -fPIC -c
g++ blocksplitter.o cache.o deflate.o gzip_container.o hash.o katajainen.o lz77.o squeeze.o tree.o util.o zlib_container.o zopfli_lib.o src/zopflipng/lodepng/lodepng.cpp src/zopflipng/lodepng/lodepng_util.cpp src/zopflipng/zopflipng_lib.cc -W -Wall -Wextra -ansi -pedantic -lm -O2 -Wno-unused-function -fPIC --shared -Wl,-soname,libzopflipng.so.1 -o libzopflipng.so.1.0.0

Then I ran cmake:

 (2067)-> cmake ..
-- The C compiler identification is GNU 4.8.4
-- The CXX compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/libcaesium/build

Then I ran make:

   (2068)-> make
Scanning dependencies of target caesium
[  7%] Building C object caesium/CMakeFiles/caesium.dir/caesium.c.o
[ 15%] Building C object caesium/CMakeFiles/caesium.dir/error.c.o
[ 23%] Building C object caesium/CMakeFiles/caesium.dir/utils.c.o
[ 30%] Building C object caesium/CMakeFiles/caesium.dir/png.c.o
[ 38%] Building C object caesium/CMakeFiles/caesium.dir/lodepng.c.o
[ 46%] Building C object caesium/CMakeFiles/caesium.dir/jpeg.c.o
Linking C shared library libcaesium.so
/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libturbojpeg.a(libturbojpeg_la-turbojpeg.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libturbojpeg.a: error adding symbols: Bad value
collect2: error: ld returned 1 exit status
make[2]: *** [caesium/libcaesium.so] Error 1
make[1]: *** [caesium/CMakeFiles/caesium.dir/all] Error 2
make: *** [all] Error 2

Already had install libjpeg turbo:

sudo dpkg -i libjpeg-turbo-official_1.3.1_amd64.deb

Can anyone help out with this error then :

/usr/bin/ld: /usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libturbojpeg.a(libturbojpeg_la-turbojpeg.o): relocation R_X86_64_32 against `.data' can not be used when making a shared object; recompile with -fPIC
/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../x86_64-linux-gnu/libturbojpeg.a: error adding symbols: Bad value
Lymphatus commented 7 years ago

Hi,

libcaesium uses mozjpeg, which is cloned from their repo with the install.sh script. If you look at its log, it failed the installation because you didn't have NASM.

Run

sudo apt-get install libtool autoconf git nasm pkg-config cmake

to install all dependencies needed by the libraries, then run install.sh again and try to compile libcaesium.

EDIT: I should insert in the README.md that you need NASM and basic developer tools in order to compile the required libraries. My bad.

noodlebreak commented 7 years ago

@Lymphatus Thanks, a lot. That worked.