coin3d / pivy

python bindings to coin3d
ISC License
53 stars 37 forks source link

Failed to build pivy 0.6.6.a0 with SWIG 4.0.0 or 4.0.2 #72

Closed sprhawk closed 3 years ago

sprhawk commented 3 years ago

Build Host: Debian 10 x86_64 SWIG: 4.0.0 or 4.0.2 Pivy: 0.6.6.a0

cmake:

error message:

build_pivy/Release/pivy/coinPYTHON_wrap.cxx: In function ‘PyObject* _wrap_SbString_vsprintf(PyObject*, PyObject*)’:
build_pivy/Release/pivy/coinPYTHON_wrap.cxx:9587:15: error: invalid array assignment
 arg3 = *temp; 

Coin3D: 4.0.0 Python3: 3.5.9 CMakeCache.txt

looooo commented 3 years ago

I can't reproduce this issue. Which compiler are you using?

I tested with

sprhawk commented 3 years ago

The Compiler is gcc-8 (Debian 8.3.0-6) 8.3.0 which is installed under debian 10.

Could it be problem of Python3.5?

looooo commented 3 years ago

Could it be problem of Python3.5?

This is also possible. Any chance to try with a newer python version?

sprhawk commented 3 years ago

Same error with Python 3.6.12

looooo commented 3 years ago

I can reproduce this error (but with different line-number) if I remove this line here: https://github.com/coin3d/pivy/blob/master/Inventor/SbString.i#L1

the error in this case looks like this:

pivy/build/pivy/coinPYTHON_wrap.cxx: In function ‘PyObject* _wrap_SbString_vsprintf(PyObject*, PyObject*)’:
pivy/build/pivy/coinPYTHON_wrap.cxx:11366:15: error: invalid array assignment
       arg3 = *temp;

But I am not sure if this helps anything.

sprhawk commented 3 years ago

@looooo Hi, I think I found the reason. When building with cmake, usually I make a build_pivy outside pivy source code dir, but I found when I run cmake inside pivy source code dir ( with or without -B parameter ), it will work correctly. have tested with Python 3.6.12 and Python 3.8.5

looooo commented 3 years ago

I tried to build pivy from another directory, but still not running into this issue.

can you share the commands which lead to the failing build?

sprhawk commented 3 years ago
# under build_pivy, which is at same level as pivy
cmake -BRelease -DCMAKE_PREFIX_PATH="/home/hongbo/Developer/Engineering/local/lib/cmake:/usr/lib/x86_64-linux-gnu/cmake:/usr/lib/cmake" -DCMAKE_INSTALL_PREFIX="/home/hongbo/Developer/Engineering/local" -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE="/home/hongbo/Developer/Engineering/local/bin/python3.8" "../pivy"

I saw the CMakeCache.txt is actually created inside pivy, not build_pivy.

But when running inside pivy like:

cmake -BRelease -DCMAKE_PREFIX_PATH="/home/hongbo/Developer/Engineering/local/lib/cmake:/usr/lib/x86_64-linux-gnu/cmake:/usr/lib/cmake" -DCMAKE_INSTALL_PREFIX="/home/hongbo/Developer/Engineering/local" -DCMAKE_BUILD_TYPE=Release -DPYTHON_EXECUTABLE="/home/hongbo/Developer/Engineering/local/bin/python3.8" "."

the cmake generated files are correctly created inside Release

lcpt commented 1 year ago

I've had the same problem using g++ 11.2.0 and Python 3.10.5 (Ubuntu 22.04). If I try to build the source outside the pivy source code directory. If I build it inside the directory, it works fine.

dvzrv commented 5 months ago

@looooo Can this issue please be reopened? It is still happening when building as of now.

Out-of-tree builds do not seem to be possible!

Does not work:

local cmake_options=(
    -B build
    -D CMAKE_BUILD_TYPE=None
    -D CMAKE_INSTALL_PREFIX=/usr
    -D PIVY_USE_QT6=ON
    -W no-dev
    -S $_name-$pkgver
  )

  cmake "${cmake_options[@]}"
  cmake --build build --verbose

Works:

  local cmake_options=(
    -B build
    -D CMAKE_BUILD_TYPE=None
    -D CMAKE_INSTALL_PREFIX=/usr
    -D PIVY_USE_QT6=ON
    -W no-dev
  )

  cd $_name-$pkgver
  cmake "${cmake_options[@]}"
  cmake --build build --verbose