fhanau / Efficient-Compression-Tool

Fast and effective C++ file optimizer
Apache License 2.0
596 stars 41 forks source link

Compiling at Linux fails #18

Closed jollyrogers88 closed 2 years ago

jollyrogers88 commented 7 years ago

I've tried to compile with ArchLinux. Just used make / make install. Dependencies and nasm are present, compiler: gcc 6.2.1

With libjpeg-turbo, but without mozjpeg, it just fails make[3]: Verzeichnis „../Efficient-Compression-Tool-0.6.1/src/mozjpeg“ wird verlassen

With mozjpeg, the following compilation error happens:

g++ -Ofast -std=gnu++11 main.cpp blocksplitter.o codec.o image.o lz77.o opngreduc.o squeeze.o util.o LzFind.o support.cpp zopflipng.cpp zopfli/deflate.cpp zopfli/zopfli_gzip.cpp zopfli/katajainen.cpp lodepng/lodepng.cpp lodepng/lodepng_util.cpp optipng/optipng.cpp jpegtran.cpp gztools.cpp mozjpeg/.libs/libjpeg.a libpng/libpng.a zlib/libz.a -o ../ECT
/tmp/ccu3X25P.o: In function `DeflateSplittingFirst2(ZopfliOptions const*, int, unsigned char const*, unsigned long, unsigned long, unsigned char*, unsigned char**, unsigned long*, unsigned int, unsigned char, ZopfliLZ77Store*)':
deflate.cpp:(.text+0x502e): undefined reference to `pthread_create'
fhanau commented 7 years ago

Hm, there appears to be a problem with multithreading, it worked for me using Ubuntu. It will work with mozjpeg if you disable multithreading using make CXXFLAGS='-DNOMULTI -Ofast -std=gnu++11' The -pthread flag could also be causing problems, so try make CXXFLAGS='-Ofast -std=gnu++11'

There currently is no make install.

tssajo commented 7 years ago

I ran into the exact same problem on Debian Jessie when I was trying to compile ECT release 0.6.1

This worked for me: make CXXFLAGS='-DNOMULTI -Ofast -std=gnu++11'

metalshark commented 7 years ago

I had joy on Debian Jessie 8.8 by just going into the src/mozjpeg folder and running ./configure --host=i686-linux-gnu followed by make then continuing the main build in the src folder. Without custom CXXFLAGS, etc

peletiah commented 7 years ago

In Ubuntu 14.04.5 I ran into this error:

make[1]: Entering directory `/tmp/Efficient-Compression-Tool/src/mozjpeg'
CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash /tmp/Efficient-Compression-Tool/src/mozjpeg/missing aclocal-1.15 
/tmp/Efficient-Compression-Tool/src/mozjpeg/missing: line 81: aclocal-1.15: command not found
WARNING: 'aclocal-1.15' is missing on your system.
         You should only need it if you modified 'acinclude.m4' or
         'configure.ac' or m4 files included by 'configure.ac'.
         The 'aclocal' program is part of the GNU Automake package:
         <http://www.gnu.org/software/automake>
         It also requires GNU Autoconf, GNU m4 and Perl in order to run:
         <http://www.gnu.org/software/autoconf>
         <http://www.gnu.org/software/m4/>
         <http://www.perl.org/>
make[1]: *** [aclocal.m4] Error 127
make[1]: Leaving directory `/tmp/Efficient-Compression-Tool/src/mozjpeg'
make: *** [mozjpeg] Error 2

Additional flags like above didn't work, but I managed to build it like this:

$ sudo apt-get install nasm
$ git clone --recursive https://github.com/fhanau/Efficient-Compression-Tool.git
$ cd Efficient-Compression-Tool/src/mozjpeg
$ touch aclocal.mp4 configure
$ touch Makefile.am
$ touch Makefile.in
$ cd ..
$ make
$ cd..
$ ./ect
fhanau commented 7 years ago

I could not reproduce this problem with Ubuntu 17.04. However, I ran aclocal and autoreconf on mozjpeg, which should fix these problems. Please reopen this if your problem persists.

salehawal commented 6 years ago

