From: Bill J. <ja...@pa...> - 2010-12-01 17:30:13
|
I'm building JCC (from http://lucene.apache.org/pylucene/) with MinGW on 64-bit Windows 7 (though everything I'm doing and using is 32-bit), and running into this problem with the generated JCC DLL (called "_jcc.pyd"): (gdb) run Starting program: c:\Python27/python.exe -m jcc --shared --compiler mingw32 --jar lucene-java-3.0.3/build/lucene-core-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/snowball/lucene-snowball-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/analyzers/common/lucene-analyzers-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/regex/lucene-regex-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/memory/lucene-memory-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/highlighter/lucene-highlighter-3.0.3.jar --jar lucene-java-3.0.3/build/contrib/queries/lucene-queries-3.0.3.jar --jar build/jar/extensions.jar --package java.lang java.lang.System java.lang.Runtime --package java.util java.util.Arrays java.text.SimpleDateFormat java.text.DecimalFormat java.text.Collator --package java.io java.io.StringReader java.io.InputStreamReader java.io.FileInputStream --exclude org.apache.lucene.queryParser.Token --exclude org.apache.lucene.queryParser.TokenMgrError --exclude org.apache.lucene.queryParser.QueryParserTokenManager --exclude org.apache.lucene.queryParser.ParseException --exclude org.apache.lucene.search.regex.JakartaRegexpCapabilities --exclude org.apache.regexp.RegexpTunnel --python lucene --mapping org.apache.lucene.document.Document 'get:(Ljava/lang/String;)Ljava/lang/String;' --mapping java.util.Properties 'getProperty:(Ljava/lang/String;)Ljava/lang/String;' --rename org.apache.lucene.search.highlight.SpanScorer=HighlighterSpanScorer --version 3.0.3 --module python/collections.py --files 3 --build [New Thread 1556.0x9fc] Program received signal SIGTRAP, Trace/breakpoint trap. 0x7740fabd in ntdll!TpWaitForAlpcCompletion () from C:\Windows\system32\ntdll.dll (gdb) warning: HEAP[python.exe]: warning: Invalid address specified to RtlFreeHeap( 00380000, 004314A8 ) (gdb) bt #0 0x7740fabd in ntdll!TpWaitForAlpcCompletion () from C:\Windows\system32\ntdll.dll #1 0x0027f644 in ?? () #2 0x773d26c4 in ntdll!RtlCreateUserStack () from C:\Windows\system32\ntdll.dll #3 0x004314a0 in ?? () #4 0x77410b17 in ntdll!TpQueryPoolStackInformation () from C:\Windows\system32\ntdll.dll #5 0x00380000 in ?? () #6 0x773ca8ff in ntdll!AlpcMaxAllowedMessageLength () from C:\Windows\system32\ntdll.dll #7 0x00380000 in ?? () #8 0x77372a32 in ntdll!RtlEncodePointer () from C:\Windows\system32\ntdll.dll #9 0x004314a0 in ?? () #10 0x75a014d1 in KERNEL32!BaseFlushAppcompatCache () from C:\Windows\syswow64\kernel32.dll #11 0x00380000 in ?? () #12 0x74aa38bb in free () from C:\Windows\WinSxS\x86_microsoft.vc90.crt_1fc8b3b9a1e18e3b_9.0.30729.4926_none_508ed732bcbc0e5a\msvcr90.dll #13 0x00380000 in ?? () #14 0x64d81bc6 in initVM(_object*, _object*, _object*) () from c:\Python27\lib\site-packages\jcc-2.6-py2.7-win32.egg\jcc\_jcc.pyd #15 0x64d9a0d4 in __initialize__(_object*, _object*, _object*) () from c:\Python27\lib\site-packages\jcc-2.6-py2.7-win32.egg\jcc\_jcc.pyd #16 0x1e013ff8 in python27!PyCFunction_Call () from C:\Windows\SysWOW64\python27.dll #17 0x0233ded0 in ?? () #18 0x01ddbdb0 in ?? () Backtrace stopped: previous frame inner to this frame (corrupt stack?) (gdb) A little googling tells me that this comes from allocating memory in one libc, and freeing it in a different one (different heaps). I see that _jcc.pyd is linked against LIBSTDC++-6.DLL and LIBGCC_S_DW2-1.DLL, and wonder if that could be the problem. Is there a way to eliminate those DLLs from my link? Here's the link line I'm using, somewhat elided to remove the long list of object files: $ C:\MinGW\bin\g++.exe -mno-cygwin -shared -s build\temp.win32-2.7\Release\jcc\sources\jcc.o [...] build\temp.win32-2.7\Release\_jcc\java\util\iterator.o build\temp.win32-2.7\Release\jcc\sources\_jcc.def -Lc:\Python27\libs -Lc:\Python27\PCbuild -lpython27 -lmsvcr90 -o build\lib.win32-2.7\jcc\_jcc.pyd "-LC:\Program Files (x86)\Java\jdk1.6.0_22/lib" -ljvm -Wl,--enable-auto-import -Wl,-S And here's a typical compile step: $ C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -D_java_generics -DJCC_VER="2.6" "-IC:\Program Files (x86)\Java\jdk1.6.0_22/include" "-IC:\Program Files (x86)\Java\jdk1.6.0_22/include/win32" -I_jcc -Ijcc/sources -Ic:\Python27\include -Ic:\Python27\PC -c _jcc\java\util\Enumeration.cpp -o build\temp.win32-2.7\Release\_jcc\java\util\enumeration.o -DPYTHON -fno-strict-aliasing -Wno-write-strings Bill |