Ethereal-dev: [Ethereal-dev] Compiling on cygwin does not work anymore

Note: This archive is from the project's previous web site, ethereal.com. This list is no longer active.

From: Biot Olivier <Olivier.Biot@xxxxxxxxxxx>
Date: Wed, 17 Mar 2004 16:31:44 +0100
Hi list,

It is impossible to compile Ethereal on cygwin anymode since the build of
the libethereal shared library. Libtool always complains about missing
symbols. I think this is also the reason why we cannot build plugins on
cygwin.

FYI:

$ 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 --libexecdir=/usr/sbin --mandir=/usr/share/man
--infodir=/usr/share/info --enable-languages=c,ada,c++,f77,pascal,java,objc
--enable-libgcj --enable-threads=posix --with-system-zlib --enable-nls
--without-included-gettext --enable-interpreter --enable-sjlj-exceptions
--disable-version-specific-runtime-libs --enable-shared
--disable-win32-registry --enable-java-gc=boehm
--disable-hash-synchronization --verbose --target=i686-pc-cygwin
--host=i686-pc-cygwin --build=i686-pc-cygwin
Thread model: posix
gcc version 3.3.1 (cygming special)

It looks like cygwin requires more steps in building a shared library. See
for example http://cygwin.com/cygwin-ug-net/dll.html for more info.

FYI the following produces a native Windows executable on CygWin, with a
native DLL:

#################### h3h3.h:
#ifndef H3H3_H
#define H3H3_H
void
h3h3_print(const char *s);
#endif

#################### h3h3.c:

#include <stdio.h>
#include "h3h3.h"

void
h3h3_print(const char *s)
{
        if (s == NULL) {
                puts("(NULL string)");
        } else {
                puts(s);
        }
}

#################### hello.c:
#include <stdio.h>
#include "h3h3.h"

int
main (void)
{
        h3h3_print("Hello, World!\n");

        return 0;
}

#################### compilation:
$ gcc -mms-bitfields -mno-cygwin -c h3h3.c -o h3h3.o
$ gcc -mms-bitfields -mno-cygwin -shared -o h3h3.dll h3h3.o
$ gcc -mms-bitfields -mno-cygwin -o hello hello.c -L. -lh3h3

Regards,

Olivier