简体   繁体   中英

Error when building pypoker-eval on OS X

I want to install pypoker-eval on my Mac. At first I was getting this error:

Hector:pypoker-eval root# python setup.py install
running install
running build
running build_ext
building '_pokereval_2_7' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DPYTHON_VERSION="2_7" -DVERSION_NAME(w)=w ## 2_7 -Iinclude -I/usr/include/poker-eval -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pypokereval.c -o build/temp.macosx-10.10-intel-2.7/pypokereval.o
pypokereval.c:51:10: fatal error: 'poker_defs.h' file not found
#include "poker_defs.h"
         ^
1 error generated.
error: command 'cc' failed with exit status 1

So I installed poker-eval and set C_INCLUDE_PATH to /usr/local/include/poker-eval which now contains the poker-eval code I installed.

Now the install gives me this error:

Hector:pypoker-eval root# python setup.py install
running install
running build
running build_ext
building '_pokereval_2_7' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DPYTHON_VERSION="2_7" -DVERSION_NAME(w)=w ## 2_7 -Iinclude -I/usr/include/poker-eval -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pypokereval.c -o build/temp.macosx-10.10-intel-2.7/pypokereval.o
pypokereval.c:462:35: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int'
      [-Wshorten-64-to-32]
  valid_cards_size = cards_size = PyList_Size(object);
                                ~ ^~~~~~~~~~~~~~~~~~~
pypokereval.c:484:14: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
      card = PyInt_AsLong(pycard);
           ~ ^~~~~~~~~~~~~~~~~~~~
pypokereval.c:996:18: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int'
      [-Wshorten-64-to-32]
  pockets_size = PyList_Size(pypockets);
               ~ ^~~~~~~~~~~~~~~~~~~~~~
pypokereval.c:1010:43: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        numToDeal[i + 1] = PyList_Size(pypocket) - count;
                         ~ ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
pypokereval.c:1022:43: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
      numToDeal[0] = PyList_Size(pyboard) - count;
                   ~ ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
5 warnings generated.
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.10-intel-2.7/pypokereval.o -lpoker-eval -o build/lib.macosx-10.10-intel-2.7/_pokereval_2_7.so
ld: library not found for -lpoker-eval
clang: error: linker command failed with exit code 1 (use -v to see invocation)
error: command 'cc' failed with exit status 1

Out of ideas for what to do next. Any suggestions?

Ok, I've answered my own question: LIBRARY_PATH needed to be set to /usr/local/lib.

Once done, I got the output below for python setup.py install . The warnings seem to be ok as python test.py produced no errors.

Hector:pypoker-eval root# python setup.py install
running install
running build
running build_ext
building '_pokereval_2_7' extension
cc -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch x86_64 -arch i386 -pipe -DPYTHON_VERSION="2_7" -DVERSION_NAME(w)=w ## 2_7 -Iinclude -I/usr/include/poker-eval -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c pypokereval.c -o build/temp.macosx-10.10-intel-2.7/pypokereval.o
pypokereval.c:462:35: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int'
      [-Wshorten-64-to-32]
  valid_cards_size = cards_size = PyList_Size(object);
                                ~ ^~~~~~~~~~~~~~~~~~~
pypokereval.c:484:14: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
      card = PyInt_AsLong(pycard);
           ~ ^~~~~~~~~~~~~~~~~~~~
pypokereval.c:996:18: warning: implicit conversion loses integer precision: 'Py_ssize_t' (aka 'long') to 'int'
      [-Wshorten-64-to-32]
  pockets_size = PyList_Size(pypockets);
               ~ ^~~~~~~~~~~~~~~~~~~~~~
pypokereval.c:1010:43: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
        numToDeal[i + 1] = PyList_Size(pypocket) - count;
                         ~ ~~~~~~~~~~~~~~~~~~~~~~^~~~~~~
pypokereval.c:1022:43: warning: implicit conversion loses integer precision: 'long' to 'int' [-Wshorten-64-to-32]
      numToDeal[0] = PyList_Size(pyboard) - count;
                   ~ ~~~~~~~~~~~~~~~~~~~~~^~~~~~~
5 warnings generated.
cc -bundle -undefined dynamic_lookup -arch x86_64 -arch i386 -Wl,-F. build/temp.macosx-10.10-intel-2.7/pypokereval.o -lpoker-eval -o build/lib.macosx-10.10-intel-2.7/_pokereval_2_7.so
ld: warning: ignoring file /usr/local/lib/libpoker-eval.dylib, file was built for x86_64 which is not the architecture being linked (i386): /usr/local/lib/libpoker-eval.dylib
running install_lib
copying build/lib.macosx-10.10-intel-2.7/_pokereval_2_7.so -> /Library/Python/2.7/site-packages
running install_egg_info
Writing /Library/Python/2.7/site-packages/pokereval-1.38-py2.7.egg-info

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM