#20 open
Calum Moore

Install and Build Problem on Mac OS X 10.5 and Python 2..6

Reported by Calum Moore | June 24th, 2009 @ 10:16 PM

Hi

I have used macport to install spidermonkey. It says this is installed.

When i attempt to build spidermonkey it fails with the error message below.

Macintosh-9:python-spidermonkey-0.0.7 calum$ python setup.py build
Traceback (most recent call last):
File "setup.py", line 186, in

**platform_config()

File "setup.py", line 143, in platform_config

return nspr_config(config=config)

File "setup.py", line 87, in nspr_config

return pkg_config("nspr", config)

File "setup.py", line 59, in pkg_config

raise RuntimeError("No package configuration found for: %s" % pkg_name)

RuntimeError: No package configuration found for: nspr

Same message appears when i attempt install.

Macintosh-9:python-spidermonkey-0.0.7 calum$ python setup.py install
Traceback (most recent call last):
File "setup.py", line 186, in

**platform_config()

File "setup.py", line 143, in platform_config

return nspr_config(config=config)

File "setup.py", line 87, in nspr_config

return pkg_config("nspr", config)

File "setup.py", line 59, in pkg_config

raise RuntimeError("No package configuration found for: %s" % pkg_name)

RuntimeError: No package configuration found for: nspr

Really have no idea what is wrong.

Calum

