Re: cygwin issue

kha <[email protected]> Tue, 06 Apr 2004 16:43:32 -0500
Newsgroups gmane.comp.security.libnet
Message-ID <[email protected]>
Yes i've got it...

I made some modifications :

first i modified libnet.h in /usr/include to replace
#include <win32/in_systm.h>
by
#include <cygwin/in_systm.h>

But as i got the same error, i tried with Dev-C++ and it worked... I 
don't know why. Here is the dev-c++ project for devRedirect.c

Bloodshed used these lines to compile and link :

gcc.exe -D__DEBUG__ -c devRedirect.c -o devRedirect.o 
-I"C:/Programs/Dev-Cpp/include" -I"C:/Programs/cygwin/usr/include/pcap"  
-I"C:/Programs/cygwin/usr/include" -mno-cygwin -D_CYGWIN -DNO_SNPRINTF   
-fexpensive-optimizations -O3 -g3

gcc.exe -D__DEBUG__ devRedirect.o  -o "Projet1.exe" 
-L"C:/Programs/Dev-Cpp/lib" -L"C:/Programs/cygwin/lib/w32api" 
-L"C:/Programs/cygwin/lib" C:/Programs/cygwin/lib/libnet.a 
C:/Programs/cygwin/lib/libpacket.a C:/Programs/cygwin/lib/libwpcap.a 
C:/Programs/cygwin/lib/w32api/libiphlpapi.a 
C:/Programs/cygwin/lib/w32api/libws2_32.a -g3

this works but  when i try to reproduce it under cygwin i've got the 
same error as you... If someone know why ??

Cygwin uses this gcc :

gcc -v
Reading specs from /usr/lib/gcc-lib/i686-pc-cygwin/3.3.1/specs
Configured with: /GCC/gcc-3.3.1-3/configure --with-gcc --with-gnu-ld 
--with-gnu-
as --prefix=/usr --exec-prefix=/usr --sysconfdir=/etc --libdir=/usr/lib 
--libexe
cdir=/usr/sbin --mandir=/usr/share/man --infodir=/usr/share/info 
--enable-langua
ges=c,ada,c++,f77,pascal,java,objc --enable-libgcj 
--enable-threads=posix --with
-system-zlib --enable-nls --without-included-gettext 
--enable-interpreter --enab
le-sjlj-exceptions --disable-version-specific-runtime-libs 
--enable-shared --dis
able-win32-registry --enable-java-gc=boehm 
--disable-hash-synchronization --verb
ose --target=i686-pc-cygwin --host=i686-pc-cygwin --build=i686-pc-cygwin
Thread model: posix
gcc version 3.3.1 (cygming special)

and Dev-Cpp uses this one :

gcc -v
Reading specs from g:/programs/Dev-Cpp/bin/../lib/gcc-lib/mingw32/3.2/specs
Configured with: ../gcc/configure --with-gcc --with-gnu-ld --with-gnu-as 
--host=
mingw32 --target=mingw32 --prefix=/mingw --enable-threads --disable-nls 
--enable
-languages=f77,c++,objc,ada --disable-win32-registry --disable-shared
Thread model: win32
gcc version 3.2 (mingw special 20020817-1)

Math'

Alberto Ornaghi wrote:

>
> I'm trying to compile a simple program under cygwin. the source code 
> only contain the libnet_init fuction. the problem is at linking time.
> it seems that it cannot resolve the errno variable even if it is 
> defined in libc.a
>
> anyone with the same problem ?
>
> gcc zz.c -o zz -lnet -lwpcap -liphlpapi -lws2_32 -lpacket
>
> /libnet.a(libnet_init.o)(.text+0x105): In function `libnet_init':
> /libnet_init.c:69: undefined reference to `__errno'
> /libnet.a(libnet_pblock.o)(.text+0x179): In function `libnet_pblock
> _probe':
> /libnet_pblock.c:93: undefined reference to `__errno'
> /libnet.a(libnet_pblock.o)(.text+0x39a): In function `libnet_pblock
> _new':/libnet_pblock.c:162: undefined reference to `__errno'
> /libnet.a(libnet_pblock.o)(.text+0x857): In function `libnet_pblock
> _coalesce':
> /libnet_pblock.c:314: undefined reference to `__errno'
> /libnet.a(libnet_link_win32.o)(.text+0x916): In function `libnet_wi
> n32_read_arp_table':
> /libnet_link_win32.c:309: undefined reference to `__assert'
> /libnet.a(libnet_resolve.o)(.text+0x2ac): In function `libnet_name2
> addr4':
> /libnet_resolve.c:128: undefined reference to `__errno'
> collect2: ld returned 1 exit status
>
>
Projet1.dev (text/plain, 1.1 KB)
[Project]
FileName=Projet1.dev
Name=Projet1
UnitCount=1
Type=1
Ver=1
ObjFiles=
Includes=C:\Programs\cygwin\usr\include\pcap;C:\Programs\cygwin\usr\include
Libs=C:\Programs\cygwin\lib\w32api;C:\Programs\cygwin\lib
PrivateResource=
ResourceIncludes=
MakeIncludes=
Compiler=-mno-cygwin -D_CYGWIN -DNO_SNPRINTF_@@_
CppCompiler=
Linker=C:/Programs/cygwin/lib/libnet.a_@@_C:/Programs/cygwin/lib/libpacket.a_@@_C:/Programs/cygwin/lib/libwpcap.a_@@_C:/Programs/cygwin/lib/w32api/libiphlpapi.a_@@_C:/Programs/cygwin/lib/w32api/libws2_32.a_@@_
IsCpp=0
Icon=
ExeOutput=
ObjectOutput=
OverrideOutput=0
OverrideOutputName=Projet1.exe
HostApplication=
Folders=
CommandLine=
UseCustomMakefile=0
CustomMakefile=
IncludeVersionInfo=0
SupportXPThemes=0
CompilerSet=0
CompilerSettings=0000000001001001000000

[Unit1]
FileName=devRedirect.c
CompileCpp=0
Folder=Projet1
Compile=1
Link=1
Priority=1000
OverrideBuildCmd=0
BuildCmd=

[VersionInfo]
Major=0
Minor=1
Release=1
Build=1
LanguageID=1033
CharsetID=1252
CompanyName=
FileVersion=
FileDescription=Developed using the Dev-C++ IDE
InternalName=
LegalCopyright=
LegalTrademarks=
OriginalFilename=
ProductName=
ProductVersion=
AutoIncBuildNr=0