I want to build ObexFTP on Win32.
I managed to build OpenObex as a win32 DLL using the supplied makefile.msc after making just a few changes.
There isn't an MS makefile included with ObexFTP, so I configured it to build as a MinGW app using a Cygwin environment:
CFLAGS=-mno-cygwin ./configure --host=i686-mingw32msvc --build=i686-mingw32msvc
Again after a few modifications I managed to build all the object code (using GCC in MinGW mode).
But at the end I get this:
../obexftp/.libs/libobexftp.a(client.o)(.text+0x356): In function `client_done':
/cygdrive/h/th/obex/obexftp-0.10.6/obexftp/client.c:218: undefined reference to `_ntohl@4'
../bfb/.libs/libbfb.a(bfb.o)(.text+0xb1): In function `bfb_stuff_data':
/cygdrive/h/th/obex/obexftp-0.10.6/bfb/bfb.c:134: undefined reference to `_htons@4'
../bfb/.libs/libbfb.a(bfb.o)(.text+0x5c1): In function `bfb_write_packets':
/cygdrive/h/th/obex/obexftp-0.10.6/bfb/bfb.c:324: undefined reference to `_select@20'
../bfb/.libs/libbfb.a(bfb.o)(.text+0x935): In function `bfb_check_data':
/cygdrive/h/th/obex/obexftp-0.10.6/bfb/bfb.c:493: undefined reference to `_htons@4'
collect2: ld returned 1 exit status
That's after modifying the final GCC linking command so it includes ws2_32.dll - I also tried adding some more win32 DLL's as you can see from the command line:
gcc -mno-cygwin -g -Wall -Wmissing-declarations -Wmissing-prototypes -Wall -mno-cygwin -g -Wall -o obexftp.exe obexftp.o bt_discovery.o -L.. -lopenobex-0.9 -L../../../../glib/lib -lglib-2.0 -lws2_32 -lwinmm -ladvapi32 -lwsock32 ../obexftp/.libs/libobexftp.a ../cobexbfb/.libs/libcobexbfb.a ../bfb/.libs/libbfb.a
Any idea how I get further? I have tried with different header files for the htons and select delcarations but to no avail.
MingW32 does only implement POSIX functions, nothing else. However, ntohl(), ntons() and select() are not POSIX but SUSv2, see
CygWin implements more in its layer but you have to use the cygwin DLL.