This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Linking problems


At 07:34 PM 2/1/2004, Sean LeBlanc you wrote:
>On 02-01 18:16, Larry Hall wrote:
>> At 12:40 PM 2/1/2004, Sean LeBlanc you wrote:
>> >Hi all. I'm currently having troubles linking against a lib. The signature
>> >it complains about certainly shows up when I search the lib. I have been
>> >able to build against other libs in the same set (MS' Host Integration
>> >Server API), but not against anything in this lib.
>> >
>> >Are there a set of things to look for when link failures like this happen?
>> >Do some windows libs get exported in different ways that require something
>> >beyond this:
>> >
>> >I'm compiling with both -L<libdir> and -l<libname>.  
>> >
>> >-v doesn't seem to give me any helpful information.
>> 
>> 
>> Please read and follow:
>> 
>> >Problem reports:       http://cygwin.com/problems.html
>> 
>> when contacting the list with an issue you believe to be Cygwin-related.
>> This allows interested parties on the list to evaluate your problem in 
>> the light of some specifics and ask informed follow-up questions.
>> 
>> Thanks,
>
>Well, I guess this is a way of telling me that I didn't include enough info.
>:) 


You're very astute.  I'd give you a gold star for this [this is in no way 
related to CGF's Gold Star program <http://cygwin.com/goldstars/>] but you 
didn't fully digest the content.  I see no output from cygcheck *attached*.
:-(


>I'm not intimating that this is a problem with Cygwin or the gcc (ld)
>port per se, I'm just trying to find out if maybe there is a different way
>that some libs export their methods. Or maybe there is a quirk I'm unaware
>of.  Let me reiterate that I have been able to link against other libs in
>this same api using this same version of gcc on this same version of
>Cygwin...so it's clear that it's possible. 


There's no magic, if that's what you're asking.  You imply that you can
determine that the function you're looking for is in the library.  I'm
not sure how you're doing this but if you can find it via 'nm', then 
you're all set.  


>Anyway, here is a listing of what happens during make when the error occurs.
>Maybe this will be provide more insight:
>
>gcc -v -mno-cygwin -L./lib -Wl,--add-stdcall-alias -shared -o cpic.dll

        ^^^^^^^^^^^^
Ah, so you're using the MinGW version of gcc.  This really takes you out
of the realm of this list and into the MinGW one <http://www.mingw.org/>


>cpic.o -lwcpic32 -lwappc32 -wincsv32
>Reading specs from /usr/lib/gcc-lib/i686-pc-mingw32/3.2/specs
>gcc: unrecognized option `-wincsv32'

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

This seems like a problem to me.


>Configured with: /netrel/src/gcc-3.2-3/configure
>--enable-languages=c,c++,f77,java --enable-libgcj --enable-threads=posix
>--with-system-zlib --enable-
>nls --without-included-gettext --enable-interpreter
>--disable-sjlj-exceptions --disable-version-specific-runtime-libs
>--enable-shared --build=i686-pc-
>linux --host=i686-pc-cygwin --target=i686-pc-cygwin --enable-haifa
>--prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib
>--includedir=/
>nonexistent/include --libexecdir=/usr/sbin
>Thread model: posix
>gcc version 3.2 20020927 (prerelease)

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
gcc is out of date.


> /usr/lib/gcc-lib/i686-pc-mingw32/3.2/../../../../i686-pc-mingw32/bin/ld.exe
>--shared -Bdynamic -e _DllMainCRTStartup@12 -o cpic.dll /usr/lib/gcc-lib/
>i686-pc-mingw32/3.2/../../../../i686-pc-mingw32/lib/dllcrt2.o
>/usr/lib/gcc-lib/i686-pc-mingw32/3.2/crtbegin.o -L./lib
>-L/usr/lib/gcc-lib/i686-pc-mingw
>32/3.2
>-L/usr/lib/gcc-lib/i686-pc-mingw32/3.2/../../../../i686-pc-mingw32/lib
>-L/usr/lib/gcc-lib/i686-pc-mingw32/3.2/../../.. --add-stdcall-alias cpic
>.o -lwcpic32 -lwappc32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt
>-lmingw32 -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc
>-lmoldname -lm
>ingwex -lmsvcrt /usr/lib/gcc-lib/i686-pc-mingw32/3.2/crtend.o
>cpic.o(.text+0x6a):cpic.c: undefined reference to `cminit@12'
>
>
>Note that this is a DLL I'm trying to build, but I'm also unable to link
>when just building an executable that uses this same lib. BTW, searching for
>cminit@12 on wcpic32.lib does come back with results.


Ah!  Here's some details.  Well, here's what I get:

nm /Program\ Files/Microsoft\ Visual\ Studio/VC98/Lib/WCPIC32.LIB | grep cminit
00000000 I __imp__cminit@12
00000000 T _cminit@12
00000000 I __imp__cminit_ext@12
00000000 T _cminit_ext@12


This implies to me that you don't have the proper prototype included in 
your program for "cminit()".  I suppose you could try to avoid that by 
specifying "--enable-stdcall-fixup" for gcc but I'm not confident that 
your situation fits the variations that this flag encompasses.


>I hope this provides enough info. 


Better.  But, as I mentioned above, you at least left off the cygcheck 
output, which is real handy when trying to understand your installation
and configuration.  But it looks like you're asking a question which is
off-topic here, since you're not really using the Cygwin compiler (but
rather the MinGW one).  I think I've given you some answers and clues on 
things to pursue or (double) check.  Other than that, I'm not sure how 
much more help I can be, unless you provide a small example and can show
that you have the same problem using gcc with Cygwin as well (which you
probably can).  

Good luck,


--
Larry Hall                              http://www.rfk.com
RFK Partners, Inc.                      (508) 893-9779 - RFK Office
838 Washington Street                   (508) 893-9889 - FAX
Holliston, MA 01746                     


--
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/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]