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

Unable to build cjpeg as static library #245

Closed
ostatnicky opened this issue Apr 2, 2017 · 2 comments
Closed

Unable to build cjpeg as static library #245

ostatnicky opened this issue Apr 2, 2017 · 2 comments

Comments

@ostatnicky
Copy link

ostatnicky commented Apr 2, 2017

Can you give me an advice how to build cjpeg binary for macOS which would be static library?

I'm running everything like does https://github.com/imagemin/mozjpeg-bin/blob/master/lib/install.js
but final binary has only 47kb. I expect size around ~500kb.

My problem is that I'm missing libpng16.16.dylib when I'm running cjpeg.

./cjpeg test.jpg > result.jpg 
dyld: Library not loaded: /usr/local/opt/libpng/lib/libpng16.16.dylib
  Referenced from: /Users/xxx/test/./cjpeg
  Reason: image not found
Abort trap: 6
@kornelski
Copy link
Member

kornelski commented Apr 2, 2017

On macOS you'd need:

./configure libpng_LIBS='/usr/local/lib/libpng16.a -lz' --enable-static --disable-shared
make -j8

In case of link errors substitute /usr/local/lib/libpng16.a for whatever find /usr -name libpng*.a finds.

On other platforms you may need to replace -lz with a path to a static libz.a.

@ostatnicky
Copy link
Author

ostatnicky commented Apr 3, 2017

Thank you very much! It works! :)

xinyu391 pushed a commit to xinyu391/mozjpeg that referenced this issue Sep 25, 2018
(must add .exe to CMAKE_C_COMPILER)

Addresses a concern raised in mozilla#245, mozilla#260
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants