ImageOptim / libimagequant

Palette quantization library that powers pngquant and other PNG optimizers
https://pngquant.org/lib
Other
780 stars 132 forks source link

make static command doesnot work on Windows ,with minGW #26

Closed dogeFu closed 5 years ago

dogeFu commented 5 years ago

I did as the README says. use "make static" command to build this library.But it failed.

this is the error: ./configure process_begin: CreateProcess(NULL, env bash D:\Librarys\libimagequant-master\configure, ...) failed. make (e=2): mingw32-make: *** No rule to make target 'config.mk', needed by 'pam.o'. Stop.

I am not good at Makefile build system.Don't know what is going on.

Any help will be appreciated~

BTW, msvc brunch build fail with VS2015 too...

kornelski commented 5 years ago

Is that all output you have?

The second error "No rule to make target 'config.mk'" just means the ./configure didn't run.

However, "process_begin: CreateProcess(NULL, env bash D:\Librarys\libimagequant-master\configure, ...) failed." doesn't really mean anything. There are dozens of ways in which ./configure can fail, so it's hard to say what's going on without more information.


Another option is to use Rust/Cargo to build it for MSVC (note that MinGW is not compatible with MSVC projects).

I'm assuming you're building 64-bit executable for 64-bit Windows:

dogeFu commented 5 years ago

Is that all output you have?

The second error "No rule to make target 'config.mk'" just means the ./configure didn't run.

However, "process_begin: CreateProcess(NULL, env bash D:\Librarys\libimagequant-master\configure, ...) failed." doesn't really mean anything. There are dozens of ways in which ./configure can fail, so it's hard to say what's going on without more information.

Another option is to use Rust/Cargo to build it for MSVC (note that MinGW is not compatible with MSVC projects).

I'm assuming you're building 64-bit executable for 64-bit Windows:

* Run https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe (say yes to default config)

* Reboot (to update `PATH` otherwise `cargo.exe` won't be found)

* Run `cargo build --release` in libimagequant directory. It will create `target/release/libimagequant.lib` (or `*.a` or similar).

Yes,that was all I got. I think minGW's make command doesn't work in this project, or there muse be something I did wrong. I build a Rust version too, but, it's a 64-bit lib. I need a 32-bit lib for my vc++ project.

dogeFu commented 5 years ago

I use MSYS2 to build it, and get a 32-bit "libimagequant.a" file ;

But when I build my project, which links libimagequant.a and libgcc.a as the REMEAD says. this error shows :

LNK2019:unresolved external symbol ___getreent, referenced at _liq_crash_if_invalid_handle_pointer_given.constprop.19
LNK2019:unresolved external symbol _vsnprintf, referenced at _liq_verbose_printf LNK2001:unresolved external symbol _vsnprintf.

looks like this issue : https://github.com/kornelski/pngquant/issues/41

I tried as the issue said, link a "libmingwex.a" with my project , It didn't work...

Windows is just so unflattering , isn't it...

kornelski commented 5 years ago

These uresolved symbols look like you've tried to use MinGW library with Visual Studio. They are incompatible in many subtle, but crashy ways. You can only use MinGW gcc with MinGW-only projects. And for Visual Studio projects you must use Microsoft's compiler.

If you have an existing Visual Studio project, then add the .c files to it.

dogeFu commented 5 years ago

I buiild the msvc-branch with openMP option turn off , and it works.

thanks for your help.