Notes on getting PyODE to work on Linux with GCC 4

By Mark E. Phair

Last Updated: Feb 18 2006

This page should be helpful if...

  1. You are trying to install PyODE on linux with GCC 4
  2. It will not build because of compile errors, including many "invalid lvalue in assignment" errors

The Problem

GCC 4 is more strict than previous versions, so it chokes and dies when it sees things like (PyObject *)b =, which is known as the "lvalue problem." (lvalue: left value of an assignment). In general, it is bad practice to cast the left-hand side, so GCC 4 just disallows it. There are probably better explanations of the issue. Google it.

PyODE uses pyrex, which is a special c-python mix that can be compiled. The version of PyODE that is currently available uses an old version of pyrex which has the "lvalue problem."

The solution

There are two files, ode_trimesh.c and ode_notrimesh.c, that are included with the distribution so that you don't need to have pyrex to install PyODE. They are the stuff in ./src/ translated by pyrex into C.

  1. Delete ode_trimesh.c and ode_notrimesh.c
  2. Install the "fixed" version of pyrex (
  3. Re-run python build

This should fix the problem by building new versions of ode_trimesh.c and ode_notrimesh.c


Thread from PyODE mailing list