daq-db / daqdb

DB for DAQ systems based on Persistent Memory and NVMe drives
Apache License 2.0
21 stars 9 forks source link

error: implicit declaration of function 'posix_fallocate' is invalid in C99 #309

Closed rajgoesout closed 4 years ago

rajgoesout commented 4 years ago

I'm trying to build it on macos 10.15.2

On running make -j$(nproc), I get the following error log:

[ 22%] Performing install step for 'project_libconfig'
Error copying file (if different) from "/Users/rajdeep/daqdb/third-party/libconfig/out/liblibconfig++.so" to "/Users/rajdeep/daqdb/third-party/../bin/liblibconfig++.so".
make[2]: *** [third-party/libconfig/src/project_libconfig-stamp/project_libconfig-install] Error 1
make[1]: *** [third-party/CMakeFiles/project_libconfig.dir/all] Error 2
[ 23%] Linking C shared library ../bin/libhdr_histogram.dylib
Undefined symbols for architecture x86_64:
  "_compress", referenced from:
      _hdr_encode_compressed in hdr_histogram_log.c.o
     (maybe you meant: _hdr_decode_compressed, _hdr_encode_compressed )
  "_compressBound", referenced from:
      _hdr_encode_compressed in hdr_histogram_log.c.o
  "_inflate", referenced from:
      _hdr_decode_compressed_v0 in hdr_histogram_log.c.o
      _hdr_decode_compressed_v1 in hdr_histogram_log.c.o
      _hdr_decode_compressed_v2 in hdr_histogram_log.c.o
  "_inflateEnd", referenced from:
      _hdr_decode_compressed_v0 in hdr_histogram_log.c.o
      _hdr_decode_compressed_v1 in hdr_histogram_log.c.o
      _hdr_decode_compressed_v2 in hdr_histogram_log.c.o
  "_inflateInit_", referenced from:
      _hdr_decode_compressed_v0 in hdr_histogram_log.c.o
      _hdr_decode_compressed_v1 in hdr_histogram_log.c.o
      _hdr_decode_compressed_v2 in hdr_histogram_log.c.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/libhdr_histogram.dylib] Error 1
make[1]: *** [third-party/CMakeFiles/hdr_histogram.dir/all] Error 2
../../src/../src/common/file.c:48:10: fatal error: 'sys/sysmacros.h' file not found
#include <sys/sysmacros.h>
         ^~~~~~~~~~~~~~~~~
../../src/../src/common/file_posix.c:47:10: fatal error: 'sys/sysmacros.h' file not found
#include <sys/sysmacros.h>
         ^~~~~~~~~~~~~~~~~
1 error generated.
make[5]: *** [../nondebug/libpmem/file.o] Error 1
make[5]: *** Waiting for unfinished jobs....
1 error generated.
make[5]: *** [../nondebug/libpmem/file_posix.o] Error 1
../../src/../src/common/os_posix.c:221:12: error: implicit declaration of function 'posix_fallocate' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
        int err = posix_fallocate(fd, offset, len);
                  ^
../../src/../src/common/os_posix.c:221:12: note: did you mean 'os_posix_fallocate'?
../../src/../src/common/os_posix.c:174:1: note: 'os_posix_fallocate' declared here
os_posix_fallocate(int fd, os_off_t offset, off_t len)
^
../../src/../src/common/os_posix.c:316:23: error: implicit conversion changes signedness: 'int' to 'clockid_t'
      [-Werror,-Wsign-conversion]
        return clock_gettime(id, ts);
               ~~~~~~~~~~~~~ ^~
../../src/../src/common/os_posix.c:37:9: error: macro is not used [-Werror,-Wunused-macros]
#define _GNU_SOURCE
        ^
3 errors generated.
make[5]: *** [../nondebug/libpmem/os_posix.o] Error 1
../../src/../src/common/os_thread_posix.c:67:2: error: array size is negative
        COMPILE_ERROR_ON(sizeof(os_tls_key_t) < sizeof(pthread_key_t));
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../common/util.h:475:51: note: expanded from macro 'COMPILE_ERROR_ON'
#define COMPILE_ERROR_ON(cond) ((void)sizeof(char[(cond) ? -1 : 1]))
                                                  ^~~~~~~~~~~~~~~
../../src/../src/common/os_thread_posix.c:104:2: error: array size is negative
        COMPILE_ERROR_ON(sizeof(os_mutex_t) < sizeof(pthread_mutex_t));
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../common/util.h:475:51: note: expanded from macro 'COMPILE_ERROR_ON'
#define COMPILE_ERROR_ON(cond) ((void)sizeof(char[(cond) ? -1 : 1]))
                                                  ^~~~~~~~~~~~~~~
../../src/../src/common/os_thread_posix.c:151:9: error: implicit declaration of function 'pthread_mutex_timedlock' is invalid in
      C99 [-Werror,-Wimplicit-function-declaration]
        return pthread_mutex_timedlock((pthread_mutex_t *)mutex, abstime);
               ^
../../src/../src/common/os_thread_posix.c:151:9: note: did you mean 'pthread_mutex_trylock'?
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/pthread.h:390:5: note: 'pthread_mutex_trylock' declared here
int pthread_mutex_trylock(pthread_mutex_t *);
    ^
../../src/../src/common/os_thread_posix.c:160:2: error: array size is negative
        COMPILE_ERROR_ON(sizeof(os_rwlock_t) < sizeof(pthread_rwlock_t));
        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../common/util.h:475:51: note: expanded from macro 'COMPILE_ERROR_ON'
