Lymphatus / libcaesium

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

Meet error when run make #5

Closed suyanhanx closed 6 years ago

suyanhanx commented 6 years ago

I run all scripts from this repo's .travis.yml, but when run make it meets error.

Can you tell me how to solve it ?

[  6%] Building C object caesium/CMakeFiles/caesium.dir/caesium.c.o
In file included from /mnt/e/source/caesium/libcaesium/caesium/caesium.c:7:0:
/mnt/e/source/caesium/libcaesium/caesium/jpeg.h:4:21: fatal error: jpeglib.h: No such file or directory
 #include <jpeglib.h>
                     ^
compilation terminated.
caesium/CMakeFiles/caesium.dir/build.make:62: recipe for target 'caesium/CMakeFiles/caesium.dir/caesium.c.o' failed
make[2]: *** [caesium/CMakeFiles/caesium.dir/caesium.c.o] Error 1
CMakeFiles/Makefile2:87: recipe for target 'caesium/CMakeFiles/caesium.dir/all' failed
make[1]: *** [caesium/CMakeFiles/caesium.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2
suyanhanx commented 6 years ago

When run make in demo dir, it meets the same error.

Lymphatus commented 6 years ago

Which OS are you running? The travis.yml assumes an Ubuntu machine and the makefile links to where the libraries are installed in that particular environment. It may be different depending on your distro.

suyanhanx commented 6 years ago

I use the wsl (Ubuntu in Windows). Maybe there are some differences between wsl and standalone.

I tried again in my Ubuntu server just now. This time it met those:

Scanning dependencies of target caesium
[  6%] Building C object caesium/CMakeFiles/caesium.dir/caesium.c.o
[ 12%] Building C object caesium/CMakeFiles/caesium.dir/error.c.o
[ 18%] Building C object caesium/CMakeFiles/caesium.dir/utils.c.o
[ 25%] Building C object caesium/CMakeFiles/caesium.dir/png.c.o
[ 31%] Building C object caesium/CMakeFiles/caesium.dir/vendor/lodepng.c.o
[ 37%] Building C object caesium/CMakeFiles/caesium.dir/jpeg.c.o
[ 43%] Linking C shared library libcaesium.so
/usr/bin/ld: cannot find -lzopflipng
collect2: error: ld returned 1 exit status
caesium/CMakeFiles/caesium.dir/build.make:224: recipe for target 'caesium/libcaesium.so' failed
make[2]: *** [caesium/libcaesium.so] Error 1
CMakeFiles/Makefile2:87: recipe for target 'caesium/CMakeFiles/caesium.dir/all' failed
make[1]: *** [caesium/CMakeFiles/caesium.dir/all] Error 2
Makefile:127: recipe for target 'all' failed
make: *** [all] Error 2

It seems I need to install lzopflipng. I installed zopfli. It has no effect.

Lymphatus commented 6 years ago

I'm seeing the install script is a bit old and not compatible with the latest zopfli release. The make libzopflipng produces a file named libzopflipng.so.1.0.2, but the install.sh script looks for libzopflipng.so.1.0.0. This could be the issue.

I think this is the right way to do it now. I cannot test it on a Ubuntu machine right now, but should be something like this.

git clone https://github.com/google/zopfli.git
cd zopfli
make libzopflipng
sudo cp libzopflipng.so.1.0.2 /usr/lib
sudo ln -s libzopflipng.so.1.0.2 /usr/lib/libzopflipng.so
sudo ln -s libzopflipng.so.1.0.2 /usr/lib/libzopflipng.so.1
sudo mkdir /usr/include/zopflipng
sudo cp src/zopflipng/zopflipng_lib.h /usr/include/zopflipng
suyanhanx commented 6 years ago

Maybe it's not the install script's fault. Using the correct version also can't solve the problem. I'll try it again.

Lymphatus commented 6 years ago

I changed a little bit more the install script (was missing some fixes). Try to fresh clone again and try the install script, it should work now. I tested it with Ubuntu 18.04 on a VM and went all ok. Let me know.

suyanhanx commented 6 years ago

Oh it works! Thank you very much. You are really nice.