sionescu / iolib

Common Lisp I/O library
http://common-lisp.net/project/iolib/
MIT License
141 stars 31 forks source link

Cannot load on macOS 10.13.4 #56

Open muyinliu opened 6 years ago

muyinliu commented 6 years ago

Related info

OS: macOS 10.13.4 (uname -a return Darwin muyinliu.local 17.5.0 Darwin Kernel Version 17.5.0: Mon Mar 5 22:24:32 PST 2018; root:xnu-4570.51.1~1/RELEASE_X86_64 x86_64) Common Lisp: SBCL v1.4.6 iolib: v0.8.3

Key error message

/usr/local/include/lfp/time.h:38:13: error: typedef redefinition with different types
      ('int' vs 'enum clockid_t')
typedef int clockid_t;

Full message

(ql:quickload 'iolib)

=>

To load "iolib":
  Load 1 ASDF system:
    iolib
; Loading "iolib"
[package iolib/syscalls]...; g++ -m64 -Wno-write-strings -I /opt/local/include/ -I/Users/muyinliu/quicklisp/local-projects/iolib-0.8.3/src/grovel/ -o /Users/muyinliu/.cache/common-lisp/sbcl-1.4.6-macosx-x64/sbcl-1.4.6/Users/muyinliu/quicklisp/local-projects/iolib-0.8.3/src/syscalls/ffi-types-unix /Users/muyinliu/.cache/common-lisp/sbcl-1.4.6-macosx-x64/sbcl-1.4.6/Users/muyinliu/quicklisp/local-projects/iolib-0.8.3/src/syscalls/ffi-types-unix.c
.
debugger invoked on a IOLIB/GROVEL::GROVEL-ERROR in thread #<THREAD "main thread" RUNNING {10005605B3}>: External process exited with code 1.
Command was: "g++" "-m64" "-Wno-write-strings" "-I" "/opt/local/include/" "-I/Users/muyinliu/quicklisp/local-projects/iolib-0.8.3/src/grovel/" "-o" "/Users/muyinliu/.cache/common-lisp/sbcl-1.4.6-macosx-x64/sbcl-1.4.6/Users/muyinliu/quicklisp/local-projects/iolib-0.8.3/src/syscalls/ffi-types-unix" "/Users/muyinliu/.cache/common-lisp/sbcl-1.4.6-macosx-x64/sbcl-1.4.6/Users/muyinliu/quicklisp/local-projects/iolib-0.8.3/src/syscalls/ffi-types-unix.c"
Output was:

Error output was:
clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
In file included from /Users/muyinliu/.cache/common-lisp/sbcl-1.4.6-macosx-x64/sbcl-1.4.6/Users/muyinliu/quicklisp/local-projects/iolib-0.8.3/src/syscalls/ffi-types-unix.c:6:
In file included from /usr/local/include/lfp.h:54:
/usr/local/include/lfp/time.h:38:13: error: typedef redefinition with different types ('int' vs 'enum clockid_t')
typedef int clockid_t;
            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/time.h:171:3: note: previous definition is here
} clockid_t;
  ^
In file included from /Users/muyinliu/.cache/common-lisp/sbcl-1.4.6-macosx-x64/sbcl-1.4.6/Users/muyinliu/quicklisp/local-projects/iolib-0.8.3/src/syscalls/ffi-types-unix.c:6:
In file included from /usr/local/include/lfp.h:54:
/usr/local/include/lfp/time.h:42:10: warning: 'CLOCK_REALTIME' macro redefined [-Wmacro-redefined]
# define CLOCK_REALTIME  0
         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/time.h:154:9: note: previous definition is here
#define CLOCK_REALTIME _CLOCK_REALTIME
        ^
In file included from /Users/muyinliu/.cache/common-lisp/sbcl-1.4.6-macosx-x64/sbcl-1.4.6/Users/muyinliu/quicklisp/local-projects/iolib-0.8.3/src/syscalls/ffi-types-unix.c:6:
In file included from /usr/local/include/lfp.h:54:
/usr/local/include/lfp/time.h:43:10: warning: 'CLOCK_MONOTONIC' macro redefined [-Wmacro-redefined]
# define CLOCK_MONOTONIC 1
         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/time.h:156:9: note: previous definition is here