Comments and changes to this ticket

  • Paul J. Davis

    Paul J. Davis June 24th, 2009 @ 10:29 PM

    • State changed from “new” to “open”

    Calum,

    You need to make sure that libnspr is installed from ports. You can install it like:

    $ sudo port install nspr
    

    Though it should've been installed for spidermonkey I think. If that says nspr is already installed check and see if there's an nspr-config script in /opt/local/bin. If there is, then you just need to make sure /opt/local/bin is on your path. You can do that temporarily why running the setup.py script like such:

    $ PATH=$PATH:/opt/local/bin python setup.py build
    

    Let me know if that fixes things.

  • Paul J. Davis

    Paul J. Davis June 24th, 2009 @ 10:29 PM

    • Tag changed from 10.5, 2..6, build, install, mac, os, python, x to 10.5, 2.6, build, install, mac, os, python, x
  • Calum Moore

    Calum Moore June 25th, 2009 @ 06:07 AM

    Thanks for the quick reply!

    I seem to have nspr installed because when using:

    $ sudo port install nspr

    I get the following already installed message (well i think that's what it is)

    Macintosh-9:~ calum$ sudo port install nspr
    Password:
    Skipping org.macports.activate (nspr ) since this port is already active
    ---> Cleaning nspr

    I checked /opt/local/bin and there is a nspr-config file. I used

    $ PATH=$PATH:/opt/local/bin python setup.py build

    and again got the same error as always:

    Macintosh-9:python-spidermonkey-0.0.7 calum$ PATH=$PATH:/opt/local/bin python setup.py build
    Traceback (most recent call last):
    File "setup.py", line 186, in

    **platform_config()
    

    File "setup.py", line 143, in platform_config

    return nspr_config(config=config)
    

    File "setup.py", line 87, in nspr_config

    return pkg_config("nspr", config)
    

    File "setup.py", line 59, in pkg_config

    raise RuntimeError("No package configuration found for: %s" % pkg_name)
    

    RuntimeError: No package configuration found for: nspr

    Also to note, when I installed MacPorts for the first time it didn't work. So i added the following to /Users/Calum/.bash_profile

    export PATH=$PATH:/opt/local/bin
    export MANPATH=$MANPATH:/opt/local/share/man
    export INFOPATH=$INFOPATH:/opt/local/share/info
    test -r /sw/bin/init.sh && . /sw/bin/init.sh

    Now the complete file (/Users/Calum/.bash_profile) reads:

    Setting PATH for MacPython 2.6

    The orginal version is saved in .bash_profile.pysave

    PATH="/Library/Frameworks/Python.framework/Versions/2.6/bin:${PATH}"
    export PATH

    ##

    Your previous /Users/calum/.bash_profile file was backed up as /Users/calum/.bash_profile.macports-saved_2009-06-25_at_01:05:02

    ##

    MacPorts Installer addition on 2009-06-25_at_01:05:02: adding an appropriate MANPATH variable for use with MacPorts.

    export MANPATH=/opt/local/share/man:$MANPATH

    Finished adapting your MANPATH environment variable for use with MacPorts.

    export PATH=$PATH:/opt/local/bin
    export MANPATH=$MANPATH:/opt/local/share/man
    export INFOPATH=$INFOPATH:/opt/local/share/info
    test -r /sw/bin/init.sh && . /sw/bin/init.sh

    Not sure if this is having an effect.

    Calum

  • Calum Moore

    Calum Moore June 25th, 2009 @ 06:09 AM

    Just to clarify the parts in header format are commented out, but i'm guessing the hash is seen as formatting and therefore removed.

  • Paul J. Davis

    Paul J. Davis June 25th, 2009 @ 04:29 PM

    Calum,

    Oh, forgot one, you need pkgconfig installed too.

    $ sudo port install pkgconfig
    

    In the end, you need the following command to work:

    $ pkg-config --cflags nspr
    -I/opt/local/include/nspr
    

    If that fixes things I'll add a note to the README.

  • Paul J. Davis

    Paul J. Davis June 26th, 2009 @ 07:56 PM

    Calum,

    Did you manage to get this fixed?

    Paul

  • Calum Moore

    Calum Moore June 27th, 2009 @ 08:48 AM

    Paul

    Sorry for the delay in the response. My computer went in for repairs so I won't know till next week. I will let you know as soon as I get it from repairs.

    Calum

  • Bernardo Heynemann

    Bernardo Heynemann June 18th, 2010 @ 10:26 AM

    I can confirm that it does fix it.

    Cheers,
    Bernardo Heynemann

  • Bernardo Heynemann

    Bernardo Heynemann June 18th, 2010 @ 10:27 AM

    But then I get the following:
    sudo pip install python-spidermonkey
    Downloading/unpacking python-spidermonkey
    Running setup.py egg_info for package python-spidermonkey

    warning: no files found matching 'README'
    

    Installing collected packages: python-spidermonkey
    Running setup.py install for python-spidermonkey

    building 'spidermonkey' extension
    gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -Ispidermonkey/libjs -Ispidermonkey/Darwin-i386 -I/opt/local/include/nspr -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c ./spidermonkey/libjs/jsarena.c -o build/temp.macosx-10.6-universal-2.6/./spidermonkey/libjs/jsarena.o -DJS_THREADSAFE -DPOSIX_SOURCE -D_BSD_SOURCE -Wno-strict-prototypes -DXP_UNIX
    In file included from ./spidermonkey/libjs/jsarena.c:49:
    ./spidermonkey/libjs/jsbit.h:169: error: size of array ‘js_static_assert_line_169’ is negative
    lipo: can't open input file: /var/tmp//ccdi5TV7.out (No such file or directory)
    error: command 'gcc-4.2' failed with exit status 1
    Complete output from command /usr/local/virtual/bin/python -c "import setuptools; __file__='/usr/local/virtual/build/python-spidermonkey/setup.py'; execfile('/usr/local/virtual/build/python-spidermonkey/setup.py')" install --single-version-externally-managed --record /tmp/pip-snHrZX-record/install-record.txt --install-headers /usr/local/virtual/lib/include:
    running install
    

    running build

    running build_ext

    building 'spidermonkey' extension

    gcc-4.2 -fno-strict-aliasing -fno-common -dynamic -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch ppc -arch x86_64 -pipe -Ispidermonkey/libjs -Ispidermonkey/Darwin-i386 -I/opt/local/include/nspr -I/System/Library/Frameworks/Python.framework/Versions/2.6/include/python2.6 -c ./spidermonkey/libjs/jsarena.c -o build/temp.macosx-10.6-universal-2.6/./spidermonkey/libjs/jsarena.o -DJS_THREADSAFE -DPOSIX_SOURCE -D_BSD_SOURCE -Wno-strict-prototypes -DXP_UNIX

    In file included from ./spidermonkey/libjs/jsarena.c:49:

    ./spidermonkey/libjs/jsbit.h:169: error: size of array ‘js_static_assert_line_169’ is negative

    lipo: can't open input file: /var/tmp//ccdi5TV7.out (No such file or directory)

    error: command 'gcc-4.2' failed with exit status 1


    Command /usr/local/virtual/bin/python -c "import setuptools; file='/usr/local/virtual/build/python-spidermonkey/setup.py'; execfile('/usr/local/virtual/build/python-spidermonkey/setup.py')" install --single-version-externally-managed --record /tmp/pip-snHrZX-record/install-record.txt --install-headers /usr/local/virtual/lib/include failed with error code 1

  • j1m

    j1m January 10th, 2011 @ 09:51 AM

    • Milestone order changed from “0” to “0”

    I'm getting the same build failure on snow leopard.

    I installed pkgconfig and nspr with ports. I'm using a Python built
    from source.

    ./spidermonkey/libjs/jsapi.c: In function 'JS_ConvertArgumentsVA': ./spidermonkey/libjs/jsapi.c:267: warning: passing argument 5 of 'TryArgumentFormatter' from incompatible pointer type ./spidermonkey/libjs/jsapi.c: In function 'JS_PushArgumentsVA': ./spidermonkey/libjs/jsapi.c:370: warning: passing argument 5 of 'TryArgumentFormatter' from incompatible pointer type In file included from ./spidermonkey/libjs/jsarena.c:49:
    ./spidermonkey/libjs/jsbit.h:169: error: size of array 'js_static_assert_line_169' is negative error: command 'gcc' failed with exit status 1

  • j1m

    j1m January 17th, 2011 @ 11:25 AM

    I beat my head on this a bit more.

    The assertion errors results from sizeof(unsigned) (4) not being the
    same as sizeof(unsigned long) (8). I assume this was something that
    changed in Mac OS X Snow Leopard.

    Since python-spidermonkey includes a snapshot of spidermonkey, I
    thought I'd try to install later versions of spider monkley and
    install python-spidermonkey via system libraries. After much flailing,
    I managed to get a system build of spider monkey from the mercurial
    repo build with --enable-threadsafe and managed to get
    python-spidermonkey to use it by hand crafting a mozilla-ns.pc file.
    Unfortunately, python-spidermonkey fails to build with many errors
    suggesting the spidermonkey apis have changed too much for
    python-spidermonkey to keep up with.

  • Zvezdan Petkovic

    Zvezdan Petkovic January 23rd, 2011 @ 07:47 PM

    Building python-spidermonkey egg on Mac

    To build a python-spidermonkey egg on Mac OS X 10.6 (Snow Leopard):

    1. Install from MacPorts:

      • pkg-config

        sudo port -c install pkgconfig +universal
        
      • spidermonkey

        sudo port -c install spidermonkey +universal
        

      The spidermonkey port will install nspr as a dependency.

      (The +universal is optional. If you use a universal build of Python it's better to build universal libraries too.)

    2. Create a pkg-config metadata file for spidermonkey because it
      does not create one during install.

      The file needs to be named mozilla-js.pc because that's the name python-spidermonkey is looking for when it calls pkg-config.

      Open in your favorite editor /opt/local/lib/pkgconfig/mozilla-js.pc and put this content in

      prefix=/opt/local
      exec_prefix=${prefix}
      libdir=${exec_prefix}/lib
      includedir=${prefix}/include/js
      
      Name: SpiderMonkey
      Description: JavaScript-C Engine
      Version: 1.7.0
      
      Requires: nspr
      Libs: -L${libdir} -ljs
      Cflags: -I${includedir} -DJS_THREADSAFE -DJS_C_STRINGS_ARE_UTF8 -DXP_UNIX
      
    3. Download a source distribution of the python-spidermonkey egg from
      http://pypi.python.org/pypi/python-spidermonkey/0.0.9 or the latest snapshot from the python-spidermonkey home page listed at PyPI.

    4. Unpack the source distribution and build the egg using zc.buildout

      buildout setup . --system-library bdist_egg
      

      or Python

      python setup.py --system-library bdist_egg
      
      (Add the appropriate path to buildout or python above.)

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Python/JavaScript bridge module, making use of Mozilla's spidermonkey JavaScript implementation. Allows implementation of JavaScript classes, objects and functions in Python, and evaluation and calling of JavaScript scripts and functions respectively. Borrows heavily from Claes Jacobssen's Javascript Perl module, in turn based on Mozilla's 'PerlConnect' Perl binding.

People watching this ticket

Referenced by

Pages