Page MenuHome GnuPG

macport compile failed in libassuan-2.4.3 due to undefine _POSIX_C_SOURCE
Closed, ResolvedPublic


Compile failed and complaint INADDR_LOOPBACK undefine. The macro is defined in in.h.
But in Mac OS X 10.4 tiger needs to define macro _POSIX_C_SOURCE to include them.

Revisions and Commits

Event Timeline

Ricky set External Link to 23 2016, 3:24 AM
Ricky added projects: libassuan, Bug Report.
Ricky set Version to 2.4.3.
Ricky added a subscriber: Ricky.

Please describe exactly how you build Libassuan. Compiler, OS etc, error message.

Detail info in
OS: PPC Tiger, Mac OS X 10.4.11
The build process is automated by macport.

I have seen that but pretty pelase describe it here so that we can also work
with email.

ballapete changed Version from 2.4.3 to 2.4.3, 2.4.2.Mar 1 2017, 8:59 PM
ballapete changed External Link from to,
ballapete added a subscriber: ballapete.

This happens on at least PPC Mac OS X 10.4.11, Tiger. Compiler is by default Apple's
version of GCC 4.2. The error is reported as this:

libtool: compile: /opt/local/bin/gcc-apple-4.2 -DHAVE_CONFIG_H -I. -I..
-I.. -I/opt/local/include -I/opt/local/include -pipe -Os -arch ppc -Wall
-Wcast-align -Wshadow -Wstrict-prototypes -Wpointer-arith -MT
libassuan_la-assuan-socket.lo -MD -MP -MF .deps/libassuan_la-assuan-
socket.Tpo -c assuan-socket.c -fno-common -DPIC -o .libs/libassuan_la-
assuan-socket.c: In function 'socks5_connect':
assuan-socket.c:732: error: 'INADDR_LOOPBACK' undeclared (first use in
this function)
assuan-socket.c:732: error: (Each undeclared identifier is reported only
assuan-socket.c:732: error: for each function it appears in.)
make[3]: * [libassuan_la-assuan-socket.lo] Error 1
make[3]: Leaving directory
* [all] Error 2
make[2]: Leaving directory
make[1]: * [all-recursive] Error 1
make[1]: Leaving directory
* [all] Error 2
make: Leaving directory
Command failed: cd
&& /usr/bin/make -w all

Cause is that the declaration of 'INADDR_LOOPBACK' is hidden behind some guards. The
two external links document the situation, they also offer patches, either the attached
one or this addition for src/assuan-socket.c:

//fix missing define in MacOSX 10.4 Tiger

#define INADDR_LOOPBACK (u_int32_t)0x7f000001


In ten days I'll be at home again with my Apple PowerBook G4 and might have time to
check the situation in Mac OS X 10.5, Leopard.

gniibe added a subscriber: gniibe.

The description of this bug report is not correct.
_POSIX_C_SOURCE should *not* be defined to use INADDR_LOOPBACK for the system.

Anyway, I applied a patch and pushed.

I think that checking macOS version is not needed or it is better without such a check. So, I don't directly use this patch: D380: 963_src_assuan-socket_INADDR_LOOPBACK.patch
But use simpler one.

It will be in the next release (2.4.4).
Thanks for reporting.