[sqlite-dev] Couldn't find dl library when compile under MinGW

288 views
Skip to first unread message

Edward Lau

unread,
Jun 1, 2019, 9:59:57 PM6/1/19
to sqlit...@mailinglists.sqlite.org
Hi Folks:

I am trying to compile the latest amalgamated code using gcc under the latest MinGW.


-rw-r--r-- 1 elau Administrators  527983 Jun  1 18:05 shell.c
-rw-r--r-- 1 elau Administrators 7864301 Jun  1 18:05 sqlite3.c
-rw-r--r-- 1 elau Administrators  559572 Jun  1 18:05 sqlite3.h
-rw-r--r-- 1 elau Administrators   33981 Jun  1 18:05 sqlite3ext.h

$ gcc -O2 -DSQLITE_THREADSAFE=0 shell.c sqlite3.c -ldl
c:/apps/mingw/bin/../lib/gcc/mingw32/8.2.0/../../../../mingw32/bin/ld.exe: cannot find -ldl
collect2.exe: error: ld returned 1 exit status

Any idea where and how do I install it?

Thanks.

Keith Medcalf

unread,
Jun 2, 2019, 3:01:23 AM6/2/19
to sqlit...@mailinglists.sqlite.org

You do not need libdl.a on Windows. The dynamic loader is part of Windows and no library is required.

---
The fact that there's a Highway to Hell but only a Stairway to Heaven says a lot about anticipated traffic volume.


_______________________________________________
sqlite-dev mailing list
sqlit...@mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-dev

Edward Lau

unread,
Jun 4, 2019, 6:16:15 PM6/4/19
to kmed...@dessus.com, sqlit...@mailinglists.sqlite.org
I got the error during compilation under MinGW.  I couldn’t figure how to fix it  so I switch the environment to Msys2 and at least got past this compile error.

Anyone can figure it out will surely help the next person dealing with MinGW.

Thanks 

Sent from AOL Mobile Mail
Get the new AOL app: mail.mobile.aol.com

a.fu...@lqt.it

unread,
Jun 5, 2019, 3:23:04 AM6/5/19
to sqlit...@mailinglists.sqlite.org
On Tue, 4 Jun 2019 22:16:07 +0000 (UTC), Edward Lau wrote:
> I got the error during compilation under MinGW. I couldn’t figure
> how to fix it so I switch the environment to Msys2 and at least got
> past this compile error.
>
> Anyone can figure it out will surely help the next person dealing
> with
> MinGW.
>

Hi Edward,

the problem is basically simple to be explained:

> cannot find -ldl

note: libdl is the dynamic linking library adopted by Linux
and Unix-like systems.
it does not exist on Windows platforms because Windows has
its own System API for loading dynamic libraries, and they
are completely different from libdl.
so, not too much surprisingly, any attempt to link -ldl
will always fail on Windows.

Msys2 is specifically intended for supporting gcc on Windows,
it fully supports ./configure, make and so on, and it will make
any possible effort for respecting all the platform-specific
requirements and idiosyncrasies.

Hint: always use Msys2 for your Win builds, and your life
will be simpler and happier ;-)

bye Sandro

Reply all
Reply to author
Forward
0 new messages