[prev in list] [next in list] [prev in thread] [next in thread] 

List:       wine-devel
Subject:    Help with shared library make files
From:       Boaz Harrosh <boaz () hishome ! net>
Date:       2003-10-29 14:29:55
[Download RAW message or body]

I have the following setup

mfctest/Makefile - Main make file

    mfctest.exe.so - is the wrapper for an mfc gui application
    mfctest.dll.so - is the mfc gui application (as generated by the 
msvc++ wizard and than winemaker)

msvc/Makefile - make file for mfc & stuff missing from msvcrt.dll
    libmsvc.a - is all the cpp files archived by [ ar -rs 
$(ALL_OBJECT_FILES) ]
    libmsvc.so - same object files but linked with [ gcc --shared ]

Now I link mfctest.dll.so with libmsvc.a. (-l) The spec.c I prepare by 
including all the object files of the msvc project since winebuild does 
not work with libraries. It all runs fine.

Now I try to link with libmsvc.so ( exact same way as before with the -l 
option linux style, not as a DLL as usually done in wine ).
At the beginning it would not link because of undefined symbols. ( 
before with the .a option not all files get pulled in by the linker). So 
I fix the undefined s.
The spec.c file I have tried in to ways. 1) a libmsvc.spec.c for 
libmsvc.so and a small one for mfctest.dll.spec.c - and 2) A big 
mfctest.dll.spec.c that includes all objects same as above libmsvc.a . 
In both cases I had the same exact problem.

It would not run. I get a SIGSEGV. On the (gdb) back-trace it is 
directly from "dlopen" (from BUILTIN32_dlopen) it SIGs 10 functions deep 
into dlopen. The last function that makes any sense is _dl_init in 
ld-linux.so.2 from than on I get un-logical symbols that should not be 
in the init path. Including undefined s like 0x00000094 (see complete 
back-trace below) the SIGSEGV itself is reported at "dllname" which is 
not a function but an array in dll.spec.c . So we can see that the debug 
info got totally screwed up.

Big help!!! Any body got any ideas?

Do you think I need to fix the start address of libmsvc.so some how? 
What is the command line option for that?

The reason I need the libYYY.so option to work is because I have a big 
(1900 files) C++ project divided into 36 libraries. On the windows side 
it is dlls & static libs, all automatically exported by msvc++ (#define 
class class  declspec(dllexport) ). Since we do not have a good C++ way 
for pure dlls in wine (yet) and the 1900 files on one gcc link  will not 
work. ( truncated by the linker) .And I have more Applications in the 
future that use the same libraries. The .so option looks best.

One more question:
   What do the gurus say? In theory, if I have a XXX.dll.so linked Linux 
style to libYYY.so both have calls into wine. what is best method 
(XXX.dll.so is only because of the wrapper no real exports here)
    A.
        XXX.dll.so has an XXX.spec.c && libYYY.so has a YYY.spec.c of 
its own each linked to their respective .spec.c . (Note that those are 
only imports since export symbols from libYYY.so are linked against - 
Linux style).

    B. one big XXX+YYY.spec.c linked against XXX.dll.so (very very slow, 
it looks like winebuild has an o(n^2) efficiency )

    C. Both are good if no exports are made. (or exports only at the top 
lib)

Thanks for any help or pointer. Please share past experience for good or 
for worse

Free Life
Boaz

some info:
<(gdb) backtrace>
#0  0x40cb3a4d in dllname () from /home/wine/lib/wine/mfctest.dll.so
#1  0x00000094 in ?? ()
#2  0x40ffec8e in std::basic_iostream<wchar_t, std::char_traits<wchar_t> 
 >::~basic_iostream() () from /usr/lib/libstdc++.so.5
#3  0x40ffed0a in std::basic_iostream<wchar_t, std::char_traits<wchar_t> 
 >::~basic_iostream() () from /usr/lib/libstdc++.so.5
