11

I am having some trouble with compiling mapscript (is a package from pypi containing C code) with the default clang compiler using pip.

Here's my attempt:-

$ sudo pip install mapscript
Password:
Downloading/unpacking mapscript
  Running setup.py egg_info for package mapscript

Requirement already satisfied (use --upgrade to upgrade): distribute in /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages (from mapscript)
Installing collected packages: mapscript
  Running setup.py install for mapscript

    building '_mapscript' extension
    /opt/local/bin/gcc-apple-4.2 -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes -I/opt/local/include -I/opt/local/include -I/opt/local/include -pipe -O2 -arch x86_64 -fPIC -Wall -DNEED_NONBLOCKING_STDERR -DHAVE_VSNPRINTF -DNEED_STRRSTR -DNEED_NONBLOCKING_STDERR -DUSE_WMS_SVR -DUSE_GDAL -DUSE_OGR -DUSE_PROJ -DUSE_EPPL -DUSE_GD_GIF -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_WBMP -DUSE_GD_FT -DGD_HAS_FTEX_XSHOW -DGD_HAS_GDIMAGEGIFPTR -DGD_HAS_GETBITMAPFONTS -DUSE_ICONV -DUSE_ZLIB -I/opt/local/include -I/opt/local/include -I/opt/local/include -DHAVE_VSNPRINTF -DNEED_STRRSTR -DNEED_NONBLOCKING_STDERR -DUSE_WMS_SVR -DUSE_GDAL -DUSE_OGR -DUSE_PROJ -DUSE_EPPL -DUSE_GD_GIF -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_WBMP -DUSE_GD_FT -DGD_HAS_FTEX_XSHOW -DGD_HAS_GDIMAGEGIFPTR -DGD_HAS_GETBITMAPFONTS -DUSE_ICONV -DUSE_ZLIB -DHAVE_VSNPRINTF -DNEED_STRRSTR -DNEED_NONBLOCKING_STDERR -DUSE_WMS_SVR -DUSE_GDAL -DUSE_OGR -DUSE_PROJ -DUSE_EPPL -DUSE_GD_GIF -DUSE_GD_PNG -DUSE_GD_JPEG -DUSE_GD_WBMP -DUSE_GD_FT -DGD_HAS_FTEX_XSHOW -DGD_HAS_GDIMAGEGIFPTR -DGD_HAS_GETBITMAPFONTS -DUSE_ICONV -DUSE_ZLIB -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c mapscript_wrap.c -o build/temp.macosx-10.7-x86_64-2.7/mapscript_wrap.o
    mapscript_wrap.c:2564:23: error: mapserver.h: No such file or directory
    mapscript_wrap.c:2565:25: error: maptemplate.h: No such file or directory
    mapscript_wrap.c:2566:23: error: mapogcsld.h: No such file or directory
...
mapscript_wrap.c:45472: error: 'MS_DEBUGLEVEL_VV' undeclared (first use in this function)

mapscript_wrap.c:45473: error: 'MS_DEBUGLEVEL_VVV' undeclared (first use in this function)

mapscript_wrap.c:45476: error: 'MS_GET_REQUEST' undeclared (first use in this function)

mapscript_wrap.c:45477: error: 'MS_POST_REQUEST' undeclared (first use in this function)

error: command '/opt/local/bin/gcc-apple-4.2' failed with exit status 1

----------------------------------------
Command /opt/local/Library/Frameworks/Python.framework/Versions/2.7/Resources/Python.app/Contents/MacOS/Python -c "import setuptools;__file__='/Users/calvin/build/mapscript/setup.py';exec(compile(open(__file__).read().replace('\r\n', '\n'), __file__, 'exec'))" install --single-version-externally-managed --record /tmp/pip-GYwtAz-record/install-record.txt failed with error code 1
Storing complete log in /Users/calvin/.pip/pip.log

The gcc-apple-4.2 version is

$ gcc-apple-4.2 --version
i686-apple-darwin11-gcc-apple-4.2.1 (GCC) 4.2.1 (Apple Inc. build 5666) (dot 3)
Copyright (C) 2007 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

How do I try installing mapscript with another compiler? Is there a way to explicitly specify a specific compiler that pip will call upon when compiling the C code in a pypi package?

3
  • I'm having this exact same problem. Is Python on Lion broken?
    – KyleWpppd
    Commented Dec 14, 2011 at 16:50
  • Hi @KyleWpppd, after some digging around, I learnt that mapscript's C-extension by default compiles using the same compiler which I compiled Python 2.7 (via Macports) with. Since I used gcc-apple-4.2 for compiling my Python 2.7 via MacPorts, the same compiler will be used when compiling mapscript. In order to solve this problem, I had to make sure that I compile MapServer 6.0.1 correctly first (and MapServer 6.0.1 is not available on MacPorts - the copy on MacPorts is severely outdated). Thereafter, I did "sudo python setup.py build" to install mapscript system-wide. Commented Dec 15, 2011 at 3:16
  • I'm also having the same trouble on OS X 10.8.2 -- I've installed mapserver with --devel via Mac HomeBrew, but pip install mapscript fails for a very similar reason. It can't find mapserver.h anywhere. Commented Feb 18, 2013 at 5:26

1 Answer 1

25

Setting the CC environment variable seems to work, e.g.:

env CC=/usr/bin/gcc-4.0 pip install pyOpenSSL

2
  • 1
    This does not address the question nor the problem. The problem clearly shows that the build process uns able to find required header files. mapserver.h is the first. --JamesMills Commented Feb 18, 2013 at 5:28
  • 13
    The question was "How do I try installing mapscript with another compiler?" I believe this answer very specifically addresses that.
    – Von
    Commented Feb 23, 2013 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.