On Sun, 24 Aug 2008, Felix Schwarz wrote:
What compile flags did you use when you built JCC itself ? (yes, Python's
distutils sets most of these, what are they ?)
CFLAGS='-O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions
-fstack-protector --param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables'
No other modifications besides setup.py:
INCLUDES = {
...
+ 'linux2': ['/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/include',
+ '/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/include/linux'],
...
LFLAGS = {
+ 'linux2': ['-L/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/jre/lib/i386',
'-ljava',
+ '-Wl'],
(I learned about the JCC_* environment variables after creating the rpm)
Does switching from -O3 to -O2 or -O0 (no optimizations) make the problem
go
away ?
Yes, at least my test case is not reproducible with that anymore.
Ah ha, so we do have some interaction with the C++ compiler here.
JCC_CFLAGS="-O0" python setup.py develop --install-dir=...
for build jcc leads to compiler calls like this:
--------------------------------------
building 'jcc' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -O2 -g -pipe -Wall
-Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector
--param=ssp-buffer-size=4 -m32 -march=i386 -mtune=generic
-fasynchronous-unwind-tables -D_GNU_SOURCE -fPIC -fPIC
-I/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/include
-I/usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/include/linux -I_jcc -Ijcc/sources
-I/usr/include/python2.4 -c jcc/sources/jcc.cpp -o
build/temp.linux-i686-2.4/jcc/sources/jcc.o -DPYTHON -O0
--------------------------------------
Please note the -O2 in the beginning and the -I0 at the end. Is that correct?
How can I get rid of the O2 if that is important?
The -O0 should override the -O2 since it's later in the command line.
All the compiler flags you see here that don't come from JCC's setup.py come
from Python's distutils which picks them up via its sysconfig module. These
are the compiler flags that Python was compiled with itself and were
determined during its 'configure' step. You can access these as follows:
>>> from distutils import sysconfig
>>> sysconfig.get_config_vars()
>>> sysconfig.get_config_var('CFLAGS')
There are a number of compiler flags I don't understand here. Maybe some of
them interact with C++ code - Python is only C - in an unfortunate way:
--param=ssp-buffer-size=4 -fasynchronous-unwind-tables -fexceptions
-fstack-protector -Wp,-D_FORTIFY_SOURCE=2
I seem to remember you saying that you were using a 64-bit architecture.
According to these compile flags, you're not. -m32 denotes a 32-bit
architecture python. I'd expect to see -m64 for building a 64-bit python.
Based on my findings, do you suspect a compiler bug? Or should I try to
debug it further? For short term (next few days) I will try to rebuild my
RPMs with -O0 and see if I can crash it anyway.
Well, it does look that way. Before disabling optimizations completely, I'd
try fiddling with other flags (like removing the ones I listed above as "I
don't understand (I don't know them)). Also, try -O1 or -O3 or -Os.
It would also be interesting to see if that problem just 'went away' if you
built your own Python from sources, letting its configure do the work. Maybe
some of the compiler flags in the RPM python are causing problems here.
You can build your own python with --prefix 'somewhere just for you' and
then rebuild JCC and PyLucene to use that Python instead.
I'm afraid that it's going to take a little bit of build fiddling to isolate
this problem.
you wrote earlier:
Since it's so easy for you to reproduce the bug, it'd be interesting to
know
what the value of the obj and id parameters are in
JCCEnv::deleteGlobalRef()
at the time of the crash.
I suspect I should run my app, attach gdb to the running app and set a break
point just before the line where it crashes. Them I dump obj and id, right?
Let it crash into gdb, walk up the stack and get the values from there. No
need to set a track point unless by the time it crashes, gdb is too
confused.
Andi..
_______________________________________________
pylucene-dev mailing list
pylucene-dev@osafoundation.org
http://lists.osafoundation.org/mailman/listinfo/pylucene-dev