Thanks Martin, Yes I think the problem was with my environment. I had libws2_32.lib available but did not have libws2_32.a, so I was missing the symbols coming from the source files in ming2-w64-crt. Thanks for the clarification.
On Thu, Jul 22, 2021 at 3:33 AM Martin Storsjö <[email protected]> wrote: > On Wed, 21 Jul 2021, Jonathan Marler wrote: > > > Yeah definitely revert, those redefinition errors are bad news. > > The problem though is that I still get these undefined symbol errors > > even with -lws2_32 with Clang. Forgive me if I'm mistaken here, but in > > order for these symbols to be available, don't they need to be in > > ws2_32.def? Is that right? If so, I don't see them in there which is > > why I think I'm getting the linker errors. > > Your original testcase you posted works exactly the same for me with both > GCC and Clang: > > $ cat ws.c > #include <ws2tcpip.h> > int main(int argc, char **argv) { > return (int)&IN6_IS_ADDR_UNSPECIFIED; > } > $ x86_64-w64-mingw32-gcc ws.c -w > /usr/bin/x86_64-w64-mingw32-ld: > /tmp/ccvc4epM.o:ws.c:(.rdata$.refptr.IN6_IS_ADDR_UNSPECIFIED[.refptr.IN6_IS_ADDR_UNSPECIFIED]+0x0): > > undefined reference to `IN6_IS_ADDR_UNSPECIFIED' > collect2: error: ld returned 1 exit status > $ x86_64-w64-mingw32-gcc ws.c -w -lws2_32 > $ > $ x86_64-w64-mingw32-clang ws.c -w > ld.lld: error: undefined symbol: IN6_IS_ADDR_UNSPECIFIED > >>> referenced by /tmp/ws-2350d6.o:(main) > clang-13: error: linker command failed with exit code 1 (use -v to see > invocation) > $ x86_64-w64-mingw32-clang ws.c -w -lws2_32 > $ > > The symbol doesn't have to be in ws2_32.def, libws2_32.a consists of both > import entries (based on the def file) and statically linked regular > object files. Check the file with nm libws2_32.a to see what it contains. > > // Martin > _______________________________________________ Mingw-w64-public mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/mingw-w64-public
