mailing list of musl libc
 help / color / mirror / code / Atom feed
* FTBFS on i386: aio_cancel.c relies on macro-protected defines in aio.h
@ 2012-04-03 23:09 Isaac Dunham
  2012-04-03 23:16 ` Rich Felker
  0 siblings, 1 reply; 3+ messages in thread
From: Isaac Dunham @ 2012-04-03 23:09 UTC (permalink / raw)
  To: musl

aio_cancel.c won't build.
It seems one of the _*_SOURCE macros must be defined to build it, and
I'm not sure which one (guessing it's _POSIX_SOURCE or _XOPEN_SOURCE ?).

Following is the relevant output from make:
---
cc -fno-stack-protector -I./src/internal -I./include -I./arch/i386 -c
-o src/aio/aio_cancel.o src/aio/aio_cancel.c src/aio/aio_cancel.c:5:
warning: ‘struct aiocb’ declared inside parameter list
src/aio/aio_cancel.c:5: warning: its scope is only this definition or
declaration, which is probably not what you want src/aio/aio_cancel.c:
In function ‘aio_cancel’: src/aio/aio_cancel.c:13: error:
‘AIO_NOTCANCELED’ undeclared (first use in this function)
src/aio/aio_cancel.c:13: error: (Each undeclared identifier is reported
only once src/aio/aio_cancel.c:13: error: for each function it appears
in.) src/aio/aio_cancel.c:15: error: dereferencing pointer to
incomplete type src/aio/aio_cancel.c:15: error: ‘AIO_ALLDONE’
undeclared (first use in this function) make: ***
[src/aio/aio_cancel.o] Error 1
---
aio_cancel.c #include's aio.h, which does define these macros...if
appropriate defines were passed.
Relevant portions of aio.h:
---
#if defined(_POSIX_SOURCE) || defined(_POSIX_C_SOURCE) \
 || defined(_XOPEN_SOURCE) || defined(_GNU_SOURCE)
/* a few lines omitted */
struct aiocb {
	int aio_fildes, aio_lio_opcode, aio_reqprio;
	volatile void *aio_buf;
	size_t aio_nbytes;
	struct sigevent aio_sigevent;
	void *__td;
	int __lock[2];
	int __err;
	ssize_t __ret;
	off_t aio_offset;
	void *__next, *__prev;
	char __dummy4[32-2*sizeof(void *)];
};

#define AIO_CANCELED 0
#define AIO_NOTCANCELED 1
#define AIO_ALLDONE 2

/* several more lines */
#endif /* _*_SOURCE */
----

Just out of curiosity, is there a reason to macro-protect headers that
are not part of ANSI C when all other flavors support them?

Isaac Dunham



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: FTBFS on i386: aio_cancel.c relies on macro-protected defines in aio.h
  2012-04-03 23:09 FTBFS on i386: aio_cancel.c relies on macro-protected defines in aio.h Isaac Dunham
@ 2012-04-03 23:16 ` Rich Felker
  2012-04-04  0:18   ` Isaac Dunham
  0 siblings, 1 reply; 3+ messages in thread
From: Rich Felker @ 2012-04-03 23:16 UTC (permalink / raw)
  To: musl

On Tue, Apr 03, 2012 at 04:09:25PM -0700, Isaac Dunham wrote:
> aio_cancel.c won't build.
> It seems one of the _*_SOURCE macros must be defined to build it, and
> I'm not sure which one (guessing it's _POSIX_SOURCE or _XOPEN_SOURCE ?).

The default Makefile for musl has -D_XOPEN_SOURCE=700 in the CFLAGS.
You cannot build the vast majority of musl if you remove this.

> Just out of curiosity, is there a reason to macro-protect headers that
> are not part of ANSI C when all other flavors support them?

Indeed, this protection in aio.h seems to be a mistake. Normally I
avoid that sort of thing; I'll fix it. But the rest of musl will still
fail to build with the missing feature test macro.

Rich


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: FTBFS on i386: aio_cancel.c relies on macro-protected defines in aio.h
  2012-04-03 23:16 ` Rich Felker
@ 2012-04-04  0:18   ` Isaac Dunham
  0 siblings, 0 replies; 3+ messages in thread
From: Isaac Dunham @ 2012-04-04  0:18 UTC (permalink / raw)
  To: musl

On Tue, 3 Apr 2012 19:16:23 -0400
Rich Felker <dalias@aerifal.cx> wrote:

> On Tue, Apr 03, 2012 at 04:09:25PM -0700, Isaac Dunham wrote:
> > aio_cancel.c won't build.
> > It seems one of the _*_SOURCE macros must be defined to build it,
> > and I'm not sure which one (guessing it's _POSIX_SOURCE or
> > _XOPEN_SOURCE ?).
> 
> The default Makefile for musl has -D_XOPEN_SOURCE=700 in the CFLAGS.
> You cannot build the vast majority of musl if you remove this.
> 

Figured out the problem: I had 
CFLAGS = -fno-stack-protector
instead of 
CFLAGS += -fno-stack-protector

In theory, it would be possible to avoid erroring on this by moving 
-include config.mak to the top, using ?= instead of = for most
variables, and using += for CFLAGS.
But this might also allow other problems for those with less sane
default CFLAGS...

Also, putting *_LIBS in the section before config.mak does allow
freedom to shoot oneself in the foot in a similar manner--but if
someone can figure out that, they can probably find several more
ways to break it.



^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2012-04-04  0:18 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-04-03 23:09 FTBFS on i386: aio_cancel.c relies on macro-protected defines in aio.h Isaac Dunham
2012-04-03 23:16 ` Rich Felker
2012-04-04  0:18   ` Isaac Dunham

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/musl/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).