Re: Cygwin - linker errors - __assert, __itob and __ftol
Brian, i figured out that not only do i need to compile against the no-cygwin flag but also link to it as well. so i tried to add the -Wl option like this: g++ -mno-cygwin -D__int64=long long -W1-mno-cygwin -shared -I C:\Apps\Java\jdk1.6.0_05\include -I C:\Apps\Java\jdk1.6.0_05\include\win32 -I C:\Users\me\My Documents\shapefiles\shapelib-1.2.10\shapelib-1.2.10 -I C:\Users\me\My Documents\shapefiles\shapelib128_bin_win -L C:\Users\me\My Documents\shapefiles\shapelib128_bin_win myFile.cpp -o libShapeData.dll C:\Users\me\My Documents\shapefiles\shapelib128_bin_win\shpopen.obj C:\Users\me\My Documents\shapefiles\shapelib128_bin_win\dbfopen.obj the error i get now is: /usr/lib/gcc/i686-pc-mingw32/3.4.4../../../../i686-pc-mingw32/bin/ld: unrecognized emulation mode: no-cygwin Supported Emulations: i386pe collect2: ld returned exit status at the prompt i did a ls /lib/gcc/i686-pc-mingw32 and it returned 3.4.4 so that seems right. any clues or suggestions?? thanks all in advance! On Sat, May 31, 2008 at 6:26 AM, Brian Dessent [EMAIL PROTECTED] wrote: C S wrote: gcc -D__int64=long long -shared -I\C:\Apps\Java\jdk1.6.0_05\include -I\C:\Apps\Java\jdk1.6.0_05\include\win32 -I\c:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win -L\c:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win myFile.cpp -o libShapeData.dll c:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win\shpopen.obj c:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win\dbfopen.obj the errors i get are: Warning: .drectve '-defaultlib:LIBC' - unrecognized Warning: .drectve '-defaultlib:OLDNAMES' - unrecognized Warning: .drectve '-defaultlib:LIBC' - unrecognized Warning: .drectve '-defaultlib:OLDNAMES' - unrecognized c:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win\shpopen.o:shpopen.c (.text+0x1485):undefined reference to __assert You can't mix and match objects like that. Those objects compiled by MSVC expect to be linked with the MSVCRT runtime, and here you're trying to link them against the Cygwin runtime. That's the cause of the linker errors. You can't do that. Every object needs to be consistent in the runtime that it was compiled against. So either you need to build everything against MSVCRT (i.e. gcc -mno-cygwin or using MSVC) or you need to build everything against Cygwin. But you can't do some with one and some the other. Brian -- 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/
Re: Cygwin - linker errors - __assert, __itob and __ftol
my whole command line script is: g++ -mno-cygwin -D__int64=long long -Wl,-mno-cygwin -shared -I C:\Apps\Java\jdk1.6.0_05\include -I C:\Apps\Java\jdk1.6.0_05\include\win32 -I C:\Users\me\My Documents\shapefiles\shapelib-1.2.10\shapelib-1.2.10 -I C:\Users\me\My Documents\shapefiles\shapelib128_bin_win -L C:\Users\me\My Documents\shapefiles\shapelib128_bin_win myFile.cpp -o libShapeData.dll C:\Users\me\My Documents\shapefiles\shapelib128_bin_win\shpopen.obj C:\Users\me\My Documents\shapefiles\shapelib128_bin_win\dbfopen.obj yeah i just typed in the 1 wrong. i am actually using an 'L'. if i take the -Wl,-mno-cygwin option out then i get the following error(s): -undefined reference to '_libmsvcrt_a_iname' along with other .drective warnings for -defaultLib such as LIBC and OLDNAMES -undefined reference to __nm___itob Info: resolving __itob by linked to __imp___itob(auto-import) thanks Dave K! On Tue, Jun 3, 2008 at 8:33 AM, Dave Korn [EMAIL PROTECTED] wrote: C S wrote on 03 June 2008 14:25: Brian, i figured out that not only do i need to compile against the no-cygwin flag but also link to it as well. so i tried to add the -Wl option like this: g++ -mno-cygwin -D__int64=long long -W1-mno-cygwin Ah, there's your problem. You typed a '1' instead of an 'l'. And you forgot the comma. No, wait a minute, I was wrong. The actual problem is that you aren't correctly describing what you've done. Cut and paste stuff from your shell into your email, don't just make it up or you'll inevitably get it wrong. Fortunately I can still tell what the actual error is: the error i get now is: /usr/lib/gcc/i686-pc-mingw32/3.4.4../../../../i686-pc-mingw32/bin/ld: unrecognized emulation mode: no-cygwin Supported Emulations: i386pe collect2: ld returned exit status at the prompt i did a ls /lib/gcc/i686-pc-mingw32 and it returned 3.4.4 so that seems right. any clues or suggestions?? thanks all in advance! It's not a linker option in that sense; you just need to make sure you've passed it to gcc or g++ along with all the .o files and it knows how to drive the linker from that. So just remove your -Wl altogether; the plain old -mno-cygwin that you have immediately after the g++ will do the job. The effect it has is to cause g++.exe to pass different -L options to ld. cheers, DaveK -- Can't think of a witty .sigline today -- 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/ -- 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/
Re: Cygwin - linker errors - __assert, __itob and __ftol
Dave - sorry i forgot to ask was there anything that i could try to get rid of those few undefined reference errors? thanks!! On Tue, Jun 3, 2008 at 8:49 AM, C S [EMAIL PROTECTED] wrote: my whole command line script is: g++ -mno-cygwin -D__int64=long long -Wl,-mno-cygwin -shared -I C:\Apps\Java\jdk1.6.0_05\include -I C:\Apps\Java\jdk1.6.0_05\include\win32 -I C:\Users\me\My Documents\shapefiles\shapelib-1.2.10\shapelib-1.2.10 -I C:\Users\me\My Documents\shapefiles\shapelib128_bin_win -L C:\Users\me\My Documents\shapefiles\shapelib128_bin_win myFile.cpp -o libShapeData.dll C:\Users\me\My Documents\shapefiles\shapelib128_bin_win\shpopen.obj C:\Users\me\My Documents\shapefiles\shapelib128_bin_win\dbfopen.obj yeah i just typed in the 1 wrong. i am actually using an 'L'. if i take the -Wl,-mno-cygwin option out then i get the following error(s): -undefined reference to '_libmsvcrt_a_iname' along with other .drective warnings for -defaultLib such as LIBC and OLDNAMES -undefined reference to __nm___itob Info: resolving __itob by linked to __imp___itob(auto-import) thanks Dave K! On Tue, Jun 3, 2008 at 8:33 AM, Dave Korn [EMAIL PROTECTED] wrote: C S wrote on 03 June 2008 14:25: Brian, i figured out that not only do i need to compile against the no-cygwin flag but also link to it as well. so i tried to add the -Wl option like this: g++ -mno-cygwin -D__int64=long long -W1-mno-cygwin Ah, there's your problem. You typed a '1' instead of an 'l'. And you forgot the comma. No, wait a minute, I was wrong. The actual problem is that you aren't correctly describing what you've done. Cut and paste stuff from your shell into your email, don't just make it up or you'll inevitably get it wrong. Fortunately I can still tell what the actual error is: the error i get now is: /usr/lib/gcc/i686-pc-mingw32/3.4.4../../../../i686-pc-mingw32/bin/ld: unrecognized emulation mode: no-cygwin Supported Emulations: i386pe collect2: ld returned exit status at the prompt i did a ls /lib/gcc/i686-pc-mingw32 and it returned 3.4.4 so that seems right. any clues or suggestions?? thanks all in advance! It's not a linker option in that sense; you just need to make sure you've passed it to gcc or g++ along with all the .o files and it knows how to drive the linker from that. So just remove your -Wl altogether; the plain old -mno-cygwin that you have immediately after the g++ will do the job. The effect it has is to cause g++.exe to pass different -L options to ld. cheers, DaveK -- Can't think of a witty .sigline today -- 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/ -- 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/
Re: Cygwin - linker errors - __assert, __itob and __ftol
thanks for the tip Brian. i thought that i had tried to -mno-cygwin option before but maybe i did not. i have a script file set up now with that command option: $g++ -mno-cygwin -D__int64=long long -shared -I C:\Apps\Java\jdk1.6.0_05\include -I C:\Apps\Java\jdk1.6.0_05\include\win32 -I C:\Users\usmsci\My Documents\shapefiles\shapelib-1.2.10\shapelib-1.2.10 -I C:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win -L C:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win com_radiancetech_dss_DataGathererShapeFileReader_DataGathererShapeFileReader.cpp -o libShapeData.dll C:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win\shpopen.obj C:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win\dbfopen.obj errors i get now are: Warning: .drectve '-defaultlib:LIBC' - unrecognized Warning: .drectve '-defaultlib:OLDNAMES' - unrecognized Warning: .drectve '-defaultlib:LIBC' - unrecognized Warning: .drectve '-defaultlib:OLDNAMES' - unrecognized fu01.o:(.idata$2+0xc): undefined reference to '_libmsvcrt_a_iname' fu04.o:(.idata$2+0xc): undefined reference to '_libmsvcrt_a_iname' undefined reference to '__nm___itob' Info: resolving __itob by linking to __imp___itob(auto_import) is there possibly another option that i need to add to the command line? thanks again for the help...!! chad On Sat, May 31, 2008 at 6:26 AM, Brian Dessent [EMAIL PROTECTED] wrote: C S wrote: gcc -D__int64=long long -shared -I\C:\Apps\Java\jdk1.6.0_05\include -I\C:\Apps\Java\jdk1.6.0_05\include\win32 -I\c:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win -L\c:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win myFile.cpp -o libShapeData.dll c:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win\shpopen.obj c:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win\dbfopen.obj the errors i get are: Warning: .drectve '-defaultlib:LIBC' - unrecognized Warning: .drectve '-defaultlib:OLDNAMES' - unrecognized Warning: .drectve '-defaultlib:LIBC' - unrecognized Warning: .drectve '-defaultlib:OLDNAMES' - unrecognized c:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win\shpopen.o:shpopen.c (.text+0x1485):undefined reference to __assert You can't mix and match objects like that. Those objects compiled by MSVC expect to be linked with the MSVCRT runtime, and here you're trying to link them against the Cygwin runtime. That's the cause of the linker errors. You can't do that. Every object needs to be consistent in the runtime that it was compiled against. So either you need to build everything against MSVCRT (i.e. gcc -mno-cygwin or using MSVC) or you need to build everything against Cygwin. But you can't do some with one and some the other. Brian -- 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/
Cygwin - linker errors - __assert, __itob and __ftol
hi all - i am trying to compile a C++ native library using the shapelibrary. the one for linux is built but in cygwin i seem to be having some linker error problems and i have to assume it has to do with something regarding MSVC. i am including Java because i am using JNI to talk back and forth to Java. libShapeData.dll is my own native library that i want to build for windows. at the cygwin prompt: gcc -D__int64=long long -shared -I\C:\Apps\Java\jdk1.6.0_05\include -I\C:\Apps\Java\jdk1.6.0_05\include\win32 -I\c:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win -L\c:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win myFile.cpp -o libShapeData.dll c:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win\shpopen.obj c:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win\dbfopen.obj the errors i get are: Warning: .drectve '-defaultlib:LIBC' - unrecognized Warning: .drectve '-defaultlib:OLDNAMES' - unrecognized Warning: .drectve '-defaultlib:LIBC' - unrecognized Warning: .drectve '-defaultlib:OLDNAMES' - unrecognized c:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win\shpopen.o:shpopen.c (.text+0x1485):undefined reference to __assert the same thing happens for dbfopen.c. other undefined references include __ftol and __itob. those are the only 3. is there a compiler option that i can use or is there a way to somehow rebuild the shapefile library somehow? i am really not sure what is going on here - so it is kind of hard what to specifically ask. thanks all for the help in advance! -- 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/
Re: Cygwin - linker errors - __assert, __itob and __ftol
i did not know about gcj. i guess i missed that somehow? thanks for the tip. my command line right now is: gcj -D__int64=long long -shared -I C:\Apps\Java\jdk1.6.0_05\include -I C:\Apps\Java\jdk1.6.0_05\include\win32 -I C:\Users\usmsci\My Documents\shapefiles\shapelib-1.2.10\shapelib-1.2.10 -I C:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win -L c:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win fileName.cpp -o libShapeData.dll c:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win\shpopen.o c:\Users\usmsci\My Documents\shapefiles\shapelib128_bin_win\dbfopen.o the error i get is: gcj: cannot specify -D without --main what do i need to do to remedy this? thanks!!! i dont have a main function in my .cpp file. i assume thats what its complaining about? i am using the -D option otherwise i would endless complaints about jlong not having a type and a bunch of other related stuff. On Fri, May 30, 2008 at 5:23 AM, Tim Prince [EMAIL PROTECTED] wrote: C S wrote: hi all - i am trying to compile a C++ native library using the shapelibrary. the one for linux is built but in cygwin i seem to be having some linker error problems and i have to assume it has to do with something regarding MSVC. i am including Java because i am using JNI to talk back and forth to Java. libShapeData.dll is my own native library that i want to build for windows. Perhaps you could explain why you don't use the cygwin java native compiler (gcj). -- 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/ -- 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/
Re: Cygwin - linker errors - __assert, __itob and __ftol
i realized after i sent that last email that maybe i wasnt clear earlier that i already have created a .h file to match my JNI .Cpp file using the javah utility. so i have already done the work for that. i just need to link that up into my own .DLL to be used by a .java class. already have it working in linux and mac. thanks again!! On Fri, May 30, 2008 at 5:23 AM, Tim Prince [EMAIL PROTECTED] wrote: C S wrote: hi all - i am trying to compile a C++ native library using the shapelibrary. the one for linux is built but in cygwin i seem to be having some linker error problems and i have to assume it has to do with something regarding MSVC. i am including Java because i am using JNI to talk back and forth to Java. libShapeData.dll is my own native library that i want to build for windows. Perhaps you could explain why you don't use the cygwin java native compiler (gcj). -- 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/ -- 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/