Opened 13 years ago

Closed 13 years ago

#86 closed defect (fixed)

RoarAudio current fails to build with clang

Reported by: themaister Owned by: ph3-der-loewe
Priority: major Milestone: RoarAudio major release 0.4
Component: RoarAudio Main Package Version: current
Keywords: Cc: themaister
Architecture: Compiler: clang
Difficulty: Kernel: Linux
Operating System: Parent Tickets:
Patch attached: no Protocol:
Sound driver: Topic: Porting

Description

Clang version : 2.8
OS : Linux x86_64 2.6.37-rc2

clang complains about libroaross :)

clang -g -Wall -Wextra -O2 -I../include -I../include/libroar -fPIC -c -o libroaross.o libroaross.c
libroaross.c:2034:5: error: redefinition of 'stat'
int stat(const char *path, struct stat *buf) {


In file included from libroaross.c:36:
In file included from ../include/roaraudio.h:77:
/usr/include/sys/stat.h:455:1: note: previous definition is here
NTH (stat (const char *path, struct stat *statbuf))

/usr/include/sys/stat.h:455:8: note: instantiated from:
NTH (stat (const char *path, struct stat *statbuf))


libroaross.c:2047:5: error: redefinition of 'fstat'
int fstat(int filedes, struct stat *buf) {


In file included from libroaross.c:36:
In file included from ../include/roaraudio.h:77:
/usr/include/sys/stat.h:469:1: note: previous definition is here
NTH (fstat (int fd, struct stat *statbuf))

/usr/include/sys/stat.h:469:8: note: instantiated from:
NTH (fstat (int fd, struct stat *statbuf))


libroaross.c:2060:5: error: redefinition of 'lstat'
int lstat(const char *path, struct stat *buf) {


In file included from libroaross.c:36:
In file included from ../include/roaraudio.h:77:
/usr/include/sys/stat.h:462:1: note: previous definition is here
NTH (lstat (const char *path, struct stat *statbuf))

/usr/include/sys/stat.h:462:8: note: instantiated from:
NTH (lstat (const char *path, struct stat *statbuf))


3 errors generated.

Subtickets

Change History (3)

comment:1 Changed 13 years ago by ph3-der-loewe

  • Compiler set to clang
  • Milestone set to RoarAudio major release 0.4
  • Priority changed from minor to major
  • Topic set to Porting
  • Version set to current

Can you please test what happens if you change the prototype to exactly the same as in the header, including var names and such?

comment:2 Changed 13 years ago by ph3-der-loewe

  • Cc themaister added
  • Kernel set to Linux
  • Owner set to ph3-der-loewe
  • Status changed from new to assigned

My clang: clang version 1.1 (Debian 2.7-3)
OS: Debian sid

Most problems are now fixed.
The following is still in place:
clang sets GNUC = 4 and defines USE_EXTERN_INLINES_IN_LIBC.

later one is not defined by gcc. This enables a inlined version of stat(), lstat() and fstat() which are not used with gcc.

The check used is:

#if defined GNUC && GNUC >= 2 && defined USE_EXTERN_INLINES_IN_LIBC
/* Inlined versions of the real stat and mknod functions. */

Google did not throw any useful hits. Can someone please contact a clang ML or something about this?

comment:3 Changed 13 years ago by ph3-der-loewe

  • Resolution set to fixed
  • Status changed from assigned to closed

currently disabling *stat() if clang is defined. Please reopen in case you have more infos from clang upstream on this.

Note: See TracTickets for help on using tickets.