linker not finding -lX11 or -l/usr/X11R6/lib/libX11.dll.a

Michael Rogers
Tue Aug 5 15:42:00 GMT 2008

First, thanks for responding, Yaakov.
I'm finally approaching sanity on my efforts to port xgrafix (part of xoopic, which is the main goal) to cygwin.
I finally go the library object files to comple.  One of them used the prepocessor and there were some local .h files so all I needed to do was this,
gcc -E foo.c -I./ -I/usr/include foo.o  
on all the C files in the src directory.
But it won't link because when I try explicity linking like this, (I'm going to try to make the library a DLL)
gcc -shared -libXGC.dll -L/lib -L/usr/X11R6/lib -lX11 -LXpm -ltcl -ltk {list_of_objects_here}
or even when I explicity replace -lX11 by -l/usr/X11R6/lib/libX11.dll.a, the linker complains(!!!) that it can't find X11 or /usr/X11R6/lib/libX11.dll.a, repsectively
My initial reaction was, "What the hell!!!???"  Then I remembered reading in the archives that somebody else had seen what I believe is the same problem in 2006 and solved it by pointing to /usr/X11R6/lib/cygX11-6.dll to resolve all the functions.   It was 10:30 pm and I'd promised my wife I wasn't going to be up all night working on this so I stopped at that point, but I'll update everyone on my progress or lack thereof, tomorrow.  Meanwhile, I think this is, at least, part of the reason why the build hasn't produced usable libraries and executable - when you run "ar" and then "randlib" it doesn't resolve the functions in the link to the DLL so the build from the Makefile just blithely made a static *nix archive file. The linker, will resolve the function dependencies, but it has to see an actual archive.
But my question right now is, what's going on here?  This has got to be a very well-known problem. Am I just missing something obvious? Is there a quick fix or a patch?  Should I make my own import library from this DLL and stick it in my source directory as a better solution?  Why hasn't something like this been fixed yet, or if it has, do I need to modify some environment variable or supply some missing command line options?  Will I need to also point Xmp to this library? (Although, I'll probably find that out myself easily enough.)  Once I try this libcygX11-6 fix, or whatever fix you guys might recommend, I'm going just try to link to the regular tcl/tk ".a" libraries to just see if that works, since that's the only game in town unless I go get the xwindows versions from Cygwn Ports, as Yaakov suggested earlier.  
I'm just using the cygwin distribution from running setup (almost the entire distribution, though - I added all the utlities, xwindows, scripts, tcl/tk and gnome, editors, graphics, development and some other apps along with the defaults but didn't get a few of the optional applications I didn't need right away) at this point (except for running rebaseall it so it runs on Vista correctly). So I'm a bit afraid, frankly, to try installing the new xwin/*nix versions of tcl/tk myself just to get this stuff running. That just seems like a lot more things to potentially go wrong if you're a newbie like me.  If it turns out this doesn't work, I'll probably cave in do that, though.  But then I'll be whining to a different mailing list.

Unsubscribe info:
Problem reports:

More information about the Cygwin-xfree mailing list