Skip to content

Commit

Permalink
fix library linking error and run time warning on 64 bit machine
Browse files Browse the repository at this point in the history
  • Loading branch information
Brad Bell committed Feb 10, 2009
1 parent e3d7dc6 commit 4af21db
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 23 deletions.
17 changes: 15 additions & 2 deletions brad/build.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,20 @@
#! /bin/bash
if [ "$1" != "omhelp" ] && [ "$1" != "sdist" ] && [ "$1" != "all" ]
then
echo "build.sh option, where option is one of the following"
echo "omhelp: stop when the help is done"
echo "sdist: stop when the done building the source distribution"
echo "all: go all the way"
exit 1
fi
option="$1"
# ---------------------------------------------------------------------
cppad_version="20080919.0" # cppad release version we are using
yyyymmdd=`date +%G%m%d` # todays year, month, and day
# ---------------------------------------------------------------------
# Note for Sebastian: this choice forces cppad to be dowloanded each time.
# I like to use $HOME/install to speed up testing.
cppad_parent_dir="." # directory for cppad tarball etc
cppad_parent_dir="$HOME/install" # directory for cppad tarball etc
# ---------------------------------------------------------------------
omhelp_location=`which omhelp`
if [ "$omhelp_location" = "" ]
Expand Down Expand Up @@ -75,7 +84,7 @@ then
exit 1
fi
cd ..
if [ "$1" == "omhelp" ]
if [ "$option" == "omhelp" ]
then
exit 0
fi
Expand Down Expand Up @@ -130,6 +139,10 @@ include test_more.py
include test_example.py
EOF
./setup.py sdist
if [ "$option" == "sdist" ]
then
exit 0
fi
echo "# Extract the source distribution -------------------------------"
cmd="cd dist"
echo "$cmd"
Expand Down
22 changes: 11 additions & 11 deletions brad/omh/install.omh
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@ $index download, pycppad$$
$index pycppad, download$$
Download the file
$href%
http://www.seanet.com/~bradbell/pycppad-20090209.tar.gz%
pycppad-20090209.tar.gz
http://www.seanet.com/~bradbell/pycppad-20090210.tar.gz%
pycppad-20090210.tar.gz
%$$
and store it on your machine.

Expand All @@ -44,14 +44,14 @@ $index extract, pycppad$$
$index pycppad, extract$$
On unix, you could use the command
$codep
tar -xvzf pycppad-20090209.tar.gz
tar -xvzf pycppad-20090210.tar.gz
$$
which would create the directory $code pycppad-20090209$$.
which would create the directory $code pycppad-20090210$$.

$head Required Setup Information$$
The value of the following setup variables, in the file
$codep
pycppad-20090209/setup.py
pycppad-20090210/setup.py
$$
must be set to agree with your system:
$code
Expand All @@ -64,7 +64,7 @@ properly set this information
$head Building$$
$index build, pycppad$$
$index pycppad, build$$
Change into the directory $code pycppad-20090209$$ and execute the command
Change into the directory $code pycppad-20090210$$ and execute the command
$codep
./setup.py build_ext --inplace --debug --undef NDEBUG
$$
Expand Down Expand Up @@ -98,7 +98,7 @@ $index test, pycppad$$
$index pycppad, test$$
You can test of all the
$cref/examples/example/$$ in the $code pycppad$$ documentation.
Change into the directory $code pycppad-20090209$$ and execute the command
Change into the directory $code pycppad-20090210$$ and execute the command
$codep
python test_example.py
$$
Expand All @@ -115,7 +115,7 @@ You may or may not preform this step:
$pre

$$
Change into the directory $code pycppad-20090209$$ and execute the command
Change into the directory $code pycppad-20090210$$ and execute the command
$codei%
python setup.py install --prefix=%prefix%
%$$
Expand All @@ -134,7 +134,7 @@ an uninstall command. You can uninstall the $code pycppad$$ package
by removing the entries
$codei%
%prefix%/lib/python%major%.%minor%/site-packages/pycppad
%prefix%/lib/python%major%.%minor%/site-packages/pycppad-20090209.egg-info
%prefix%/lib/python%major%.%minor%/site-packages/pycppad-20090210.egg-info
%prefix%/share/doc/pycppad
%$$
where $icode major$$ and $icode minor$$
Expand All @@ -152,7 +152,7 @@ $codei%
%$$
unless the distribution directory
$codep
pycppad-20090209
pycppad-20090210
$$
or (provided you installed $code pycppad$$) the installation directory
$codei%
Expand All @@ -174,7 +174,7 @@ $codei%
$head pycppad Documentation$$
The documentation for $code pycppad$$ starts out in the directory
$codep
pycppad-20090209/doc
pycppad-20090210/doc
$$
During the installation process, it is copied to the directory
$codei%
Expand Down
4 changes: 2 additions & 2 deletions brad/pycppad/vec2array.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@

namespace pycppad {
array vec2array(double_vec& vec)
{ int n = static_cast<int>( vec.size() );
{ npy_intp n = static_cast<npy_intp>( vec.size() );
PYCPPAD_ASSERT( n >= 0 , "");

object obj(handle<>( PyArray_FromDims(1, &n, PyArray_DOUBLE) ));
object obj(handle<>( PyArray_SimpleNew(1, &n, PyArray_DOUBLE) ));
double *ptr = static_cast<double*> ( PyArray_DATA (
reinterpret_cast<PyArrayObject*> ( obj.ptr() )
));
Expand Down
4 changes: 2 additions & 2 deletions brad/pycppad/vector.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace pycppad {
// constructor from a python array
vec<double>::vec(array& py_array)
{ // get array info
int* dims_ptr = PyArray_DIMS(py_array.ptr());
npy_intp* dims_ptr = PyArray_DIMS(py_array.ptr());
int length = dims_ptr[0];

// check array info
Expand Down Expand Up @@ -123,7 +123,7 @@ template <class Scalar>
vec<Scalar>::vec(array& py_array)
{
// get array info
int* dims_ptr = PyArray_DIMS(py_array.ptr());
npy_intp* dims_ptr = PyArray_DIMS(py_array.ptr());
int length = dims_ptr[0];

// check array info
Expand Down
14 changes: 8 additions & 6 deletions brad/setup.template
Original file line number Diff line number Diff line change
@@ -1,10 +1,5 @@
#!/usr/bin/env python
# ---------------------------------------------------------------------
# Values set by build.sh
cppad_parent_dir = # cppad tarball and distribution directory will be here
package_version = # date in yyyymmdd format corresonding to this distribution
cppad_version = # version of CppAD corresponding to this version of pycppad
# ---------------------------------------------------------------------
# BEGIN USER SETTINGS
boost_lib_dir = '/usr/lib' # Directory where boost::python library is located
boost_python_lib = 'boost_python' # name of the library in that directory
Expand All @@ -16,9 +11,15 @@ boost_python_lib = 'boost_python' # name of the library in that directory
# See http://docs.python.org/install/index.html
# for documentation on how to use the script setup.py
# ---------------------------------------------------------------------
# Values set by build.sh
cppad_parent_dir = # cppad tarball and distribution directory will be here
package_version = # date in yyyymmdd format corresonding to this distribution
cppad_version = # version of CppAD corresponding to this version of pycppad
# ---------------------------------------------------------------------
import os
import sys
from distutils.core import setup, Extension
from numpy.distutils.misc_util import get_numpy_include_dirs
# ---------------------------------------------------------------------
boost_python_lib_path = boost_lib_dir + '/lib' + boost_python_lib + '.so'
if not os.access ( boost_python_lib_path , os.R_OK ) :
Expand Down Expand Up @@ -67,7 +68,8 @@ package_data_files = [ ('share/doc/pycppad', doc_files ) ]
package_license = 'BSD'
#
cppad_extension_name = 'pycppad' + '/cppad_'
cppad_extension_include_dirs = [ cppad_include_dir ]
cppad_extension_include_dirs = get_numpy_include_dirs()
cppad_extension_include_dirs.append( cppad_include_dir )
cppad_extension_library_dirs = [ boost_lib_dir ]
cppad_extension_libraries = [ boost_python_lib ]
cppad_extension_sources = [
Expand Down

0 comments on commit 4af21db

Please sign in to comment.