Linking problem on Windows, any ideas ?

rony rony at wu.ac.at
Sat Aug 20 04:15:08 PDT 2011


Hi there,

just FYI as this has cost me more than two days, such that others who
may run into this problem sometimes in the future can check on this as
well:

    the problem was using the "/Gr" switch ("__fastcall calling
    conventions") for the MS compiler. Removing this compiler option
    allowed the linker to link successfully to the (Windows KDE) dbus
    library!

---rony



On 19.08.2011 17:11, rony wrote:
> Sorry, forgot to supply the MSC compile statement:
>
>     cl /nologo /EHsc /O2 /Gr /Gs /FAcs /MT /W3
>     /D_CRT_SECURE_NO_DEPRECATE /D_CRT_NONSTDC_NO_DEPRECATE -DWINDOWS
>     -DDBUSOOREXX_32 /c /Fodbusoorexx-32.obj dbusoorexx.cc
>
> ---rony
>
> On 19.08.2011 17:05, rony wrote:
>> Hi there,
>>
>> the Windows KDE project has dbus binaries for Windows created by/for
>> different compilers. Eg. cf.
>> <http://www.winkde.org/pub/kde/ports/win32/releases/stable/>, or
>> <http://sourceforge.net/projects/kde-windows/files/dbus/1.4.1-2/>.
>>
>> Compiling the language binding for Windows with MSC works, but the
>> linking process does not succeed. There are 78 messages like these:
>>
>>     dbusoorexx-32.obj : error LNK2019: unresolved external symbol
>>     __imp_ at dbus_threads_init_default@0 referenced in function
>>     _dbusLoader at 4
>>     dbusoorexx-32.obj : error LNK2019: unresolved external symbol
>>     __imp_ at dbus_get_version@12 referenced in function @DbusVersion_impl at 4
>>     dbusoorexx-32.obj : error LNK2019: unresolved external symbol
>>     __imp_ at dbus_error_free@4 referenced in function @DbusValidate_impl at 12
>>     ... cut ...
>>
>> Researching the Internet there have been hints that the mostlikely
>> case for that MS linker error is that the library was not
>> given/found. AFAICT, the library should be found. (LIB contains the
>> directory with the "dbus-1.lib" file which is explicitly listed as
>> one of the libraries to link to).
>>
>> Here are the paths to the lib-dirs:
>>
>>     E:\Programme\Microsoft Visual Studio
>>     9.0\VC\ATLMFC\LIB;E:\Programme\Microsoft Visual Studio
>>     9.0\VC\LIB;E:\Programme\Microsoft
>>     SDKs\Windows\v7.0\lib;;e:\programme\dbus-1\lib;D:\Programme\ooRexx\api
>>
>> Here the link command in the nmake Makefile:
>>
>>     link /nologo /SUBSYSTEM:Windows rexx.lib rexxapi.lib dbus-1.lib
>>     WS2_32.lib /def:dbusoorexx-32.def /DLL dbusoorexx-32.obj
>>     -out:dbusoorexx-32.dll
>>
>> Also trying to create an import library directly off the dbus-1.dll
>> (using the MS tools "dumpbin /exports ..." and "lib /def:...")
>> succeeded, but the linking is not successful, giving the same linking
>> errors as above.
>>
>> The version of the MS compiler (referred to as "vc90" for the dbus
>> binaries of the Windows-KDE project):
>>
>>     Microsoft (R) 32-bit C/C++ Optimizing Compiler Version
>>     15.00.30729.01 for 80x86
>>
>> Probably (hopefully) I am doing something stupid, hence the request
>> for ideas, hints or pointers!
>>
>> TIA,
>>
>> ---rony
>>
>> P.S.: Also tried to create a Windows version of dbus from the latest
>> git using cygwin, which has not succeeded. Then downloaded cmake and
>> tried to follow the README.* files using the MS compiler, then also
>> downloaded and used MinGW, which all succeed with the configuration
>> part, but make does not run successfully. (The cmake MS variant at
>> least created a dbus-1.dll with lib- and exp-files. But using them
>> yields the same link error as above.)
>>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/dbus/attachments/20110820/be410059/attachment.html>


More information about the dbus mailing list