View previous topic :: View next topic |
Author |
Message |
Sadako Advocate
Joined: 05 Aug 2004 Posts: 3792 Location: sleeping in the bathtub
|
Posted: Wed Dec 29, 2010 8:22 pm Post subject: expected '=', ',', ';', 'asm' or '__attribute__' [SOLVED] |
|
|
Okay, I'm trying to emerge arpon 2.1 (not in portage) on a uclibc system, where the same ebuild works perfectly on a standard glibc-based install, and I'm getting the following error; Code: | /var/portage/tmp/portage/net-analyzer/arpon-2.1/work/ArpON-2.1/src/arpon.c:237: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'rlock' |
Here's line #237 of arpon.c, along with the two preceding lines; Code: | static pthread_t thread[5];
static pthread_attr_t join_attr, detach_attr;
static pthread_rwlock_t rlock, wlock; |
Anyone see what the problem may be?
I've done a little C programming before, but I'm by no means a programmer, and I know this would usually go in unsupported but this is more of a programming issue to me than I'd like to understand and fix myself.
Oh, here's what uclibc and glibc define for pthread_rwlock_t for reference, presuming that's where the issue may be; uclibc pthreadtypes.h: | typedef struct _pthread_rwlock_t
{
struct _pthread_fastlock __rw_lock; /* Lock to guarantee mutual exclusion */
int __rw_readers; /* Number of readers */
_pthread_descr __rw_writer; /* Identity of writer, or NULL if none */
_pthread_descr __rw_read_waiting; /* Threads waiting for reading */
_pthread_descr __rw_write_waiting; /* Threads waiting for writing */
int __rw_kind; /* Reader/Writer preference selection */
int __rw_pshared; /* Shared between processes or not */
} pthread_rwlock_t; |
glibc pthreadtypes.h: | typedef union
{
# if __WORDSIZE == 64
struct
{
int __lock;
unsigned int __nr_readers;
unsigned int __readers_wakeup;
unsigned int __writer_wakeup;
unsigned int __nr_readers_queued;
unsigned int __nr_writers_queued;
int __writer;
int __shared;
unsigned long int __pad1;
unsigned long int __pad2;
/* FLAGS must stay at this position in the structure to maintain
binary compatibility. */
unsigned int __flags;
} __data;
# else
struct
{
int __lock;
unsigned int __nr_readers;
unsigned int __readers_wakeup;
unsigned int __writer_wakeup;
unsigned int __nr_readers_queued;
unsigned int __nr_writers_queued;
/* FLAGS must stay at this position in the structure to maintain
binary compatibility. */
unsigned char __flags;
unsigned char __shared;
unsigned char __pad1;
unsigned char __pad2;
int __writer;
} __data;
# endif
char __size[__SIZEOF_PTHREAD_RWLOCK_T];
long int __align;
} pthread_rwlock_t; |
Thanks for any light you can shed on this. _________________ "You have to invite me in"
Last edited by Sadako on Thu Dec 30, 2010 2:53 pm; edited 1 time in total |
|
Back to top |
|
|
tony-curtis Tux's lil' helper
Joined: 20 May 2006 Posts: 111
|
Posted: Wed Dec 29, 2010 9:15 pm Post subject: |
|
|
Quote: | error: expected '=', ',', ';', 'asm' or '__attribute__' before 'rlock' |
Giveaway. Indicates a variable declaration with an unknown type. This probably means a missing #include, in this case, of <pthread.h> in that source file. Probably... |
|
Back to top |
|
|
ewaller Apprentice
Joined: 11 Aug 2005 Posts: 264 Location: Pasadena, CA
|
Posted: Thu Dec 30, 2010 5:17 am Post subject: |
|
|
tony-curtis wrote: | Giveaway. Indicates a variable declaration with an unknown type. This probably means a missing #include, in this case, of <pthread.h> in that source file. Probably... |
This is certainly correct. I will bet there is a warning (much earlier in the compiler output messages) there is a missing .h file
What is the output of glib-config --cflags
Do the directories it reported point to contain the include file for the expected pthread.h ??
Does the arpon ebuild invoke .configure? Or does it use an existing Makefile that exists in the downloaded source? _________________ Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday |
|
Back to top |
|
|
Sadako Advocate
Joined: 05 Aug 2004 Posts: 3792 Location: sleeping in the bathtub
|
Posted: Thu Dec 30, 2010 2:37 pm Post subject: |
|
|
ewaller wrote: | tony-curtis wrote: | Giveaway. Indicates a variable declaration with an unknown type. This probably means a missing #include, in this case, of <pthread.h> in that source file. Probably... |
This is certainly correct. I will bet there is a warning (much earlier in the compiler output messages) there is a missing .h file | This was the first error reported, but I googled a little more after reading both your replies (tyvm btw) and came across this.
Sure enough, the code from the uclibc pthreadtypes.h I posted is contained within "#if defined __USE_UNIX98 || defined __USE_XOPEN2K".
I added 'append-cflags "-D _XOPEN_SOURCE=600' to the ebuild, but it gave me a load of different errors, the first of which is; Code: | In file included from /usr/include/pcap/pcap.h:51,
from /usr/include/pcap.h:45,
from /var/portage/tmp/portage/net-analyzer/arpon-2.1/work/ArpON-2.1/src/arpon.c:60:
/usr/include/pcap/bpf.h:68: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'bpf_u_int32'
/usr/include/pcap/bpf.h:89: error: expected specifier-qualifier-list before 'u_int'
/usr/include/pcap/bpf.h:105: error: expected specifier-qualifier-list before 'u_short'
/usr/include/pcap/bpf.h:1043: error: expected specifier-qualifier-list before 'u_short'
/usr/include/pcap/bpf.h:1057: error: expected '=', ',', ';', 'asm' or '__attribute__' before 'bpf_filter' | However, I just tested the same ebuild change on the glibc install, and received the exact same error, so it's obviously not quite the right fix...
Tried appending both "-D __USE_UNIX98" and "-D __USE_XOPEN2K" too, with no effect, still hit the original error...
Quote: | What is the output of glib-config --cflags
Do the directories it reported point to contain the include file for the expected pthread.h ??
Does the arpon ebuild invoke .configure? Or does it use an existing Makefile that exists in the downloaded source? | I don't have glib2 within the uclibc system (glib needs gettext, which needs some localization stuff uclibc doesn't provide yet, so a lot of hacking/patching is required, and I have no need for anything using glib on this anyways).
Besides, I think what I posted just above renders this question moot?
It uses cmake for the build system, unfortunately...
So, any ideas on the "correct" way to get the code from pthreadtypes.h included?
Thanks again. _________________ "You have to invite me in" |
|
Back to top |
|
|
Sadako Advocate
Joined: 05 Aug 2004 Posts: 3792 Location: sleeping in the bathtub
|
Posted: Thu Dec 30, 2010 2:52 pm Post subject: |
|
|
Ugh, finally got it...
Grep'ing for "__USE_UNIX98\|__USE_XOPEN2K" within /usr/include brought me to features.h, where these are all #undef'd then defined selectively, with "# define _XOPEN_SOURCE 600" contained within an "#ifdef _GNU_SOURCE"...
'append-cflags "-D _GNU_SOURCE"' in the ebuild got it to compile, thank you both for your help, marking as solved. _________________ "You have to invite me in" |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|