Skip to content

Loading…

Fix building of mogoose under FreeBSD #16

Merged
merged 0 commits into from

2 participants

@dnaeon
  • sys/socket.h should be included when building under FreeBSD

Currently when trying to build the examples under FreeBSD you get this error:

% make
OS=uname; test "$OS" = Linux && LIBS="-ldl" ; cc -W -Wall -I.. -pthread -g hello.c ../mongoose.c $LIBS -o hello;
../mongoose.c: In function 'mg_connect':
../mongoose.c:3988: error: 'PF_INET' undeclared (first use in this function)
../mongoose.c:3988: error: (Each undeclared identifier is reported only once
../mongoose.c:3988: error: for each function it appears in.)

The attached patch fixes this error for FreeBSD systems.

@cpq
Cesanta Software member
cpq commented

sys/socket.h is already included. does it fail because of the #defines at the beginning of the file, e.g. _XOPEN_SOURCE, etc?
Is there a free shell, or live CD for qemu ? What version of FreeBSD you're using ?

@dnaeon

Hi valenok,

Yes, apperantely it fails because of _XOPEN_SOURCE - if I comment it then it builds fine, with _XOPEN_SOURCE defined it fails to build.

I'm running FreeBSD 9.0-RELEASE.

@dnaeon

Ok, according to flockfile(3) under Linux you need only this:

-#define _XOPEN_SOURCE 600 // For flockfile() on Linux
+#define _XOPEN_SOURCE // For flockfile() on Linux

Just checked it on my FreeBSD system and it builds fine.

I'll re-work the patch and provide you with a new one. OK for you as well?

@cpq
Cesanta Software member
cpq commented

Yes, sounds good, thanks!

@dnaeon dnaeon merged commit 8428f36 into cesanta:master
@dnaeon

Please check pull request #17 for the new patch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Showing with 0 additions and 0 deletions.
Something went wrong with that request. Please try again.