brechtsanders / pedeps

Cross-platform C library to read data from PE/PE+ files (the format of Windows .exe and .dll files)
MIT License
38 stars 8 forks source link

build mingw failed #4

Closed MVoz closed 5 years ago

MVoz commented 5 years ago
src/copypedeps.c:37:10: фатальная ошибка: avl.h: No such file or directory
 #include <avl.h>

ok, copy libavl

$ make

gcc -c -o src/copypedeps.static.o src/copypedeps.c -DBUILD_PEDEPS_STATIC -Ilib -Os
src/copypedeps.c:52:10: фатальная ошибка: linux/limits.h: No such file or directory
 #include <linux/limits.h>

hmm..

brechtsanders commented 5 years ago

Hi, on which platform was this? If you're on Debian/Ubuntu, just run: sudo apt-get install libavl-dev. On Windows (using MinGW gcc) I used the sources from this link: http://ftp.debian.org/debian/pool/main/liba/libavl/libavl_0.3.5.orig.tar.gz

MVoz commented 5 years ago
$ make
cc -O2 -fomit-frame-pointer -pipe -mcpu=i686 -w   -c -o avl.o avl.c
cc.exe: warning: '-mcpu=' is deprecated; use '-mtune=' or '-march=' instead
cc -nostdlib -shared -Wl,-soname,libavl.so.1 avl.o -o libavl.so.1.5 -lc
E:/tools/vcpkg/downloads/tools/msys2/msys64/mingw32/bin/../lib/gcc/i686-w64-mingw32/9.1.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -lc
collect2.exe: error: ld returned 1 exit status
make: *** [GNUmakefile:37: libavl.so.1.5] Ошибка 1
brechtsanders commented 5 years ago

I see now you are using MinGW-w64 on MSYS2, just like me. Here's how I do it:

MVoz commented 5 years ago

libavl build ok

copy libavl.a to avl.a

copy all /usr , /mingw32

make
gcc --static -s -o src/copypedeps.exe src/copypedeps.static.o libpedeps.a   -lshlwapi -lavl
src/copypedeps.static.o: file not recognized: File format not recognized
collect2.exe: error: ld returned 1 exit status
make: *** [Makefile:110: src/copypedeps.exe] Ошибка 1
brechtsanders commented 5 years ago

looks like your src/copypedeps.static.o file is not the correct format (maybe it has 0 size). try to build it again...

MVoz commented 5 years ago

sorry ))

make clean

make

build ok

MVoz commented 5 years ago

Thanks for the copypedeps.exe utility! the best I've met MSVC dumpbin.exe does not find all dependencies