UFC

ufc needs Python 2, but Python 3 may be found (with fix)

Bug #1155621 reported by Nico Schlömer
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
UFC
Fix Committed
Undecided
Unassigned

Bug Description

Hi,

I tried to compile ufc on another machine today and got the error messages

============================== *snip* ==============================
[...]
[ 50%] Building CXX object CMakeFiles/_ufc.dir/src/ufc/ufcPYTHON_wrap.cxx.o
/usr/bin/c++ -D_ufc_EXPORTS -O3 -DNDEBUG -fPIC -I/homes/numerik/nschloe/Work/FEniCS/src/ufc/src/ufc -I/usr/include/python3.2mu -o CMakeFiles/_ufc.dir/src/ufc/ufcPYTHON_wrap.cxx.o -c /homes/numerik/nschloe/Work/FEniCS/src/ufc/dorsal_build_dir/src/ufc/ufcPYTHON_wrap.cxx
/homes/numerik/nschloe/Work/FEniCS/src/ufc/dorsal_build_dir/src/ufc/ufcPYTHON_wrap.cxx: In function ‘bool Py_convert_uint(PyObject*, std::size_t&)’:
/homes/numerik/nschloe/Work/FEniCS/src/ufc/dorsal_build_dir/src/ufc/ufcPYTHON_wrap.cxx:3288:46: error: ‘PyInt_AS_LONG’ was not declared in this scope
/homes/numerik/nschloe/Work/FEniCS/src/ufc/dorsal_build_dir/src/ufc/ufcPYTHON_wrap.cxx:3290:54: error: ‘PyInt_AS_LONG’ was not declared in this scope
============================== *snap* ==============================

This is because CMake spit out the Python3.2 include folder which doesn't have those symbols.
To make sure that Python 2 is found, add

set(PythonInterp_FIND_VERSION 2)

right before

find_package(PythonInterp QUIET)

in ufc's main CMakeLists.txt.

--Nico

Revision history for this message
Nico Schlömer (nschloe) wrote :

Also, if UFC_ENABLE_PYTHON, one requires PythonLibs. You may want to replace

# Find Python library corresponding to Python interpreter
find_package(PythonLibs ${PYTHON_VERSION_STRING} EXACT QUIET)

by

# Find Python library corresponding to Python interpreter
if (UFC_ENABLE_PYTHON)
  find_package(PythonLibs ${PYTHON_VERSION_STRING} EXACT QUIET REQUIRED)
else()
  find_package(PythonLibs ${PYTHON_VERSION_STRING} EXACT QUIET)
endif()

Revision history for this message
Nico Schlömer (nschloe) wrote :

Moreover, because of bug http://public.kitware.com/Bug/view.php?id=13216, UFC needs CMake 2.8.9 to work correctly. This should probably be reflected by cmake_minimum_required().

Changed in ufc:
status: New → Fix Committed
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.