i had the same problem b4 and did apply @peletiah solution but it didnt work, then i tried @fhanau solution by running aclocal and autoreconf .. i see this new error now...

./configure: line 13633: PKG_PROG_PKG_CONFIG: command not found 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 ./configure: line 13812: syntax error near unexpected token libpng,' ./configure: line 13812:PKG_CHECK_MODULES(libpng, libpng, HAVE_LIBPNG=1,' Makefile:950: recipe for target 'config.status' failed make[1]: [config.status] Error 2 make[1]: Leaving directory '/home/saleh/.local/share/Trash/files/Efficient-Compression-Tool/Efficient-Compression-Tool/src/mozjpeg' Makefile:37: recipe for target 'mozjpeg' failed make: [mozjpeg] Error 2

salehawal commented 6 years ago

/src/mozjpeg @ line 13812 just commented this line ...

PKG_CHECK_MODULES(libpng, libpng, HAVE_LIBPNG=1,PKG_CHECK_MODULES([libpng], [libpng12], [HAVE_LIBPNG=1], [HAVE_LIBPNG=0]))

and it the build was done .. tested the app is working (:+1:

fhanau commented 6 years ago

I could not reproduce this on Ubuntu. It seems to complain about some check for libpng. Is your OS shipped with libpng or do you have it installed?

salehawal commented 6 years ago

Ubuntu 18.04 LTS gcc 7.3 libpng 1.6 ( booth libpng16-16 & libpng12-0 are installed on system )

fhanau commented 6 years ago

I updated ubuntu to 18.04, but still can't reproduce this. When I run aclocal and autoreconf, it starts to produce some warnings about libpng, but the line including PKG_CHECK_MODULES you mentioned does not appear in my configure file. I have no idea where that is coming from.

Can you post the error you received before running aclocal and autoreconf again?

And just to be sure, you are using the master version and not a release, right?

salehawal commented 6 years ago

ok just because you asked i downloaded a fresh version now "git clone", it didnt clone the "libpng" so i hade to go to "src" folder removed the "libpng" folder and cloned the libpng from git now i just run make in "src" i get this messege..

make[1]: Entering directory '/home/saleh/Desktop/Efficient-Compression-Tool/src/mozjpeg' CDPATH="${ZSH_VERSION+.}:" && cd . && /bin/bash /home/saleh/Desktop/Efficient-Compression-Tool/src/mozjpeg/missing aclocal-1.16 /home/saleh/Desktop/Efficient-Compression-Tool/src/mozjpeg/missing: line 81: aclocal-1.16: command not found WARNING: 'aclocal-1.16' is missing on your system. You should only need it if you modified 'acinclude.m4' or 'configure.ac' or m4 files included by 'configure.ac'. The 'aclocal' program is part of the GNU Automake package: https://www.gnu.org/software/automake It also requires GNU Autoconf, GNU m4 and Perl in order to run: https://www.gnu.org/software/autoconf https://www.gnu.org/software/m4/ https://www.perl.org/ Makefile:955: recipe for target 'aclocal.m4' failed make[1]: [aclocal.m4] Error 127 make[1]: Leaving directory '/home/saleh/Desktop/Efficient-Compression-Tool/src/mozjpeg' Makefile:37: recipe for target 'mozjpeg' failed make: [mozjpeg] Error 2


i will go with you step by step, now tell me what to do?

fhanau commented 6 years ago

I could not find out how what causes this problem and added a workaround which removes the PKG_CHECK_MODULES code from configure.ac Let me know if your problem persists. You might still need to run aclocal and autoreconf. The next release of libjpeg-turbo (and hopefully mozjpeg) will use cmake instead of autotools for compilation which should fix this problem.

salehawal commented 6 years ago

i did manage to install in on CentOs 6 after upgrading the gcc compiler to 7.3 with no problems https://www.vultr.com/docs/how-to-install-gcc-on-centos-6

but on ubuntu, it is the same case as b4, but managed to install it this way 1- sudo apt-get install pkg-config 2- cd src/mozjpeg 3- aclocal && autoreconf -fi 4- cd .. 5- make Done (: