From charlesreid1

 
No edit summary
Line 1: Line 1:
#REDIRECT [[PySundials]]
 
 
<pre>
sudo CC='clang -lsundials -I/Users/charlesreid/pkg/sundials/std/include -L/Users/charlesreid/pkg/sundials/std/lib' LDFLAGS="-L/Users/charlesreid/pkg/sundials/std/lib" python setup.py build
</pre>
 
 
==Errors==
 
===NVECTOR.pxi: Taking Address of Non-Lvalue===
 
On my first attempt to install python-sundials, I got this error:
 
<pre>
sundials/NVECTOR.pxi:41:37: Taking address of non-lvalue
</pre>
 
Here is the full error context:
 
<pre>
$ python setup.py build
running build
running build_ext
cythoning sundials/sundials.pyx to sundials/sundials.c
 
Error compiling Cython file:
------------------------------------------------------------
...
        buffer.obj = self
        buffer.len = self.getsize() * sizeof(double)
        buffer.readonly = 0
        buffer.format = <char*>"d"
        buffer.ndim = 1
        buffer.shape = <Py_ssize_t *>&self.__shape
                                    ^
------------------------------------------------------------
 
sundials/NVECTOR.pxi:41:37: Taking address of non-lvalue
warning: sundials/KINSOL.pxi:183:39: Not all members given for struct 'kinsol_userdata'
warning: sundials/KINSOL.pxi:183:39: Not all members given for struct 'kinsol_userdata'
building 'sundials' extension
creating build
creating build/temp.macosx-10.8-intel-2.7
creating build/temp.macosx-10.8-intel-2.7/sundials
clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -Isundials -Isundials/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c sundials/sundials.c -o build/temp.macosx-10.8-intel-2.7/sundials/sundials.o
clang: warning: argument unused during compilation: '-mno-fused-madd'
sundials/sundials.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
#error Do not use this file, it is the result of a failed Cython compilation.
^
1 error generated.
Traceback
:error: command 'clang' failed with exit status 1
</pre>
 
I was able to resolve this issue by modifying the source code of NVECTOR.pxi. I changed this line (the line the error referred to):
 
<pre>
        buffer.shape = <Py_ssize_t *>&self.__shape
</pre>
 
to this line:
 
<source lang="python">
        buffer.shape = <Py_ssize_t *>self.__shape
</source>
 
 
===Header Files Not Found===
 
If you run into an error about header files not being found, like this one:
 
<pre>
$ python setup.py build
running build
running build_ext
cythoning sundials/sundials.pyx to sundials/sundials.c
warning: sundials/KINSOL.pxi:183:39: Not all members given for struct 'kinsol_userdata'
warning: sundials/KINSOL.pxi:183:39: Not all members given for struct 'kinsol_userdata'
building 'sundials' extension
clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -Isundials -Isundials/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c sundials/sundials.c -o build/temp.macosx-10.8-intel-2.7/sundials/sundials.o
clang: warning: argument unused during compilation: '-mno-fused-madd'
sundials/sundials.c:313:10: fatal error: 'sundials/sundials_types.h' file not found
#include "sundials/sundials_types.h"
        ^
1 error generated.
Traceback
:error: command 'clang' failed with exit status 1
</pre>
 
then you probably installed Sundials to a non-standard location. To instruct setup.py to use the Sundials libraries in a non-standard location, use the CFLAGS environment variable when calling setup.py:
 
<pre>
CFLAGS="-L/Users/charlesreid/pkg/sundails/std/lib -I/Users/charlesreid/pkg/sundials/std/include" python setup.py build
</pre>
 
===Linker Command Failed: Library Not Found For lsundials_cvode===
 
Once I fixed the pxi file, and instructed setup.py to use a C compiler command that would point to my non-standard sundials library install locations, I saw an error with the linker:
 
<pre>
creating build/lib.macosx-10.8-intel-2.7
clang -bundle -undefined dynamic_lookup -Wl,-F. -arch i386 -arch x86_64 build/temp.macosx-10.8-intel-2.7/sundials/sundials.o -Lsundials -lsundials_cvode -lsundials_ida -lsundials_kinsol -lsundials_nvecserial -o build/lib.macosx-10.8-intel-2.7/sundials.so
ld: library not found for -lsundials_cvode
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Traceback
:error: command 'clang' failed with exit status 1
 
Press enter to continue
</pre>
 
This was easily solved by doing the same thing with the LDFLAGS variable as was done with the CFLAGS variable:
 
<pre>
CFLAGS="-L/Users/charlesreid/pkg/sundails/std/lib -I/Users/charlesreid/pkg/sundials/std/include" LDFLAGS="$CFLAGS" python setup.py build
</pre>
 
===Must Be Compiled On Windows 32 Platform===
 
<pre>
creating 'dist/python-sundials-0.5.zip' and adding 'python-sundials-0.5' to it
adding 'python-sundials-0.5/COPYING.txt'
adding 'python-sundials-0.5/MANIFEST.in'
adding 'python-sundials-0.5/PKG-INFO'
adding 'python-sundials-0.5/README.txt'
adding 'python-sundials-0.5/setup.py'
adding 'python-sundials-0.5/sundials/CVODE.pxi'
adding 'python-sundials-0.5/sundials/IDA.pxi'
adding 'python-sundials-0.5/sundials/KINSOL.pxi'
adding 'python-sundials-0.5/sundials/Makefile_embedded'
adding 'python-sundials-0.5/sundials/NVECTOR.pxi'
adding 'python-sundials-0.5/sundials/sundials.c'
adding 'python-sundials-0.5/sundials/sundials.pxd'
adding 'python-sundials-0.5/sundials/SundialsLib.pxd'
adding 'python-sundials-0.5/sundials/test_cv_ball.py'
adding 'python-sundials-0.5/sundials/test_cv_simple.py'
adding 'python-sundials-0.5/sundials/test_cvRoberts_dns.py'
adding 'python-sundials-0.5/sundials/test_embedded.pyx'
adding 'python-sundials-0.5/sundials/test_idaRoberts_dns.py'
adding 'python-sundials-0.5/sundials/test_kinsol.py'
removing 'python-sundials-0.5' (and everything under it)
running bdist_wininst
Traceback
:error: distribution contains extensions and/or C libraries; must be compiled on a Windows 32 platform
</pre>
 
This was resolved by manually editing setup.py and removing the following line:
 
<pre>
sys.argv.append('bdist_wininst')
</pre>

Revision as of 20:14, 30 January 2014


sudo CC='clang -lsundials -I/Users/charlesreid/pkg/sundials/std/include -L/Users/charlesreid/pkg/sundials/std/lib' LDFLAGS="-L/Users/charlesreid/pkg/sundials/std/lib" python setup.py build


Errors

NVECTOR.pxi: Taking Address of Non-Lvalue

On my first attempt to install python-sundials, I got this error:

sundials/NVECTOR.pxi:41:37: Taking address of non-lvalue

Here is the full error context:

$ python setup.py build
running build
running build_ext
cythoning sundials/sundials.pyx to sundials/sundials.c

Error compiling Cython file:
------------------------------------------------------------
...
        buffer.obj = self
        buffer.len = self.getsize() * sizeof(double)
        buffer.readonly = 0
        buffer.format = <char*>"d"
        buffer.ndim = 1
        buffer.shape = <Py_ssize_t *>&self.__shape
                                    ^
------------------------------------------------------------

sundials/NVECTOR.pxi:41:37: Taking address of non-lvalue
warning: sundials/KINSOL.pxi:183:39: Not all members given for struct 'kinsol_userdata'
warning: sundials/KINSOL.pxi:183:39: Not all members given for struct 'kinsol_userdata'
building 'sundials' extension
creating build
creating build/temp.macosx-10.8-intel-2.7
creating build/temp.macosx-10.8-intel-2.7/sundials
clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -Isundials -Isundials/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c sundials/sundials.c -o build/temp.macosx-10.8-intel-2.7/sundials/sundials.o
clang: warning: argument unused during compilation: '-mno-fused-madd'
sundials/sundials.c:1:2: error: #error Do not use this file, it is the result of a failed Cython compilation.
#error Do not use this file, it is the result of a failed Cython compilation.
 ^
1 error generated.
Traceback
:error: command 'clang' failed with exit status 1

I was able to resolve this issue by modifying the source code of NVECTOR.pxi. I changed this line (the line the error referred to):

        buffer.shape = <Py_ssize_t *>&self.__shape

to this line:

        buffer.shape = <Py_ssize_t *>self.__shape


Header Files Not Found

If you run into an error about header files not being found, like this one:

$ python setup.py build
running build
running build_ext
cythoning sundials/sundials.pyx to sundials/sundials.c
warning: sundials/KINSOL.pxi:183:39: Not all members given for struct 'kinsol_userdata'
warning: sundials/KINSOL.pxi:183:39: Not all members given for struct 'kinsol_userdata'
building 'sundials' extension
clang -fno-strict-aliasing -fno-common -dynamic -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -mno-fused-madd -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -arch i386 -arch x86_64 -pipe -Isundials -Isundials/include -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c sundials/sundials.c -o build/temp.macosx-10.8-intel-2.7/sundials/sundials.o
clang: warning: argument unused during compilation: '-mno-fused-madd'
sundials/sundials.c:313:10: fatal error: 'sundials/sundials_types.h' file not found
#include "sundials/sundials_types.h"
         ^
1 error generated.
Traceback
:error: command 'clang' failed with exit status 1

then you probably installed Sundials to a non-standard location. To instruct setup.py to use the Sundials libraries in a non-standard location, use the CFLAGS environment variable when calling setup.py:

CFLAGS="-L/Users/charlesreid/pkg/sundails/std/lib -I/Users/charlesreid/pkg/sundials/std/include" python setup.py build

Linker Command Failed: Library Not Found For lsundials_cvode

Once I fixed the pxi file, and instructed setup.py to use a C compiler command that would point to my non-standard sundials library install locations, I saw an error with the linker:

creating build/lib.macosx-10.8-intel-2.7
clang -bundle -undefined dynamic_lookup -Wl,-F. -arch i386 -arch x86_64 build/temp.macosx-10.8-intel-2.7/sundials/sundials.o -Lsundials -lsundials_cvode -lsundials_ida -lsundials_kinsol -lsundials_nvecserial -o build/lib.macosx-10.8-intel-2.7/sundials.so
ld: library not found for -lsundials_cvode
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Traceback
:error: command 'clang' failed with exit status 1

Press enter to continue

This was easily solved by doing the same thing with the LDFLAGS variable as was done with the CFLAGS variable:

CFLAGS="-L/Users/charlesreid/pkg/sundails/std/lib -I/Users/charlesreid/pkg/sundials/std/include" LDFLAGS="$CFLAGS" python setup.py build

Must Be Compiled On Windows 32 Platform

creating 'dist/python-sundials-0.5.zip' and adding 'python-sundials-0.5' to it
adding 'python-sundials-0.5/COPYING.txt'
adding 'python-sundials-0.5/MANIFEST.in'
adding 'python-sundials-0.5/PKG-INFO'
adding 'python-sundials-0.5/README.txt'
adding 'python-sundials-0.5/setup.py'
adding 'python-sundials-0.5/sundials/CVODE.pxi'
adding 'python-sundials-0.5/sundials/IDA.pxi'
adding 'python-sundials-0.5/sundials/KINSOL.pxi'
adding 'python-sundials-0.5/sundials/Makefile_embedded'
adding 'python-sundials-0.5/sundials/NVECTOR.pxi'
adding 'python-sundials-0.5/sundials/sundials.c'
adding 'python-sundials-0.5/sundials/sundials.pxd'
adding 'python-sundials-0.5/sundials/SundialsLib.pxd'
adding 'python-sundials-0.5/sundials/test_cv_ball.py'
adding 'python-sundials-0.5/sundials/test_cv_simple.py'
adding 'python-sundials-0.5/sundials/test_cvRoberts_dns.py'
adding 'python-sundials-0.5/sundials/test_embedded.pyx'
adding 'python-sundials-0.5/sundials/test_idaRoberts_dns.py'
adding 'python-sundials-0.5/sundials/test_kinsol.py'
removing 'python-sundials-0.5' (and everything under it)
running bdist_wininst
Traceback
:error: distribution contains extensions and/or C libraries; must be compiled on a Windows 32 platform

This was resolved by manually editing setup.py and removing the following line:

sys.argv.append('bdist_wininst')