#42 ipfw compiling

closed
nobody
5
2010-07-16
2010-07-16
No

Good day. I try to compile ipfw for 64-bit windows platform.

I have a trouble with linking, it's look's like where no standart libc library in migw86_64. Log:

x86_64-w64-mingw32-gcc.exe -L/usr/lib -lws2_32 -Lc:/cygwin/lib -lc -o ipfw.exe ipfw2.o dummynet.o main.o ipv6.o qsort_r.o expand_number.o humanize_number.o glue.o
ipfw2.o:ipfw2.c:(.text+0x7a): undefined reference to `bcopy'
ipfw2.o:ipfw2.c:(.text+0xbc): undefined reference to `err'
ipfw2.o:ipfw2.c:(.text+0xfe): undefined reference to `err'
ipfw2.o:ipfw2.c:(.text+0x14b): undefined reference to `my_socket'
ipfw2.o:ipfw2.c:(.text+0x16c): undefined reference to `err'
ipfw2.o:ipfw2.c:(.text+0x1cd): undefined reference to `wnd_getsockopt'
ipfw2.o:ipfw2.c:(.text+0x1f6): undefined reference to `wnd_setsockopt'
ipfw2.o:ipfw2.c:(.text+0x257): undefined reference to `bcmp'
ipfw2.o:ipfw2.c:(.text+0x32b): undefined reference to `warnx'
ipfw2.o:ipfw2.c:(.text+0x3a3): undefined reference to `warnx'
ipfw2.o:ipfw2.c:(.text+0x435): undefined reference to `getprotobynumber'
ipfw2.o:ipfw2.c:(.text+0x459): undefined reference to `htons'
ipfw2.o:ipfw2.c:(.text+0x466): undefined reference to `getservbyport'
ipfw2.o:ipfw2.c:(.text+0x5dd): undefined reference to `__imp___ctype_ptr__'
ipfw2.o:ipfw2.c:(.text+0x65b): undefined reference to `__imp___ctype_ptr__'
and so on...

I use mingw-w64-1.0-bin_i686-mingw_20100702.zip version. Can you help me? What link path must be setup? Where i can get 64-bit libc library?

Discussion

  • Jonathan Yong
    Jonathan Yong
    2010-07-16

    Hi,

    are you sure ipfw2 supports windows at all? If it does, you should not add Cygwin lib to the linker search path.

    With all mingw targets, you use what comes with Windows, there isn't a separate C library.

     
  • Hi, jon_y.

    Yes, ipfw have windows port, http://info.iet.unipi.it/~luigi/dummynet/
    And it's compiling fine with cygwin for 32-bit Windows OS.

    This is from Makefile:
    USRDIR?= /usr
    ifeq ($(TCC),)
    CFLAGS += -I$(USRDIR)/include
    LDFLAGS += -L$(USRDIR)/lib
    else
    LDFLAGS += -L$(TCC)/lib -ltcc1 -L. -lws2_32
    endif

    What do you mean "you should not add Cygwin lib"? In PATH must not be a cygwin?

    Ok, i remove Cygwin from PATH. On start compiling i see next message:
    process_begin: CreateProcess(NULL, uname, ...) failed.

    When compiling go ok, and on link the same trouble.

    May be i must add some MSVC library path?

     
  • Jonathan Yong
    Jonathan Yong
    2010-07-16

    The cygwin lib search path is "-Lc:/cygwin/lib -lc", there is no -lc in mingw. Remove those.

    Cygwin and mingw are different animals, Please do not mix them up.

     
  • i already remove cygwin library using. but i use cygwin include path (-I C:/cygwin/usr/include), because there no sys/ioctl.h (and i think other default system headers). Where i can get them?

     
  • ok, what i can send you to get a help in building that project? i can send all files in project for reviewing, if you can spend a little time for resolving my trouble.

     
  • Jonathan Yong
    Jonathan Yong
    2010-07-16

    Hi,

    you cannot use Cygwin headers at all, those headers are for Cygwin but not MinGW. The ioctl.h file is Unix specific, you won't find them on Windows SDKs.

    I suggest you use Cygwin entirely for the ipfw frontend. I don't know about the drivers themselves, you may have better luck with mingw-w64 there.

     
  • I am already compile a ipfw 64-bit drivers for Windows (using WinDDK and cygwin). And now i try to compile frontend application for 64-bit windows. And there problem with mingw-w64, i post a linking trouble at the begining of thread.

    So, if I correctly understand, i can't compile application for windows (if in application using a linux specific), like this do a cygwin. First i must port every linux specific things to windows, and after that i will be able to compile an application for win-64 using mingw-w64. Am i right?

     
  • Jonathan Yong
    Jonathan Yong
    2010-07-16

    Yes exactly.

    Cygwin already provides a Unix compatibility layer, but mingw-w64 does not. You'll have to port all those parts that use ioctl.h and other Unix bits to use Win32/Win64 provided interfaces.

     
  • ok, thanks a lot!

     
    • status: open --> closed