bradbell / cppad_py

A C++ Object Library and Python Interface to Cppad
https://cppad-py.readthedocs.io
15 stars 3 forks source link

make check error: "TypeError: unsupported operand type(s) for /=: 'a_double' and 'a_double'" #3

Closed utke1 closed 4 years ago

utke1 commented 6 years ago

as in

jutke@vb:/sandbox/jutke/work/Git/cppad_py/build$ make check              
[ 36%] Built target auto_lib_python
python: a_double_cond_assign_xam: OK
python: a_double_property_xam: OK
python: a_double_unary_fun_xam: OK
python: a_double_unary_op_xam: OK
Traceback (most recent call last):
  File "check_all.py", line 51, in <module>
    ok = run_test(name)
  File "check_all.py", line 16, in run_test
    exec( 'ok = '   + name + '.' + name + '()', namespace )
  File "<string>", line 1, in <module>
  File "/sandbox/jutke/work/Git/cppad_py/build/lib/example/python/a_double_assign_xam.py", line 33, in a_double_assign_xam
    x /= cppad_py.a_double(4.0);
TypeError: unsupported operand type(s) for /=: 'a_double' and 'a_double'
Error in sys.excepthook:
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 63, in apport_excepthook
    from apport.fileutils import likely_packaged, get_recent_crashes
  File "/usr/lib/python3/dist-packages/apport/__init__.py", line 5, in <module>
    from apport.report import Report
  File "/usr/lib/python3/dist-packages/apport/report.py", line 30, in <module>
    import apport.fileutils
  File "/usr/lib/python3/dist-packages/apport/fileutils.py", line 23, in <module>
    from apport.packaging_impl import impl as packaging
  File "/usr/lib/python3/dist-packages/apport/packaging_impl.py", line 23, in <module>
    import apt
  File "/usr/lib/python3/dist-packages/apt/__init__.py", line 34, in <module>
    apt_pkg.init_config()
SystemError: E:Opening configuration file /etc/apt/apt.conf.d/80proxy - ifstream::ifstream (13: Permission denied)

Original exception was:
Traceback (most recent call last):
  File "check_all.py", line 51, in <module>
    ok = run_test(name)
  File "check_all.py", line 16, in run_test
    exec( 'ok = '   + name + '.' + name + '()', namespace )
  File "<string>", line 1, in <module>
  File "/sandbox/jutke/work/Git/cppad_py/build/lib/example/python/a_double_assign_xam.py", line 33, in a_double_assign_xam
    x /= cppad_py.a_double(4.0);
TypeError: unsupported operand type(s) for /=: 'a_double' and 'a_double'
lib/example/python/CMakeFiles/check_lib_python.dir/build.make:57: recipe for target 'lib/example/python/CMakeFiles/check_lib_python' failed
make[3]: *** [lib/example/python/CMakeFiles/check_lib_python] Error 1
CMakeFiles/Makefile2:667: recipe for target 'lib/example/python/CMakeFiles/check_lib_python.dir/all' failed
make[2]: *** [lib/example/python/CMakeFiles/check_lib_python.dir/all] Error 2
CMakeFiles/Makefile2:75: recipe for target 'CMakeFiles/check.dir/rule' failed
make[1]: *** [CMakeFiles/check.dir/rule] Error 2
Makefile:118: recipe for target 'check' failed
make: *** [check] Error 2
jutke@vb:/sandbox/jutke/work/Git/cppad_py/build$ 
utke1 commented 6 years ago

setup.py was modified as follows:

--- a/setup.py
+++ b/setup.py
@@ -6,12 +6,12 @@
 #                    https://www.gnu.org/licenses/gpl-3.0.txt
 # -----------------------------------------------------------------------------
 # BEGIN_USER_SETTINGS
-verbose_makefile = "false"
+verbose_makefile = "true`"
 build_type       = "debug"
-swig_cxx_flags   = "-Wno-sign-compare -Wno-catch-value -Wno-class-memaccess"
-cppad_cxx_flags  = "-Wall -pedantic-errors -Wno-unused-result"
+swig_cxx_flags   = "-Wno-sign-compare -Wno-catch-value -Wno-class-memaccess -std=c++11"
+cppad_cxx_flags  = "-Wall -pedantic-errors -Wno-unused-result -std=c++11"
 cppad_prefix     = "build/prefix"
-test_cppad       = "false"
+test_cppad       = "true"
 # END_USER_SETTINGS
 # -----------------------------------------------------------------------------
 import re
bradbell commented 6 years ago

I have run the change above to setup.py with both python2 and python3 and make check works in both cases on my machine; e.g.

    python3 setup.py build_ext --inplace
    cd build
    make check

What version of swig are you usinbuild>swig -version SWIG Version 3.0.12 Compiled with g++ [x86_64-redhat-linux-gnu] Configured options: +pcre

utke1 commented 6 years ago

I have:

jutke@vb:/sandbox/jutke/work/Git/cppad_py$ swig -version
SWIG Version 3.0.8
Compiled with g++ [x86_64-pc-linux-gnu]
Configured options: +pcre
...
jutke@vb:/sandbox/jutke/work/Git/cppad_py$ python3
Python 3.5.2 (default, Nov 23 2017, 16:37:01) 
[GCC 5.4.0 20160609] on linux

but I could change to different versions if need be.

bradbell commented 6 years ago

I downgraded to swig.3.0.8 and got the error: [ 22%] Generating error_message_xam.py TypeError: unsupported operand type(s) for /=: 'a_double' and 'a_double' Would you please try upgrading to a newer version of swig and see what happens.

utke1 commented 6 years ago

with swig upgraded to 3.0.12 I see all the checks on https://bradbell.github.io/cppad_py/doc/testing.htm passing.
Should I close this now or do you want to use it to track implementing a check for the swig version during the setup?

bradbell commented 6 years ago

Lets leave this issue open until we determine that there actually was a swig bug fix that corresponds to why this does not work for swig-3.0.8.