X-Spam-Check-By: sourceware.org To: cygwin AT cygwin DOT com From: "Avi Cohen Stuart" Subject: openmotif, .rdata, shared libs and runtime linking/loading problem Date: Tue, 15 Aug 2006 22:34:03 +0200 Lines: 89 Message-ID: Reply-To: "Avi Cohen Stuart" X-IsSubscribed: yes Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com Hi, Please let me know if this is the correct newsgroup. I'm trying to get openmotif to run under cygwin. I know that I'm not supposed to do that but, who knows, maybe they change the license one of these days :-) The test I'm using is the hello.c from chapter 2 of the motif examples. During the link I get these messages, I don't know if they are relevant. gcc -Wl,--script,/usr/lib/ldscripts/i386pe.x-no-rdata -ggdb3 -O2 -fno-strength-reduce -Wall -Wpointer-arith -I/usr/X11R6/include -D__i386__ -DWIN32_LEAN_AND_MEAN -DX_LOCALE -D_X86_ -D__CYGWIN__ -D_XOPEN_SOURCE -D_POSIX_C_SOURCE=199309L -D_BSD_SOURCE -D_SVID_SOURCE -D_GNU_SOURCE -DFD_SETSIZE=256 -DXResExtension -DFUNCPROTO=15 -DNARROWPROTO hello.c -L/usr/X11R6/lib -lXm -lXt -lSM -lICE -lX11 -o hello hello.c:8: warning: return type defaults to `int' hello.c: In function `main': hello.c:30: warning: control reaches end of non-void function Info: resolving _sessionShellWidgetClass by linking to __imp__sessionShellWidgetClass (auto-import) Info: resolving __XmStrings by linking to __imp___XmStrings (auto-import) The problem I'm having is that any app linked with the new shared library I'm getting an error 0xc0000005 during the loading of the shared libraries, before I even enter main(). gdb reports the following: Program received signal SIGSEGV, Segmentation fault. Program received signal SIGSEGV, Segmentation fault. Program received signal SIGSEGV, Segmentation fault. Program exited with code 030000000005. You can't do that without a process to debug. (gdb) When using windbg it reports a access violation here, apperantly during the resolving of shared libaries. The address it is trying to write to appears to be a read only address in the attempt to resolve some adresses and updating pointers it crashes. This is the stack trace I found with windbg. # ChildEBP RetAddr 00 0022f6bc 7c91d690 ntdll!LdrpSnapThunk+0xe1 01 0022f740 7c91d9cb ntdll!LdrpSnapIAT+0x20e 02 0022f76c 7c91d944 ntdll!LdrpHandleOneOldFormatImportDescriptor+0xcc 03 0022f784 7c91c8a6 ntdll!LdrpHandleOldFormatImportDescriptors+0x1f 04 0022f800 7c91de96 ntdll!LdrpWalkImportDescriptor+0x19e 05 0022fa50 7c91d99d ntdll!LdrpLoadImportModule+0x1c8 06 0022fa80 7c91d944 ntdll!LdrpHandleOneOldFormatImportDescriptor+0x5e 07 0022fa98 7c91c8a6 ntdll!LdrpHandleOldFormatImportDescriptors+0x1f 08 0022fb14 7c922370 ntdll!LdrpWalkImportDescriptor+0x19e 09 0022fc94 7c921639 ntdll!LdrpInitializeProcess+0xe02 0a 0022fd1c 7c90eac7 ntdll!_LdrpInitialize+0x183 0b 00000000 00000000 ntdll!KiUserApcDispatcher+0x7 I'm using the following command to link the shared libray for Xm (extracted from libtool output) gcc -shared -Wl,--enable-auto-import -Wl,--enable-runtime-pseudo-reloc -Wl,--exclude-libs,ALL -Wl,--out-implib,.libs/libXm.dll.a .libs/*.o -L/usr/X11R6/lib -lXmu -lXt -lXext -lXp -lX11 -lSM -lICE -o .libs/cygXm-4.dll I've read these links: http://www.cygwin.com/ml/cygwin/2004-10/msg01052.html http://www.cygwin.com/ml/cygwin/2004-09/msg01101.html http://www.cygwin.com/ml/cygwin-apps/2004-09/msg00309.html and I've tried the linker scripts but it doesn't solve the problem as I'm suspecting that a lot of the static declared stuff is not (always) initialized. What I am I doing wrong? Or where should I look? Is it a linker/libtool issue (Besides compiling openmotif on cygwin :-) ) Avi. N.B. sorry for the repost. I suspect that a different subject draws more attention... -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/