xnd-project / libxnd

Subsumed into xnd
https://xnd.io/
BSD 3-Clause "New" or "Revised" License
80 stars 12 forks source link

Compilation error with clang/macOS #40

Closed hameerabbasi closed 5 years ago

hameerabbasi commented 5 years ago

When following the gumath minimal install instructions, I run into a compiler error:

$ python setup.py install --local=$PWD/../python
checking system as reported by uname -s... Darwin
checking build system type... x86_64-apple-darwin18.2.0
checking host system type... x86_64-apple-darwin18.2.0
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for ar... ar
checking for ranlib... ranlib
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for --with-includes... /Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes
checking for --with-libs... /Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes
checking for --with-docs... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libxnd/Makefile
config.status: creating libxnd/tests/Makefile
config.status: creating config.h
config.status: config.h is unchanged
cd libxnd && /Library/Developer/CommandLineTools/usr/bin/make
gcc -I/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes -Wall -Wextra -std=c11 -pedantic -O2 -c bitmaps.c
gcc -I/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes -Wall -Wextra -std=c11 -pedantic -O2 -c copy.c
gcc -I/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes -Wall -Wextra -std=c11 -pedantic -O2 -c equal.c
gcc -I/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes -Wall -Wextra -std=c11 -pedantic -O2 -c split.c
gcc -I/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes -Wall -Wextra -std=c11 -pedantic -O2 -c xnd.c
xnd.c:1104:33: error: too many arguments to function call, expected 7, have 8
                                ctx);
                                ^~~
/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes/ndtypes.h:754:13: note: 
      'ndt_var_dim' declared here
