I'm learning this process as I go but it's frustrating and time-consuming.  I'm 
trying to compile an xwindows-based graphing library from a unix tarball that 
didn't anticipate cygwin porting.  The configure script had sections for linux, 
solaris, aix and something others, but not cygwin.  This is my first attempt 
at *any* cygwin port. 
I actually got it to compile by overriding the archive name checks in the 
"configure" file with their asbolute path names - I pointed it to the import 
libraries libX11.dll.a, libXpm.dll.a, libtcl84.a and libtk84.a.  I ran the 
configure script and made makefiles which compiled the entire distribution, 
including test files that linked to the libraries.  As one might expect, it 
didn't run because I was cavalier about linking the libraries correctly.  I 
compiled it debuggable and got a segmentation fault immediately.  I'm a newbie 
to gdb (I'm used to gui based debuggers) so I haven't tracked down the point 
that this happens yet, but I did an "info sharedlibrary" (or something like 
that) and it appears that the linker was smart enough that it had 
loaded the actual DLLs that run under cygwin-x for the four archives listed 
above.  So I think the problem is that it made a static archive, mylib.a, and 
the test programs tried to link to that.  I
 suppose that's a no-no under cygwin-x.
I sort of expected this but I don't know how to fix it.  I tried recompiling 
the library as a DLL in its /src directory on the command line but it's not 
working.  In what appears to be the closest attempt I've gotten so far - using 
"gcc -shared -o mylib.dll ./*.o -lX11 -lXpm -ltcl84 -ltk84" - the 
linker complains that the first object it tries to link has multiple 
definitions of all its functions.  I suppose there are some switches or 
variables I could define or modify in the Makefiles or the configure file that 
would make sure that the whole thing automatically compiled and 
linked everything consistently for cygwin-x but I just don't know that stuff 
well enough at this point. 
It's ironically a pity that the configuration/make system worked so well with a 
little redirection to the import libraries because I don't know enough about 
how to modify it make dynamic link libraries, or ensure it's linking correctly 
to DLLs, if its running under cygwin-x.  I still might also not be linking 
right to xwindows and tcl libraries but I *think* the linker did that right 
when I gave it the import lib files (eg, libX11.dll.a).  Is that all you need 
to do?
I wouldn't be averse to just recompiling everything piecemeal, from the comand 
line, but I've been reluctant so far because I don't know what other cygwin 
specific libraries or other switches I'd need to include.  That's transparent 
running make. This uses those big standardized GNU configure and Makefiles so 
its pretty opaque to a newbie.  I suppose I can back that out by searching on 
the arguments to the "CC" command in the Makefiles.
If anybody has some quick insights for me here I'd really appreciate it.  This 
is taking forever.




--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://x.cygwin.com/docs/
FAQ:                   http://x.cygwin.com/docs/faq/

Reply via email to