#define COMPILE_ERROR_ON(cond) ((void)sizeof(char[(cond) ? -1 : 1]))
                                                  ^~~~~~~~~~~~~~~
../../src/../src/common/os_thread_posix.c:225:9: error: implicit declaration of function 'pthread_rwlock_timedrdlock' is invalid
      in C99 [-Werror,-Wimplicit-function-declaration]
        return pthread_rwlock_timedrdlock((pthread_rwlock_t *)rwlock, abstime);
               ^
../../src/../src/common/os_thread_posix.c:225:9: note: did you mean 'pthread_rwlock_tryrdlock'?
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/pthread.h:452:5: note: 'pthread_rwlock_tryrdlock' declared here
int pthread_rwlock_tryrdlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_tryrdlock);
    ^
../../src/../src/common/os_thread_posix.c:235:9: error: implicit declaration of function 'pthread_rwlock_timedwrlock' is invalid
      in C99 [-Werror,-Wimplicit-function-declaration]
        return pthread_rwlock_timedwrlock((pthread_rwlock_t *)rwlock, abstime);
               ^
../../src/../src/common/os_thread_posix.c:235:9: note: did you mean 'pthread_rwlock_trywrlock'?
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/pthread.h:455:5: note: 'pthread_rwlock_trywrlock' declared here
int pthread_rwlock_trywrlock(pthread_rwlock_t *) __DARWIN_ALIAS(pthread_rwlock_trywrlock);
    ^
../../src/../src/common/os_thread_posix.c:244:50: error: use of undeclared identifier 'pthread_spinlock_t'
        COMPILE_ERROR_ON(sizeof(os_spinlock_t) < sizeof(pthread_spinlock_t));
                                                        ^
../../src/../src/common/os_thread_posix.c:245:9: error: implicit declaration of function 'pthread_spin_init' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
        return pthread_spin_init((pthread_spinlock_t *)lock, pshared);
               ^
../../src/../src/common/os_thread_posix.c:245:48: error: expected expression
        return pthread_spin_init((pthread_spinlock_t *)lock, pshared);
                                                      ^
../../src/../src/common/os_thread_posix.c:245:28: error: use of undeclared identifier 'pthread_spinlock_t'
        return pthread_spin_init((pthread_spinlock_t *)lock, pshared);
                                  ^
../../src/../src/common/os_thread_posix.c:254:9: error: implicit declaration of function 'pthread_spin_destroy' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
        return pthread_spin_destroy((pthread_spinlock_t *)lock);
               ^
../../src/../src/common/os_thread_posix.c:254:51: error: expected expression
        return pthread_spin_destroy((pthread_spinlock_t *)lock);
                                                         ^
../../src/../src/common/os_thread_posix.c:254:31: error: use of undeclared identifier 'pthread_spinlock_t'
        return pthread_spin_destroy((pthread_spinlock_t *)lock);
                                     ^
../../src/../src/common/os_thread_posix.c:263:9: error: implicit declaration of function 'pthread_spin_lock' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
        return pthread_spin_lock((pthread_spinlock_t *)lock);
               ^
../../src/../src/common/os_thread_posix.c:263:9: note: did you mean 'pthread_mutex_lock'?
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/pthread.h:383:5: note: 'pthread_mutex_lock' declared here
int pthread_mutex_lock(pthread_mutex_t *);
    ^
../../src/../src/common/os_thread_posix.c:263:48: error: expected expression
        return pthread_spin_lock((pthread_spinlock_t *)lock);
                                                      ^
../../src/../src/common/os_thread_posix.c:263:28: error: use of undeclared identifier 'pthread_spinlock_t'; did you mean
      'pthread_spin_lock'?
        return pthread_spin_lock((pthread_spinlock_t *)lock);
                                  ^~~~~~~~~~~~~~~~~~
                                  pthread_spin_lock
../../src/../src/common/os_thread_posix.c:263:9: note: 'pthread_spin_lock' declared here
        return pthread_spin_lock((pthread_spinlock_t *)lock);
               ^
../../src/../src/common/os_thread_posix.c:272:9: error: implicit declaration of function 'pthread_spin_unlock' is invalid in C99
      [-Werror,-Wimplicit-function-declaration]
        return pthread_spin_unlock((pthread_spinlock_t *)lock);
               ^
../../src/../src/common/os_thread_posix.c:272:9: note: did you mean 'pthread_mutex_unlock'?
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/pthread.h:393:5: note: 'pthread_mutex_unlock' declared here
int pthread_mutex_unlock(pthread_mutex_t *);
    ^
../../src/../src/common/os_thread_posix.c:272:50: error: expected expression
        return pthread_spin_unlock((pthread_spinlock_t *)lock);
                                                        ^
../../src/../src/common/os_thread_posix.c:272:30: error: use of undeclared identifier 'pthread_spinlock_t'
        return pthread_spin_unlock((pthread_spinlock_t *)lock);
                                    ^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
20 errors generated.
make[5]: *** [../nondebug/libpmem/os_thread_posix.o] Error 1
make[4]: *** [libpmem] Error 2
make[3]: *** [install] Error 2
make[2]: *** [third-party/pmdk/src/project_pmdk-stamp/project_pmdk-build] Error 2
make[1]: *** [third-party/CMakeFiles/project_pmdk.dir/all] Error 2
make: *** [all] Error 2
gjerecze commented 4 years ago

Hello, DAQDB was not tested on macos. Could you try with any distribution that DAQDB supports (CentOS/Fedora)?

rajgoesout commented 4 years ago

Ok, thanks