[LLVMdev] Shared Libraries (dlls) using MinGW

Kevin Browder kbrowder at gmail.com
Mon Sep 27 15:25:36 PDT 2010


So I've been looking around for people who have built shared libraries on
windows and have run in to a bit of a stumbling block.  I'm able to compile
without the BUILD_SHARED_LIBS flag but if I put turn the flag on as follows:

cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE:STRING=Release
-DBUILD_SHARED_LIBS:BOOL=ON ../llvm-2.7

Then call:

mingw32-make

I get:
...
Linking CXX shared library ..\..\bin\libLLVMSystem.dll
Info: resolving vtable for std::basic_stringbuf<char,
std::char_traits<char>, std::allocator<char> > by linking to
__imp___ZTVSt15basic_stringbufIcSt11char_traitsIcESaIcEE (auto-import)
Info: resolving std::basic_string<char, std::char_traits<char>,
std::allocator<char> >::_Rep::_S_empty_rep_storage by linking to
__imp___ZNSs4_Rep20_S_empty_rep_storageE (auto-import)
Info: resolving vtable for std::basic_streambuf<char, std::char_traits<char>
> by linking to __imp___ZTVSt15basic_streambufIcSt11char_traitsIcEE
(auto-import)
Info: resolving vtable for std::basic_ios<char, std::char_traits<char> > by
linking to __imp___ZTVSt9basic_iosIcSt11char_traitsIcEE (auto-import)
Info: resolving VTT for std::basic_stringstream<char,
std::char_traits<char>, std::allocator<char> > by linking to
__imp___ZTTSt18basic_stringstreamIcSt11char_traitsIcESaIcEE (auto-import)
Info: resolving vtable for std::basic_stringstream<char,
std::char_traits<char>, std::allocator<char> > by linking to
__imp___ZTVSt18basic_stringstreamIcSt11char_traitsIcESaIcEE (auto-import)
Info: resolving vtable for __cxxabiv1::__class_type_info by linking to
__imp___ZTVN10__cxxabiv117__class_type_infoE (auto-import)
Creating library file: ..\libLLVMSystem.dll.a
c:/mingw/bin/../lib/gcc/mingw32/4.5.0/../../../../mingw32/bin/ld.exe:
warning: auto-importing has been activated without --enable-auto-import
specified on the command line.
This should work unless it involves constant data structures referencing
symbols from auto-imported DLLs.
CMakeFiles/LLVMSystem.dir/DynamicLibrary.cpp.obj:DynamicLibrary.cpp:(.text+0x40a):
undefined reference to `_imp__EnumerateLoadedModules at 12'
CMakeFiles/LLVMSystem.dir/Process.cpp.obj:Process.cpp:(.text+0xbe):
undefined reference to `GetProcessMemoryInfo at 12'
CMakeFiles/LLVMSystem.dir/Signals.cpp.obj:Signals.cpp:(.text+0x1d9):
undefined reference to `_imp__SymSetOptions at 4'
CMakeFiles/LLVMSystem.dir/Signals.cpp.obj:Signals.cpp:(.text+0x1f9):
undefined reference to `_imp__SymInitialize at 12'
CMakeFiles/LLVMSystem.dir/Signals.cpp.obj:Signals.cpp:(.text+0x221):
undefined reference to `_imp__SymGetModuleBase at 8'
CMakeFiles/LLVMSystem.dir/Signals.cpp.obj:Signals.cpp:(.text+0x22b):
undefined reference to `_imp__SymFunctionTableAccess at 8'
CMakeFiles/LLVMSystem.dir/Signals.cpp.obj:Signals.cpp:(.text+0x26c):
undefined reference to `_imp__StackWalk at 36'
CMakeFiles/LLVMSystem.dir/Signals.cpp.obj:Signals.cpp:(.text+0x2de):
undefined reference to `_imp__SymGetModuleBase at 8'
CMakeFiles/LLVMSystem.dir/Signals.cpp.obj:Signals.cpp:(.text+0x353):
undefined reference to `_imp__SymGetSymFromAddr at 16'
CMakeFiles/LLVMSystem.dir/Signals.cpp.obj:Signals.cpp:(.text+0x3b9):
undefined reference to `_imp__SymGetLineFromAddr at 16'
collect2: ld returned 1 exit status
mingw32-make[2]: *** [bin/libLLVMSystem.dll] Error 1
mingw32-make[1]: *** [lib/System/CMakeFiles/LLVMSystem.dir/all] Error 2
mingw32-make: *** [all] Error 2

Any help would be greatly appreciated.
btw: my MinGW gcc is version 4.5.0.

Thanks,
Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20100927/ac1adb35/attachment.html>


More information about the llvm-dev mailing list