Reputation: 381
I'm trying to install p4python
, a Python extension for the Perforce revision control system. I'm using cygwin to accomplish this as p4python
requires the P4 C++ API (it's really just a wrapper), which in turn requires g++ (not to mention, Python extensions require a C compiler, hence, gcc). I'm on Windows 7 64-bit (not by choice) and Microsoft VS 2008 gave me some pretty stubborn problems; I had heard that using Cygwin/MinGW might be a better route. I also looked for related questions and none of them seemed to have a particularly relevant answer.
The best I can think of is that ld is looking in the wrong place for these libs and I'm told that Cygwin doesn't handle symbolic links very well, but I'm not sure where to go from here. See terminal output below:
API Release 2010.2 running install running build running build_py running build_ext building 'P4API' extension gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DID_OS="CYGWINX86" -DID_REL="2009.2" -DID_PATCH="240822" -DID_API="2010.2" -DID_Y="2010" -DID_M="04" -DID_D="02" -IC:\Python\p4api\p4api-2010.2.295040-vs2010_static\ -IC:\Pyt hon\p4api\p4api-2010.2.295040-vs2010_static\/include/p4 -I/usr/include/python2.6 -c P4API.cpp -o build/temp.cygwin-1.7.9-i686-2.6/P4API.o -DOS_CYGWIN -DOS_CYGWIN -DOS_CYGWINX86 -DOS_CYGWINX86 cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++ gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DID_OS="CYGWINX86" -DID_REL="2009.2" -DID_PATCH="240822" -DID_API="2010.2" -DID_Y="2010" -DID_M="04" -DID_D="02" -IC:\Python\p4api\p4api-2010.2.295040-vs2010_static\ -IC:\Pyt hon\p4api\p4api-2010.2.295040-vs2010_static\/include/p4 -I/usr/include/python2.6 -c PythonClientAPI.cpp -o build/temp.cygwin-1.7.9-i686-2.6/PythonClientAPI.o -DOS_CYGWIN -DOS_CYGWIN -DOS_CYGWINX86 -DOS_CYGWINX86 cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++ gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DID_OS="CYGWINX86" -DID_REL="2009.2" -DID_PATCH="240822" -DID_API="2010.2" -DID_Y="2010" -DID_M="04" -DID_D="02" -IC:\Python\p4api\p4api-2010.2.295040-vs2010_static\ -IC:\Pyt hon\p4api\p4api-2010.2.295040-vs2010_static\/include/p4 -I/usr/include/python2.6 -c PythonClientUser.cpp -o build/temp.cygwin-1.7.9-i686-2.6/PythonClientUser.o -DOS_CYGWIN -DOS_CYGWIN -DOS_CYGWINX86 -DOS_CYGWINX86 cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++ PythonClientUser.cpp: In member function ‘virtual int PythonClientUser::Resolve(ClientMerge*, Error*)’: PythonClientUser.cpp:423: warning: deprecated conversion from string constant to ‘char*’ PythonClientUser.cpp:423: warning: deprecated conversion from string constant to ‘char*’ gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DID_OS="CYGWINX86" -DID_REL="2009.2" -DID_PATCH="240822" -DID_API="2010.2" -DID_Y="2010" -DID_M="04" -DID_D="02" -IC:\Python\p4api\p4api-2010.2.295040-vs2010_static\ -IC:\Pyt hon\p4api\p4api-2010.2.295040-vs2010_static\/include/p4 -I/usr/include/python2.6 -c SpecMgr.cpp -o build/temp.cygwin-1.7.9-i686-2.6/SpecMgr.o -DOS_CYGWIN -DOS_CYGWIN -DOS_CYGWINX86 -DOS_CYGWINX86 cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++ SpecMgr.cpp: In member function ‘PyObject* SpecMgr::NewSpec(StrPtr*)’: SpecMgr.cpp:550: warning: deprecated conversion from string constant to ‘char*’ SpecMgr.cpp:550: warning: deprecated conversion from string constant to ‘char*’ gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DID_OS="CYGWINX86" -DID_REL="2009.2" -DID_PATCH="240822" -DID_API="2010.2" -DID_Y="2010" -DID_M="04" -DID_D="02" -IC:\Python\p4api\p4api-2010.2.295040-vs2010_static\ -IC:\Pyt hon\p4api\p4api-2010.2.295040-vs2010_static\/include/p4 -I/usr/include/python2.6 -c P4Result.cpp -o build/temp.cygwin-1.7.9-i686-2.6/P4Result.o -DOS_CYGWIN -DOS_CYGWIN -DOS_CYGWINX86 -DOS_CYGWINX86 cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++ P4Result.cpp: In destructor ‘P4Result::~P4Result()’: P4Result.cpp:49: warning: suggest explicit braces to avoid ambiguous ‘else’ P4Result.cpp:52: warning: suggest explicit braces to avoid ambiguous ‘else’ P4Result.cpp:55: warning: suggest explicit braces to avoid ambiguous ‘else’ P4Result.cpp: In member function ‘void P4Result::Reset()’: P4Result.cpp:71: warning: suggest explicit braces to avoid ambiguous ‘else’ P4Result.cpp:75: warning: suggest explicit braces to avoid ambiguous ‘else’ P4Result.cpp: In member function ‘void P4Result::Fmt(const char*, PyObject*, StrBuf&)’: P4Result.cpp:189: warning: deprecated conversion from string constant to ‘char*’ P4Result.cpp:189: warning: deprecated conversion from string constant to ‘char*’ gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DID_OS="CYGWINX86" -DID_REL="2009.2" -DID_PATCH="240822" -DID_API="2010.2" -DID_Y="2010" -DID_M="04" -DID_D="02" -IC:\Python\p4api\p4api-2010.2.295040-vs2010_static\ -IC:\Pyt hon\p4api\p4api-2010.2.295040-vs2010_static\/include/p4 -I/usr/include/python2.6 -c PythonMergeData.cpp -o build/temp.cygwin-1.7.9-i686-2.6/PythonMergeData.o -DOS_CYGWIN -DOS_CYGWIN -DOS_CYGWINX86 -DOS_CYGWINX86 cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++ gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DID_OS="CYGWINX86" -DID_REL="2009.2" -DID_PATCH="240822" -DID_API="2010.2" -DID_Y="2010" -DID_M="04" -DID_D="02" -IC:\Python\p4api\p4api-2010.2.295040-vs2010_static\ -IC:\Pyt hon\p4api\p4api-2010.2.295040-vs2010_static\/include/p4 -I/usr/include/python2.6 -c P4MapMaker.cpp -o build/temp.cygwin-1.7.9-i686-2.6/P4MapMaker.o -DOS_CYGWIN -DOS_CYGWIN -DOS_CYGWINX86 -DOS_CYGWINX86 cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++ gcc -fno-strict-aliasing -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -DID_OS="CYGWINX86" -DID_REL="2009.2" -DID_PATCH="240822" -DID_API="2010.2" -DID_Y="2010" -DID_M="04" -DID_D="02" -IC:\Python\p4api\p4api-2010.2.295040-vs2010_static\ -IC:\Pyt hon\p4api\p4api-2010.2.295040-vs2010_static\/include/p4 -I/usr/include/python2.6 -c PythonSpecData.cpp -o build/temp.cygwin-1.7.9-i686-2.6/PythonSpecData.o -DOS_CYGWIN -DOS_CYGWIN -DOS_CYGWINX86 -DOS_CYGWINX86 cc1plus: warning: command line option "-Wstrict-prototypes" is valid for Ada/C/ObjC but not for C++ g++ -shared -Wl,--enable-auto-image-base build/temp.cygwin-1.7.9-i686-2.6/P4API.o build/temp.cygwin-1.7.9-i686-2.6/PythonClientAPI.o build/temp.cygwin-1.7.9-i686-2.6/PythonClientUser.o build/temp.cygwin-1.7.9-i686-2.6/SpecMgr.o build/temp.cygwin-1.7. 9-i686-2.6/P4Result.o build/temp.cygwin-1.7.9-i686-2.6/PythonMergeData.o build/temp.cygwin-1.7.9-i686-2.6/P4MapMaker.o build/temp.cygwin-1.7.9-i686-2.6/PythonSpecData.o -LC:\Python\p4api\p4api-2010.2.295040-vs2010_static\ -LC:\Python\p4api\p4api-2010 .2.295040-vs2010_static\/lib -L/usr/lib/python2.6/config -lclient -lrpc -lsupp -lpython2.6 -o build/lib.cygwin-1.7.9-i686-2.6/P4API.dll /usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../i686-pc-cygwin/bin/ld: cannot find -lclient /usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../i686-pc-cygwin/bin/ld: cannot find -lrpc /usr/lib/gcc/i686-pc-cygwin/4.3.4/../../../../i686-pc-cygwin/bin/ld: cannot find -lsupp collect2: ld returned 1 exit status error: command 'g++' failed with exit status 1
To give a more concrete question, is ld looking in the wrong place or is something else going wrong that I'm not seeing? I'm out of ideas. Any help or guidance would be very much appreciated.
Upvotes: 1
Views: 1705
Reputation: 34260
Here's a way I've used to turn lib files into shared libraies for use with gcc:
echo EXPORTS > NAME.def
nm NAME.lib | grep ' T _' | sed 's/.* T _//' >> NAME.def
dlltool --input-def NAME.def --dllname NAME --output-lib libNAME.a
Further notes on using Cygwin (but I use gcc 3 on an older 32-bit system, so YMMV) :
Install the gcc-mingw package (headers and libs for mingw for gcc and g++ 3) or one of the newer packages that use mingw-w64 for gcc 4.5. Also, compile with the option -mno-cygwin
to keep from linking Cygwin into the executable/library. For Python extensions you can permanently configure distutils to use mingw by adding a distutils.cfg file to the Lib\distutils folder:
[build]
compiler = mingw32 #or mingw64
[build_ext]
compiler = mingw32 #or mingw64
I add C:\cygwin\bin
to the Windows path (at the end to minimize interference) and compile from within Windows cmd. However, I have to replace the Cygwin symlinks with the actual executables (i.e., gcc3.exe -> gcc.exe, g++3.exe -> g++.exe) since Windows cmd doesn't understand the symlinks. It hasn't given me a problem yet compiling Python 3 extensions, Cython (even on-demand compiling with pyximport), swig, and embedding Python.
Upvotes: 3