#define CLOCK_MONOTONIC _CLOCK_MONOTONIC
        ^
2 warnings and 1 error generated.

Type HELP for debugger help, or (SB-EXT:EXIT) to exit from SBCL.

restarts (invokable by number or by possibly-abbreviated name):
  0: [RETRY                        ] Retry #<PROCESS-OP > on #<GROVEL-FILE "iolib/syscalls" "ffi-types">.
  1: [ACCEPT                       ] Continue, treating #<PROCESS-OP > on #<GROVEL-FILE "iolib/syscalls" "ffi-types"> as having been successful.
  2:                                 Retry ASDF operation.
  3: [CLEAR-CONFIGURATION-AND-RETRY] Retry ASDF operation after resetting the configuration.
  4:                                 Retry ASDF operation.
  5:                                 Retry ASDF operation after resetting the configuration.
  6: [ABORT                        ] Give up on "iolib"
  7:                                 Exit debugger, returning to top level.

(IOLIB/GROVEL::GROVEL-ERROR "External process exited with code ~S.~@
                     Command was: ~S~{ ~S~}~@
                     Output was:~%~A~@
                     Error output was:~%~A" 1 "g++" ("-m64" "-Wno-write-strings" "-I" "/opt/local/include/" "-I/Users/muyinliu/quicklisp/local-projects/iolib-0.8.3/src/grovel/" "-o" "/Users/muyinliu/.cache/common-lisp/sbcl-1.4.6-macosx-x64/sbcl-1.4.6/Users/muyinliu/quicklisp/local-projects/iolib-0.8.3/src/syscalls/ffi-types-unix" "/Users/muyinliu/.cache/common-lisp/sbcl-1.4.6-macosx-x64/sbcl-1.4.6/Users/muyinliu/quicklisp/local-projects/iolib-0.8.3/src/syscalls/ffi-types-unix.c") "" #<(SIMPLE-ARRAY CHARACTER (1840)) clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
In file included from /Users/muyinliu/.cache/common-lisp/sbcl-1.4.6-macosx-x64/sbcl-1.4.6/Users... {100A151C3F}>)
   source: (ERROR (QUOTE GROVEL-ERROR) :FORMAT-CONTROL FORMAT-CONTROL :FORMAT-ARGUMENTS FORMAT-ARGUMENTS)
0]

Run compile command directly in shell

"g++" "-m64" "-Wno-write-strings" "-I" "/opt/local/include/" "-I/Users/muyinliu/quicklisp/local-projects/iolib-0.8.3/src/grovel/" "-o" "/Users/muyinliu/.cache/common-lisp/sbcl-1.4.6-macosx-x64/sbcl-1.4.6/Users/muyinliu/quicklisp/local-projects/iolib-0.8.3/src/syscalls/ffi-types-unix" "/Users/muyinliu/.cache/common-lisp/sbcl-1.4.6-macosx-x64/sbcl-1.4.6/Users/muyinliu/quicklisp/local-projects/iolib-0.8.3/src/syscalls/ffi-types-unix.c"

=>

clang: warning: treating 'c' input as 'c++' when in C++ mode, this behavior is deprecated [-Wdeprecated]
In file included from /Users/muyinliu/.cache/common-lisp/sbcl-1.4.6-macosx-x64/sbcl-1.4.6/Users/muyinliu/quicklisp/local-projects/iolib-0.8.3/src/syscalls/ffi-types-unix.c:6:
In file included from /usr/local/include/lfp.h:54:
/usr/local/include/lfp/time.h:38:13: error: typedef redefinition with different types
      ('int' vs 'enum clockid_t')
typedef int clockid_t;
            ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/time.h:171:3: note:
      previous definition is here
} clockid_t;
  ^
In file included from /Users/muyinliu/.cache/common-lisp/sbcl-1.4.6-macosx-x64/sbcl-1.4.6/Users/muyinliu/quicklisp/local-projects/iolib-0.8.3/src/syscalls/ffi-types-unix.c:6:
In file included from /usr/local/include/lfp.h:54:
/usr/local/include/lfp/time.h:42:10: warning: 'CLOCK_REALTIME' macro redefined [-Wmacro-redefined]
# define CLOCK_REALTIME  0
         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/time.h:154:9: note:
      previous definition is here
#define CLOCK_REALTIME _CLOCK_REALTIME
        ^
In file included from /Users/muyinliu/.cache/common-lisp/sbcl-1.4.6-macosx-x64/sbcl-1.4.6/Users/muyinliu/quicklisp/local-projects/iolib-0.8.3/src/syscalls/ffi-types-unix.c:6:
In file included from /usr/local/include/lfp.h:54:
/usr/local/include/lfp/time.h:43:10: warning: 'CLOCK_MONOTONIC' macro redefined [-Wmacro-redefined]
# define CLOCK_MONOTONIC 1
         ^
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/time.h:156:9: note:
      previous definition is here
#define CLOCK_MONOTONIC _CLOCK_MONOTONIC
        ^
2 warnings and 1 error generated.
muyinliu commented 6 years ago

In file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/time.h the definition of clockid_t is:

typedef enum {
_CLOCK_REALTIME __CLOCK_AVAILABILITY = 0,
#define CLOCK_REALTIME _CLOCK_REALTIME
_CLOCK_MONOTONIC __CLOCK_AVAILABILITY = 6,
#define CLOCK_MONOTONIC _CLOCK_MONOTONIC
#if !defined(_POSIX_C_SOURCE) || defined(_DARWIN_C_SOURCE)
_CLOCK_MONOTONIC_RAW __CLOCK_AVAILABILITY = 4,
#define CLOCK_MONOTONIC_RAW _CLOCK_MONOTONIC_RAW
_CLOCK_MONOTONIC_RAW_APPROX __CLOCK_AVAILABILITY = 5,
#define CLOCK_MONOTONIC_RAW_APPROX _CLOCK_MONOTONIC_RAW_APPROX
_CLOCK_UPTIME_RAW __CLOCK_AVAILABILITY = 8,
#define CLOCK_UPTIME_RAW _CLOCK_UPTIME_RAW
_CLOCK_UPTIME_RAW_APPROX __CLOCK_AVAILABILITY = 9,
#define CLOCK_UPTIME_RAW_APPROX _CLOCK_UPTIME_RAW_APPROX
#endif
_CLOCK_PROCESS_CPUTIME_ID __CLOCK_AVAILABILITY = 12,
#define CLOCK_PROCESS_CPUTIME_ID _CLOCK_PROCESS_CPUTIME_ID
_CLOCK_THREAD_CPUTIME_ID __CLOCK_AVAILABILITY = 16
#define CLOCK_THREAD_CPUTIME_ID _CLOCK_THREAD_CPUTIME_ID
} clockid_t;

In file /usr/local/include/lfp/time.h the definition of clockid_t is:

#if ! 0
typedef int clockid_t;
#endif // HAVE_CLOCKID_T

Temporary solution here:

comment these lines in file /usr/local/include/lfp/time.h:

#if ! 0
typedef int clockid_t;
#endif // HAVE_CLOCKID_T

and load iolib.

sionescu commented 6 years ago

Hello Yinliu, how have you installed libfixposix ? Did you compile it yourself ?

muyinliu commented 6 years ago

I installed libfixposix with follow commands:

curl -L https://github.com/sionescu/libfixposix/archive/v0.4.3.tar.gz | tar xzf -

cd libfixposix-0.4.3
autoreconf -i -f

mkdir build/
cd build/
../configure --prefix=$HOME/libfixposix
make
make install
muyinliu commented 6 years ago

Definitions of clockid_t are conflict between /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk/usr/include/time.h and /usr/local/include/lfp/time.h.

sionescu commented 6 years ago

I got access to an OSX server so I'll look into it as soon as I can.