sahlberg / libnfs

NFS client library
Other
510 stars 200 forks source link

strndup multiple definition issue when linking static library with libssh #487

Open gailium119 opened 1 month ago

gailium119 commented 1 month ago

D:/Soft/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/14.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: D:/Soft/msys64/mingw64/lib/libssh.a(misc.c.obj):(.text+0x19d0): multiple definition of `strndup'; D:/Soft/msys64/mingw64/lib/libnfs.a(libnfs_la-win32_compat.o):(.text+0x410): first defined here libssh uses its own strndup with mingw, and when libssh and libnfs are both linked statically, ld will throw an error

gailium119 commented 1 month ago

Suggestion: Change the name of strndup in libnfs to something like nfs_strndup

sahlberg commented 3 weeks ago

I have checked in a change as you suggested to master. Please test it as I have no way to test this myself.