#4  0x4104dbb7 in __cxa_dyn_string_eq () from /usr/lib/libstdc++.so.5
#5  0x40feea11 in std::collate<char>::id () from /usr/lib/libstdc++.so.5
#6  0x4000aa4c in _dl_init (main_map=0x3c02eaf0, argc=4, 
argv=0xbffff454, env=0xbffff468) at dl-init.c:68
#7  0x4030a51e in _dl_open () from /lib/i686/libc.so.6
#8  0x4000a828 in _dl_catch_error (objname=0x406d28e0, 
errstring=0x406d28e4, operate=0x4030a120 <_dl_open+432>, 
args=0x406d28e8) at dl-error.c:162
#9  0x40309fcf in _dl_open () from /lib/i686/libc.so.6
#10 0x40352f21 in dlopen () from /lib/libdl.so.2
#11 0x4000a828 in _dl_catch_error (objname=0x3c0017e0, 
errstring=0x3c0017e4, operate=0x40352ef0 <dlopen+80>, args=0x406d2a68) 
at dl-error.c:162
#12 0x40353294 in dlerror () from /lib/libdl.so.2
#13 0x40352ed3 in dlopen () from /lib/libdl.so.2
#14 0x40107abc in wine_dlopen (filename=0x3c02eaa0 
"/home/wine/lib/wine/mfctest.dll.so", flag=2, error=0x406d2b08 " 
¨<@´l\016@X,m@HÍ\a@", errorsize=256) at loader.c:577
#15 0x40107420 in dlopen_dll (name=0x406d2c2c "mfctest.dll", 
error=0x406d2b08 " ¨<@´l\016@X,m@HÍ\a@", errorsize=256, test_only=0) at 
loader.c:156
#16 0x4010795b in wine_dll_load (filename=0x406d2c2c "mfctest.dll", 
error=0x406d2b08 " ¨<@´l\016@X,m@HÍ\a@", errorsize=256) at loader.c:390
#17 0x4009b537 in BUILTIN32_dlopen (name=0x406d2c2c "mfctest.dll", 
handle=0x406d2c28) at ../../relay32/builtin32.c:63
#18 0x4009b94c in BUILTIN32_LoadLibraryExA (path=0x403ca710 
"C:\\WINDOWS\\SYSTEM\\mfctest.dll", flags=0, pwm=0x406d2cc4) at 
../../relay32/builtin32.c:171
#19 0x400b3c6d in load_dll (libname=0x403ca6f0 "mfctest.dll", flags=0, 
pwm=0x406d2cc4) at loader.c:1058
#20 0x400b3e34 in LdrLoadDll (path_name=0x0, flags=0, 
libname=0x406d2cfc, hModule=0x406d2cf8) at loader.c:1120
#21 0x4007e158 in LoadLibraryExA (libname=0x404b41a0 "mfctest.dll", 
hfile=0x0, flags=0) at ../../loader/module.c:655
#22 0x4007e28d in LoadLibraryA (libname=0x404b41a0 "mfctest.dll") at 
../../loader/module.c:707
#23 0x404a3147 in WinMain (hInstance=0x404b0000, hPrevInstance=0x0, 
szCmdLine=0x403908f2 "", iCmdShow=1) at mfctest.exe_wrapper.c:127
#24 0x404b40ea in __wine_exe_main () at mfctest.exe.spec.c:140
#25 0x4009fced in start_process () at ../../scheduler/process.c:455
#26 0x400a402a in call_on_thread_stack (func=0x4009fb10) at 
../../scheduler/sysdeps.c:113
</(gdb) backtrace>

<(gdb) info sharedlibrary>

From        To          Syms Read   Shared Object Library
0x40048000  0x400c6314  Yes         /home/wine/lib/libntdll.dll.so
0x40105790  0x40107c14  Yes         /home/wine/lib/libwine.so.1
0x4011cc80  0x4011f354  Yes         /home/wine/lib/libwine_unicode.so.1
0x40212620  0x4030f328  Yes         /lib/i686/libc.so.6
0x403334a0  0x4034abc4  Yes         /lib/i686/libm.so.6
0x40352db0  0x40353d64  Yes         /lib/libdl.so.2
0x40000a60  0x4000f49b  Yes         /lib/ld-linux.so.2
0x40382d10  0x4038b054  Yes         /lib/libnss_files.so.2
0x404a3000  0x404b4184  Yes         
/home/wine/codeward/mfctest/mfctest.exe.so
0x406f3000  0x40732ef4  Yes         /home/wine/lib/wine/kernel32.dll.so
0x407b6000  0x40848b14  Yes         /home/wine/lib/wine/user32.dll.so
0x408cf000  0x40916c44  Yes         /home/wine/lib/wine/gdi32.dll.so
0x40941000  0x4095e814  Yes         /home/wine/lib/wine/advapi32.dll.so
0x40974000  0x4099def4  Yes         /home/wine/lib/wine/msvcrt.dll.so
0x409b1850  0x409ee254  Yes         /usr/lib/libfreetype.so.6
0x409f98e0  0x40a02194  Yes         /lib/libz.so.1
0x40a13000  0x40a5e794  Yes         /home/wine/lib/wine/x11drv.dll.so
0x404b8200  0x404bc8a4  Yes         /usr/X11R6/lib/libSM.so.6
0x40a73540  0x40a81dd4  Yes         /usr/X11R6/lib/libICE.so.6
0x40a89910  0x40a934a4  Yes         /usr/X11R6/lib/libXext.so.6
0x40aa6380  0x40b17384  Yes         /usr/X11R6/lib/libX11.so.6
0x40b99640  0x40bd91e4  Yes         /usr/X11R6/lib/libGL.so.1
0x40beb110  0x40bf3c14  Yes         /lib/i686/libpthread.so.0
0x40c39320  0x40c3e234  Yes         /usr/X11R6/lib/libXcursor.so.1
0x40c41390  0x40c46324  Yes         /usr/X11R6/lib/libXrender.so.1
0x40014860  0x40015794  Yes         
/usr/X11R6/lib/X11/locale/lib/common/xlcDef.so.2
0x40c74260  0x40c8ad84  Yes         
/usr/X11R6/lib/X11/locale/lib/common/ximcp.so.2
0x400185f0  0x40018f54  Yes         /usr/lib/gconv/ISO8859-1.so
0x40ca0000  0x40cb2074  Yes         /home/wine/lib/wine/mfctest.dll.so
0x40dcf920  0x40f2f8e4  Yes         /home/wine/lib/libmsvc.so
0x40ff1070  0x4104dbc4  Yes         /usr/lib/libstdc++.so.5
0x4001b540  0x40020534  Yes         /lib/libgcc_s.so.1

</(gdb) info sharedlibrary>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic