Building pytave on Mac (python 2.7.2, octave 3.4.3)

Asked by Stephen Pope

Hello all,

I got pytave's configure script to work by faking out the check for numpy compilation; I added the following line at line 5214 of the configure script

ax_python_numpy_cv_check=yes # STP change 120403 ##########################

so that the configure now completes. When I say make, I get the following error:

make
make all-am
/bin/sh ./libtool --tag=CXX --mode=compile g++ -DHAVE_CONFIG_H -I. -I/opt/local/include/octave-3.4.3/octave/.. -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include -I/usr/local/include -arch x86_64 -I/opt/local/include -I/usr/X11/include -I/usr/X11/include/freetype2 -I/usr/X11/include/libpng12 -I/Users/stp/Code/Graphics/QtSDK/Desktop/Qt/4.8.0/gcc/include -MT _pytave_la-octave_to_python.lo -MD -MP -MF .deps/_pytave_la-octave_to_python.Tpo -c -o _pytave_la-octave_to_python.lo `test -f 'octave_to_python.cc' || echo './'`octave_to_python.cc
libtool: compile: g++ -DHAVE_CONFIG_H -I. -I/opt/local/include/octave-3.4.3/octave/.. -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -I/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/numpy/core/include -I/usr/local/include -arch x86_64 -I/opt/local/include -I/usr/X11/include -I/usr/X11/include/freetype2 -I/usr/X11/include/libpng12 -I/Users/stp/Code/Graphics/QtSDK/Desktop/Qt/4.8.0/gcc/include -MT _pytave_la-octave_to_python.lo -MD -MP -MF .deps/_pytave_la-octave_to_python.Tpo -c octave_to_python.cc -fno-common -DPIC -o .libs/_pytave_la-octave_to_python.o
octave_to_python.cc: In function 'void pytave::copy_octarray_to_pyarrobj(PyArrayObject*, const OctaveBase&, unsigned int, unsigned int, int, unsigned int) [with PythonPrimitive = long int, OctaveBase = intNDArray<octave_int<long long int> >]':
octave_to_python.cc:125: instantiated from 'PyArrayObject* pytave::create_array(const OctaveBase&, int) [with PythonPrimitive = long int, OctaveBase = intNDArray<octave_int<long long int> >]'
octave_to_python.cc:137: instantiated from 'PyArrayObject* pytave::create_array(const OctaveBase&, int, boost::true_type) [with PythonPrimitive = long int, OctaveBase = intNDArray<octave_int<long long int> >]'
octave_to_python.cc:177: instantiated from 'PyArrayObject* pytave::create_sint_array(CLASS) [with CLASS = intNDArray<octave_int<long long int> >, long unsigned int bytes = 8ul]'
octave_to_python.cc:218: instantiated from here
octave_to_python.cc:61: error: conversion from 'const octave_int<long long int>' to 'long int' is ambiguous
/opt/local/include/octave-3.4.3/octave/../octave/oct-inttypes.h:783: note: candidates are: octave_int<T>::operator float() const [with T = long long int]
/opt/local/include/octave-3.4.3/octave/../octave/oct-inttypes.h:781: note: octave_int<T>::operator double() const [with T = long long int]
/opt/local/include/octave-3.4.3/octave/../octave/oct-inttypes.h:777: note: octave_int<T>::operator T() const [with T = long long int]
make[1]: *** [_pytave_la-octave_to_python.lo] Error 1
make: *** [all] Error 2

line 61 of octave_to_python.cc says,

            *(PythonPrimitive *)&ptr[offset + i*pyarr->strides[dimension]]
               = matrix.elem(matindex + i*matstride);

and I'm not certain how to add an explicit cast to make this work...

...any reply appreciated...

Stephen Pope

Question information

Language:
English Edit question
Status:
Answered
For:
Pytave Edit question
Assignee:
No assignee Edit question
Last query:
Last reply:
Revision history for this message
David Grundberg (individ) said :
#1

// Please tell me what this program tells you:
#include <iostream>
#include <stdint.h>

int
main(int argc, char** argv)
{
    std::cout << "int: " << sizeof(int) << std::endl;
    std::cout << "long int: " << sizeof(long int) << std::endl;
    std::cout << "long long int: " << sizeof(long long int) << std::endl;
    std::cout << "int32_t: " << sizeof(int32_t) << std::endl;
    std::cout << "int64_t: " << sizeof(int64_t) << std::endl;
    return 0;
}

#Compile with the gcc compiler like so:
g++ file.cc

#and run:
./a.out

My guess is that we don't have the same output, mine is:
$ ./a.out
int: 4
long int: 4
long long int: 8
int32_t: 4
int64_t: 8
$

Revision history for this message
Stephen Pope (stephen-heaveneverywhere) said :
#2

Here's what I get on my MacBookPro

int: 4
long int: 8
long long int: 8
int32_t: 4
int64_t: 8

As this is a 64-bit machine, long int is 8 bytes -- the difference to your machine.

stp

Revision history for this message
Launchpad Janitor (janitor) said :
#3

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Stephen Pope (stephen-heaveneverywhere) said :
#4

Hi,

Is there any quick fix you can recommend for the "size of long" problem on 64-bit processors?

stp

Revision history for this message
Launchpad Janitor (janitor) said :
#5

This question was expired because it remained in the 'Open' state without activity for the last 15 days.

Revision history for this message
Stephen Pope (stephen-heaveneverywhere) said :
#6

Hi,

I'm still hoping for a fix; should I look at the type coercion code?

stp

Revision history for this message
David Grundberg (individ) said :
#7

As a matter of fact I do have some code I want you to test. I will post it tonight (GMT+2).

Revision history for this message
David Grundberg (individ) said :
#8

I have pushed revision 52, I make no promises. I suspect 32-bit integers have become broken with this change.

Revision history for this message
Tim O'Brien (timothy-scott-obrien) said :
#9

Just FYI I'm having the exact same issue on my 64-bit machine. I tried revision 52 but am still getting errors identical to those pasted by Stephen above when I make. Thanks for your help on this David!

Can you help with this problem?

Provide an answer of your own, or ask Stephen Pope for more information if necessary.

To post a message you must log in.