Eina from EFL incompatible with ftw.h?

130 views Asked by At

I tried to play with the file module of the Eina library and the classical system calls. My problem is when I want to use eina and some functions and constants from ftw.h.

Here is the first simple code:

#define _XOPEN_SOURCE 500 /*Get nftw() and S_IFSOCK declarations*/              
#include <ftw.h>                                                                
#include <stdio.h>                                                              
#include <stdlib.h>                                                             
#include <Eina.h>                                                               
/*Compile with                                                                  
gcc -o eina_ftw eina_ftw.c $(pkg-config --libs --cflags eina)                   
*/                                                                              
int main(int argc, char **argv)                                                 
{                                                                               
  int a = FTW_DNR;                                                              
  int b=0;                                                                      
  b = FTW_MOUNT;                                                                
  printf("ok\n");                                                               
  exit(EXIT_SUCCESS);                                                           
}

When I compile it I have those errors:

In file included from /usr/include/eina-1/eina/eina_lock.h:50:0,
                 from /usr/include/eina-1/Eina.h:259,
                 from eina_ftw.c:5:
 /usr/include/eina-1/eina/eina_inline_lock_posix.x:57:1: erreur: unknown type name   thread_spinlock_t’
typedef pthread_spinlock_t Eina_Spinlock;
^
/usr/include/eina-1/eina/eina_inline_lock_posix.x:561:4: erreur: unknown type name ‘pthread_barrier_t’
pthread_barrier_t barrier;
^

Ok so I tried this:

#include <Eina.h>  
#define _XOPEN_SOURCE 500 /*Get nftw() and S_IFSOCK declarations*/              
#include <ftw.h>                                                                
#include <stdio.h>                                                              
#include <stdlib.h>                                                             

/*Compile with                                                                  
gcc -o eina_ftw eina_ftw.c $(pkg-config --libs --cflags eina)                   
*/                                                                              
int main(int argc, char **argv)                                                 
{                                                                               
  int a = FTW_DNR;                                                              
  int b=0;                                                                      
  b = FTW_MOUNT;                                                                
  printf("ok\n");
  exit(EXIT_SUCCESS);                                                           
}

And now I have this kind of error:

eina_ftw.c: In function ‘main’:
eina_ftw.c:13:7: erreur: ‘FTW_MOUNT’ undeclared (first use in this function)
   b = FTW_MOUNT;
       ^
eina_ftw.c:13:7: note: each undeclared identifier is reported only once for each function it appears in

So I would like to know if there is a way to solve this problem?

1

There are 1 answers

0
Jonathan Leffler On BEST ANSWER

Setting _XOPEN_SOURCE 500 is (approximately equivalent to) asking for the 1995 POSIX declarations.

Set it to at least 600 (for POSIX 2001) or perhaps 700 (for POSIX 2008).

Strictly, of course, setting _XOPEN_SOURCE is asking for a particular version of the Open Group (originally X/Open) Single Unix Specification, but there is a strong relationship between the POSIX standard and the Open Group standard. You can find out more at: