首页 > 解决方案 > msys2 / mingw missing dynamic linker library

问题描述

I am attempting to build SpatiaLite in Msys2. The build goes well until it attempts to compile the examples. It throws an error because the linker cannot find the dynamic linker (dl) library. Is this something that I should expect msys2/mingw to support? Am I missing a package?

I build spatialite using

./configure && make

Here is the compiler/linker output

Making all in examples
make[2]: Entering directory '/home/myuser/libspatialite-4.3.0a/examples'
gcc -DHAVE_CONFIG_H -I. -I..    -I./../src/headers  -g -O2 -MT demo1.o -MD -MP -MF .deps/demo1.Tpo -c -o demo1.o demo1.c
mv -f .deps/demo1.Tpo .deps/demo1.Po
/bin/sh ../libtool  --tag=CC   --mode=link gcc -I./../src/headers  -g -O2 -L../src -lspatialite -lm   -o demo1.exe demo1.o -L/mingw32/lib -lxml2 -lz -llzma -liconv -lws2_32 -lfreexl -liconv -lproj -lz -lsqlite3  -L/mingw32/lib -lgeos_c
libtool: link: gcc -I./../src/headers -g -O2 -o .libs/demo1.exe demo1.o  -L../src /home/myuser/libspatialite-4.3.0a/src/.libs/libspatialite.a -L/mingw32/lib -lpthread -ldl -lxml2 -llzma -lws2_32 -lfreexl -liconv -lproj -lz -lsqlite3 -lgeos_c
C:/msys32/mingw32/bin/../lib/gcc/i686-w64-mingw32/7.3.0/../../../../i686-w64-mingw32/bin/ld.exe: cannot find -ldl
collect2.exe: error: ld returned 1 exit status
make[2]: *** [Makefile:372: demo1.exe] Error 1
make[2]: Leaving directory '/home/myuser/libspatialite-4.3.0a/examples'
make[1]: *** [Makefile:473: all-recursive] Error 1
make[1]: Leaving directory '/home/myuser/libspatialite-4.3.0a'
make: *** [Makefile:380: all] Error 2

标签: mingwmingw-w64mingw32msysmsys2

解决方案


msys2 需要mingw-w64-dlfcn提供libdl.alibdl.dll.a

更多细节在这里


推荐阅读