NDTYPES_API ndt_t *ndt_var_dim(ndt_t *type,
            ^
1 error generated.
make[1]: *** [xnd.o] Error 1
make: *** [default] Error 2
running install
running build
running build_py
running build_ext
building 'xnd._xnd' extension
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/hameerabbasi/anaconda/envs/plures/include -arch x86_64 -I/Users/hameerabbasi/anaconda/envs/plures/include -arch x86_64 -Ilibxnd -Indtypes/python/ndtypes -I/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes -I/Users/hameerabbasi/anaconda/envs/plures/include/python3.7m -c python/xnd/_xnd.c -o build/temp.macosx-10.7-x86_64-3.7/python/xnd/_xnd.o -Wextra -Wno-missing-field-initializers -std=c11
python/xnd/_xnd.c:2932:18: warning: implicit declaration of function 'ndt_unify'
      is invalid in C99 [-Wimplicit-function-declaration]
             u = ndt_unify(t, dtype, &ctx);
                 ^
python/xnd/_xnd.c:2932:18: warning: this function declaration is not a prototype
      [-Wstrict-prototypes]
python/xnd/_xnd.c:2932:16: warning: incompatible integer to pointer conversion
      assigning to 'ndt_t *' (aka 'struct _ndt *') from 'int' [-Wint-conversion]
             u = ndt_unify(t, dtype, &ctx);
               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
python/xnd/_xnd.c:2947:20: warning: implicit declaration of function
      'ndt_unify_replace_any' is invalid in C99
      [-Wimplicit-function-declaration]
        ndt_t *u = ndt_unify_replace_any(dtype, dtype, &ctx);
                   ^
python/xnd/_xnd.c:2947:20: warning: this function declaration is not a prototype
      [-Wstrict-prototypes]
python/xnd/_xnd.c:2947:16: warning: incompatible integer to pointer conversion
      initializing 'ndt_t *' (aka 'struct _ndt *') with an expression of type
      'int' [-Wint-conversion]
        ndt_t *u = ndt_unify_replace_any(dtype, dtype, &ctx);
               ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
python/xnd/_xnd.c:2983:33: error: too many arguments to function call, expected
      single argument 'ctx', have 2 arguments
        dtype = ndt_string(opt, &ctx);
                ~~~~~~~~~~      ^~~~
/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes/ndtypes.h:785:13: note: 
      'ndt_string' declared here
NDTYPES_API ndt_t *ndt_string(ndt_context_t *ctx);
            ^
python/xnd/_xnd.c:2986:39: error: too many arguments to function call, expected
      2, have 3
        dtype = ndt_bytes(align, opt, &ctx);
                ~~~~~~~~~             ^~~~
/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes/ndtypes.h:786:13: note: 
      'ndt_bytes' declared here
NDTYPES_API ndt_t *ndt_bytes(uint16_opt_t target_align, ndt_context_t *ctx);
            ^
python/xnd/_xnd.c:3109:64: error: too many arguments to function call, expected
      6, have 7
        t = ndt_tuple(Nonvariadic, NULL, 0, none, none, false, &ctx);
            ~~~~~~~~~                                          ^~~~
/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes/ndtypes.h:765:13: note: 
      'ndt_tuple' declared here
NDTYPES_API ndt_t *ndt_tuple(enum ndt_variadic flag, ndt_field_t *fields...
            ^
python/xnd/_xnd.c:3137:66: error: too many arguments to function call, expected
      6, have 7
    t = ndt_tuple(Nonvariadic, fields, shape, none, none, false, &ctx);
        ~~~~~~~~~                                                ^~~~
/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes/ndtypes.h:765:13: note: 
      'ndt_tuple' declared here
NDTYPES_API ndt_t *ndt_tuple(enum ndt_variadic flag, ndt_field_t *fields...
            ^
python/xnd/_xnd.c:3159:65: error: too many arguments to function call, expected
      6, have 7
        t = ndt_record(Nonvariadic, NULL, 0, none, none, false, &ctx);
            ~~~~~~~~~~                                          ^~~~
/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes/ndtypes.h:767:13: note: 
      'ndt_record' declared here
NDTYPES_API ndt_t *ndt_record(enum ndt_variadic flag, ndt_field_t *field...
            ^
python/xnd/_xnd.c:3223:67: error: too many arguments to function call, expected
      6, have 7
    t = ndt_record(Nonvariadic, fields, shape, none, none, false, &ctx);
        ~~~~~~~~~~                                                ^~~~
/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes/ndtypes.h:767:13: note: 
      'ndt_record' declared here
NDTYPES_API ndt_t *ndt_record(enum ndt_variadic flag, ndt_field_t *field...
            ^
python/xnd/_xnd.c:3256:31: error: too many arguments to function call, expected
      single argument 'ctx', have 2 arguments
        t = ndt_string(false, &ctx);
            ~~~~~~~~~~        ^~~~
/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes/ndtypes.h:785:13: note: 
      'ndt_string' declared here
NDTYPES_API ndt_t *ndt_string(ndt_context_t *ctx);
            ^
python/xnd/_xnd.c:3260:37: error: too many arguments to function call, expected
      2, have 3
        t = ndt_bytes(align, false, &ctx);
            ~~~~~~~~~               ^~~~
/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes/ndtypes.h:786:13: note: 
      'ndt_bytes' declared here
NDTYPES_API ndt_t *ndt_bytes(uint16_opt_t target_align, ndt_context_t *ctx);
            ^
python/xnd/_xnd.c:3267:36: error: too many arguments to function call, expected
      single argument 'ctx', have 2 arguments
            t = ndt_any_kind(true, &ctx);
                ~~~~~~~~~~~~       ^~~~
/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes/ndtypes.h:741:13: note: 
      'ndt_any_kind' declared here
NDTYPES_API ndt_t *ndt_any_kind(ndt_context_t *ctx);
            ^
python/xnd/_xnd.c:3309:20: warning: implicit declaration of function
      'Ndt_FromOffsetsAndDtype' is invalid in C99
      [-Wimplicit-function-declaration]
            return Ndt_FromOffsetsAndDtype(t.offsets, t.opt, t.type);
                   ^
python/xnd/_xnd.c:3309:20: warning: this function declaration is not a prototype
      [-Wstrict-prototypes]
python/xnd/_xnd.c:3309:20: warning: incompatible integer to pointer conversion
      returning 'int' from a function with result type 'PyObject *'
      (aka 'struct _object *') [-Wint-conversion]
            return Ndt_FromOffsetsAndDtype(t.offsets, t.opt, t.type);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9 warnings and 9 errors generated.
error: command 'gcc' failed with exit status 1

Last compiling version is 5799cf227488629a333f400b64482bf98285b0ee, but it still has the warnings:

$ python setup.py install --local=$PWD/../python
checking system as reported by uname -s... Darwin
checking build system type... x86_64-apple-darwin18.2.0
checking host system type... x86_64-apple-darwin18.2.0
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for ar... ar
checking for ranlib... ranlib
checking how to run the C preprocessor... gcc -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for a BSD-compatible install... /usr/bin/install -c
checking for --with-includes... /Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes
checking for --with-libs... /Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes
checking for --with-docs... yes
configure: creating ./config.status
config.status: creating Makefile
config.status: creating libxnd/Makefile
config.status: creating libxnd/tests/Makefile
config.status: creating config.h
config.status: config.h is unchanged
cd libxnd && /Library/Developer/CommandLineTools/usr/bin/make
gcc -I/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes -Wall -Wextra -std=c11 -pedantic -O2 -c bitmaps.c
gcc -I/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes -Wall -Wextra -std=c11 -pedantic -O2 -c copy.c
gcc -I/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes -Wall -Wextra -std=c11 -pedantic -O2 -c equal.c
gcc -I/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes -Wall -Wextra -std=c11 -pedantic -O2 -c split.c
gcc -I/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes -Wall -Wextra -std=c11 -pedantic -O2 -c xnd.c
ar rc libxnd.a bitmaps.o copy.o equal.o split.o xnd.o
ranlib libxnd.a
gcc -I/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes -Wall -Wextra -std=c11 -pedantic -O2 -fPIC -c bitmaps.c -o .objs/bitmaps.o
gcc -I/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes -Wall -Wextra -std=c11 -pedantic -O2 -fPIC -c copy.c -o .objs/copy.o
gcc -I/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes -Wall -Wextra -std=c11 -pedantic -O2 -fPIC -c equal.c -o .objs/equal.o
gcc -I/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes -Wall -Wextra -std=c11 -pedantic -O2 -fPIC -c split.c -o .objs/split.o
gcc -I/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes -Wall -Wextra -std=c11 -pedantic -O2 -fPIC -c xnd.c -o .objs/xnd.o
gcc -dynamiclib -install_name @rpath/libxnd.0.dylib -undefined dynamic_lookup -compatibility_version 0.2 -current_version 0.2.0 -o libxnd.0.2.0dev3.dylib .objs/bitmaps.o .objs/copy.o .objs/equal.o .objs/split.o .objs/xnd.o
ln -sf libxnd.0.2.0dev3.dylib libxnd.dylib
ln -sf libxnd.0.2.0dev3.dylib libxnd.0.dylib
/usr/bin/install -c -m 644 libxnd/xnd.h python/xnd
/usr/bin/install -c -m 644 libxnd/libxnd.a python/xnd
/usr/bin/install -c -m 755 libxnd/libxnd.0.2.0dev3.dylib python/xnd
cd python/xnd && ln -sf libxnd.0.2.0dev3.dylib libxnd.0.dylib && ln -sf libxnd.0.2.0dev3.dylib libxnd.dylib
running install
running build
running build_py
creating build
creating build/lib.macosx-10.7-x86_64-3.7
creating build/lib.macosx-10.7-x86_64-3.7/xnd
copying python/xnd/__init__.py -> build/lib.macosx-10.7-x86_64-3.7/xnd
copying python/xnd/libxnd.dylib -> build/lib.macosx-10.7-x86_64-3.7/xnd
copying python/xnd/libxnd.0.dylib -> build/lib.macosx-10.7-x86_64-3.7/xnd
copying python/xnd/libxnd.0.2.0dev3.dylib -> build/lib.macosx-10.7-x86_64-3.7/xnd
copying python/xnd/libxnd.a -> build/lib.macosx-10.7-x86_64-3.7/xnd
copying python/xnd/xnd.h -> build/lib.macosx-10.7-x86_64-3.7/xnd
copying python/xnd/pyxnd.h -> build/lib.macosx-10.7-x86_64-3.7/xnd
creating build/lib.macosx-10.7-x86_64-3.7/xnd/contrib
copying python/xnd/contrib/pretty.py -> build/lib.macosx-10.7-x86_64-3.7/xnd/contrib
running build_ext
building 'xnd._xnd' extension
creating build/temp.macosx-10.7-x86_64-3.7
creating build/temp.macosx-10.7-x86_64-3.7/python
creating build/temp.macosx-10.7-x86_64-3.7/python/xnd
gcc -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/Users/hameerabbasi/anaconda/envs/plures/include -arch x86_64 -I/Users/hameerabbasi/anaconda/envs/plures/include -arch x86_64 -Ilibxnd -Indtypes/python/ndtypes -I/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes -I/Users/hameerabbasi/anaconda/envs/plures/include/python3.7m -c python/xnd/_xnd.c -o build/temp.macosx-10.7-x86_64-3.7/python/xnd/_xnd.o -Wextra -Wno-missing-field-initializers -std=c11
python/xnd/_xnd.c:2928:18: warning: implicit declaration of function 'ndt_unify'
      is invalid in C99 [-Wimplicit-function-declaration]
             u = ndt_unify(t, dtype, &ctx);
                 ^
python/xnd/_xnd.c:2928:18: warning: this function declaration is not a prototype
      [-Wstrict-prototypes]
python/xnd/_xnd.c:2928:16: warning: incompatible integer to pointer conversion
      assigning to 'ndt_t *' (aka 'struct _ndt *') from 'int' [-Wint-conversion]
             u = ndt_unify(t, dtype, &ctx);
               ^ ~~~~~~~~~~~~~~~~~~~~~~~~~
python/xnd/_xnd.c:2943:20: warning: implicit declaration of function
      'ndt_unify_replace_any' is invalid in C99
      [-Wimplicit-function-declaration]
        ndt_t *u = ndt_unify_replace_any(dtype, dtype, &ctx);
                   ^
python/xnd/_xnd.c:2943:20: warning: this function declaration is not a prototype
      [-Wstrict-prototypes]
python/xnd/_xnd.c:2943:16: warning: incompatible integer to pointer conversion
      initializing 'ndt_t *' (aka 'struct _ndt *') with an expression of type
      'int' [-Wint-conversion]
        ndt_t *u = ndt_unify_replace_any(dtype, dtype, &ctx);
               ^   ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
python/xnd/_xnd.c:3303:20: warning: implicit declaration of function
      'Ndt_FromOffsetsAndDtype' is invalid in C99
      [-Wimplicit-function-declaration]
            return Ndt_FromOffsetsAndDtype(t.offsets, t.opt, t.type);
                   ^
python/xnd/_xnd.c:3303:20: warning: this function declaration is not a prototype
      [-Wstrict-prototypes]
python/xnd/_xnd.c:3303:20: warning: incompatible integer to pointer conversion
      returning 'int' from a function with result type 'PyObject *'
      (aka 'struct _object *') [-Wint-conversion]
            return Ndt_FromOffsetsAndDtype(t.offsets, t.opt, t.type);
                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
9 warnings generated.
gcc -bundle -undefined dynamic_lookup -L/Users/hameerabbasi/anaconda/envs/plures/lib -arch x86_64 -L/Users/hameerabbasi/anaconda/envs/plures/lib -arch x86_64 -arch x86_64 build/temp.macosx-10.7-x86_64-3.7/python/xnd/_xnd.o -Llibxnd -Lndtypes/libndtypes -L/Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/ndtypes -lndtypes -lxnd -o build/lib.macosx-10.7-x86_64-3.7/xnd/_xnd.cpython-37m-darwin.so -Wl,-rpath,@loader_path
ld: warning: directory not found for option '-Lndtypes/libndtypes'
running install_lib
copying build/lib.macosx-10.7-x86_64-3.7/xnd/libxnd.dylib -> /Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/xnd
copying build/lib.macosx-10.7-x86_64-3.7/xnd/libxnd.0.dylib -> /Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/xnd
copying build/lib.macosx-10.7-x86_64-3.7/xnd/_xnd.cpython-37m-darwin.so -> /Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/xnd
copying build/lib.macosx-10.7-x86_64-3.7/xnd/libxnd.0.2.0dev3.dylib -> /Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/xnd
copying build/lib.macosx-10.7-x86_64-3.7/xnd/libxnd.a -> /Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/xnd
copying build/lib.macosx-10.7-x86_64-3.7/xnd/xnd.h -> /Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/xnd
running install_egg_info
Removing /Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/xnd-0.2.0dev3-py3.7.egg-info
Writing /Users/hameerabbasi/Quansight/plures/gumath/xnd/../python/xnd-0.2.0dev3-py3.7.egg-info
skrah commented 5 years ago

Are you building in a conda environment with a stale libndtypes in miniconda/lib?

Once you have done a conda install, the setup.py instructions won't work unless you uninstall everything.

Latest version builds in the CI on OSX:

https://travis-ci.org/plures/xnd/jobs/451885003

hameerabbasi commented 5 years ago

Ah, yes. I re-built everything and now all's good.