You are viewing a plain text version of this content. The canonical link for it is here.
Posted to pylucene-dev@lucene.apache.org by Baseer Khan <ba...@yahoo.com> on 2011/05/19 06:26:08 UTC

Need help building JCC on windows

I don't seem to resolve the undefined reference issue while building JCC on windows 7 using Mingw32 compiler.

Any help?

C:\glassfish3\jdk
running install
running bdist_egg
running egg_info
writing JCC.egg-info\PKG-INFO
writing top-level names to JCC.egg-info\top_level.txt
writing dependency_links to JCC.egg-info\dependency_links.txt
reading manifest template 'MANIFEST.in'
writing manifest file 'JCC.egg-info\SOURCES.txt'
installing library code to build\bdist.win32\egg
running install_lib
running build_py
writing C:\Users\baseer\devenv\jcc\jcc\config.py
copying jcc\config.py -> build\lib.win32-2.7\jcc
copying jcc\cpp.py -> build\lib.win32-2.7\jcc
copying jcc\python.py -> build\lib.win32-2.7\jcc
copying jcc\windows.py ->
 build\lib.win32-2.7\jcc
copying jcc\__init__.py -> build\lib.win32-2.7\jcc
copying jcc\__main__.py -> build\lib.win32-2.7\jcc
copying jcc\sources\functions.cpp -> build\lib.win32-2.7\jcc\sources
copying jcc\sources\JArray.cpp -> build\lib.win32-2.7\jcc\sources
copying jcc\sources\jcc.cpp -> build\lib.win32-2.7\jcc\sources
copying jcc\sources\JCCEnv.cpp -> build\lib.win32-2.7\jcc\sources
copying jcc\sources\JObject.cpp -> build\lib.win32-2.7\jcc\sources
copying jcc\sources\types.cpp -> build\lib.win32-2.7\jcc\sources
copying jcc\sources\functions.h -> build\lib.win32-2.7\jcc\sources
copying jcc\sources\JArray.h -> build\lib.win32-2.7\jcc\sources
copying jcc\sources\JCCEnv.h -> build\lib.win32-2.7\jcc\sources
copying jcc\sources\jccfuncs.h -> build\lib.win32-2.7\jcc\sources
copying jcc\sources\JObject.h -> build\lib.win32-2.7\jcc\sources
copying jcc\sources\macros.h ->
 build\lib.win32-2.7\jcc\sources
copying jcc\patches\patch.4195 -> build\lib.win32-2.7\jcc\patches
copying jcc\patches\patch.43.0.6c11 -> build\lib.win32-2.7\jcc\patches
copying jcc\patches\patch.43.0.6c7 -> build\lib.win32-2.7\jcc\patches
copying jcc\jcc.lib -> build\lib.win32-2.7\jcc
copying jcc\classes\org\apache\jcc\PythonVM.class -> build\lib.win32-2.7\jcc\cla
sses\org\apache\jcc
copying jcc\classes\org\apache\jcc\PythonException.class -> build\lib.win32-2.7\
jcc\classes\org\apache\jcc
running build_ext
building 'jcc' extension
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -D_jcc_lib -DJCC_VER="2.8" -IC:\
glassfish3\jdk/include -IC:\glassfish3\jdk/include/win32 -I_jcc -Ijcc/sources -I
C:\Python27\include -IC:\Python27\PC -c jcc/sources/jcc.cpp -o build\temp.win32-
2.7\Release\jcc\sources\jcc.o -DPYTHON -D_JNI_IMPLEMENTATION_ -fno-strict-aliasi
ng
 -Wno-write-strings
C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -D_jcc_lib -DJCC_VER="2.8" -IC:\
glassfish3\jdk/include -IC:\glassfish3\jdk/include/win32 -I_jcc -Ijcc/sources -I
C:\Python27\include -IC:\Python27\PC -c jcc/sources/JCCEnv.cpp -o build\temp.win
32-2.7\Release\jcc\sources\jccenv.o -DPYTHON -D_JNI_IMPLEMENTATION_ -fno-strict-
aliasing -Wno-write-strings
writing build\temp.win32-2.7\Release\jcc\sources\jcc.def
C:\MinGW\bin\g++.exe -mno-cygwin -shared -Wl,--out-implib,build\lib.win32-2.7\jc
c\jcc.lib -s build\temp.win32-2.7\Release\jcc\sources\jcc.o build\temp.win32-2.7
\Release\jcc\sources\jccenv.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.dll -LC:\glassfish3\jdk/lib -ljvm -Wl,-S -Wl,--out-implib,jcc\jcc.lib
Creating library file:
 jcc\jcc.lib
build\temp.win32-2.7\Release\jcc\sources\jcc.o:jcc.cpp:(.text+0xc30): undefined
reference to `JNI_GetDefaultJavaVMInitArgs@4'
build\temp.win32-2.7\Release\jcc\sources\jcc.o:jcc.cpp:(.text+0xed0): undefined
reference to `JNI_CreateJavaVM@12'
collect2: ld returned 1 exit status
error: command 'g++' failed with exit status 1

RE: Need help building JCC on windows

Posted by Thomas Koch <ko...@orbiteam.de>.
Dear Baseer,
I've never tried with Mingw32 but succeeded in a built with the Microsoft
Visual Studio (Express 9.0) on Win7/32bit. Eggs are available for download
at
http://code.google.com/p/pylucene-win32-binary/downloads/list

If you're only looking for JCC - version 2.6 is available for download. If
you need a more recent version I can try to build and upload. 

Of course that doesn't help you with the Mingw issue. Maybe someone else has
more experience with that one...

Regards,
Thomas
--
OrbiTeam Software GmbH & Co. KG
Endenicher Allee 35
53121 Bonn 
Germany
http://www.orbiteam.de



> -----Original Message-----
> From: Baseer Khan [mailto:baseer@yahoo.com]
> Sent: Thursday, May 19, 2011 6:26 AM
> To: pylucene-dev@lucene.apache.org
> Subject: Need help building JCC on windows
> 
> I don't seem to resolve the undefined reference issue while building JCC
on
> windows 7 using Mingw32 compiler.
> 
> Any help?
> 
> C:\glassfish3\jdk
> running install
> running bdist_egg
> running egg_info
> writing JCC.egg-info\PKG-INFO
> writing top-level names to JCC.egg-info\top_level.txt
> writing dependency_links to JCC.egg-info\dependency_links.txt
> reading manifest template 'MANIFEST.in'
> writing manifest file 'JCC.egg-info\SOURCES.txt'
> installing library code to build\bdist.win32\egg
> running install_lib
> running build_py
> writing C:\Users\baseer\devenv\jcc\jcc\config.py
> copying jcc\config.py -> build\lib.win32-2.7\jcc
> copying jcc\cpp.py -> build\lib.win32-2.7\jcc
> copying jcc\python.py -> build\lib.win32-2.7\jcc
> copying jcc\windows.py ->
>  build\lib.win32-2.7\jcc
> copying jcc\__init__.py -> build\lib.win32-2.7\jcc
> copying jcc\__main__.py -> build\lib.win32-2.7\jcc
> copying jcc\sources\functions.cpp -> build\lib.win32-2.7\jcc\sources
> copying jcc\sources\JArray.cpp -> build\lib.win32-2.7\jcc\sources
> copying jcc\sources\jcc.cpp -> build\lib.win32-2.7\jcc\sources
> copying jcc\sources\JCCEnv.cpp -> build\lib.win32-2.7\jcc\sources
> copying jcc\sources\JObject.cpp -> build\lib.win32-2.7\jcc\sources
> copying jcc\sources\types.cpp -> build\lib.win32-2.7\jcc\sources
> copying jcc\sources\functions.h -> build\lib.win32-2.7\jcc\sources
> copying jcc\sources\JArray.h -> build\lib.win32-2.7\jcc\sources
> copying jcc\sources\JCCEnv.h -> build\lib.win32-2.7\jcc\sources
> copying jcc\sources\jccfuncs.h -> build\lib.win32-2.7\jcc\sources
> copying jcc\sources\JObject.h -> build\lib.win32-2.7\jcc\sources
> copying jcc\sources\macros.h ->
>  build\lib.win32-2.7\jcc\sources
> copying jcc\patches\patch.4195 -> build\lib.win32-2.7\jcc\patches
> copying jcc\patches\patch.43.0.6c11 -> build\lib.win32-2.7\jcc\patches
> copying jcc\patches\patch.43.0.6c7 -> build\lib.win32-2.7\jcc\patches
> copying jcc\jcc.lib -> build\lib.win32-2.7\jcc
> copying jcc\classes\org\apache\jcc\PythonVM.class -> build\lib.win32-
> 2.7\jcc\cla
> sses\org\apache\jcc
> copying jcc\classes\org\apache\jcc\PythonException.class ->
build\lib.win32-
> 2.7\
> jcc\classes\org\apache\jcc
> running build_ext
> building 'jcc' extension
> C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -D_jcc_lib -DJCC_VER="2.8"
-
> IC:\
> glassfish3\jdk/include -IC:\glassfish3\jdk/include/win32 -I_jcc
-Ijcc/sources
> -I
> C:\Python27\include -IC:\Python27\PC -c jcc/sources/jcc.cpp -o
> build\temp.win32-
> 2.7\Release\jcc\sources\jcc.o -DPYTHON -D_JNI_IMPLEMENTATION_ -fno-strict-
> aliasi
> ng
>  -Wno-write-strings
> C:\MinGW\bin\gcc.exe -mno-cygwin -mdll -O -Wall -D_jcc_lib -DJCC_VER="2.8"
-
> IC:\
> glassfish3\jdk/include -IC:\glassfish3\jdk/include/win32 -I_jcc
-Ijcc/sources
> -I
> C:\Python27\include -IC:\Python27\PC -c jcc/sources/JCCEnv.cpp -o
> build\temp.win
> 32-2.7\Release\jcc\sources\jccenv.o -DPYTHON -D_JNI_IMPLEMENTATION_ -fno-
> strict-
> aliasing -Wno-write-strings
> writing build\temp.win32-2.7\Release\jcc\sources\jcc.def
> C:\MinGW\bin\g++.exe -mno-cygwin -shared -Wl,--out-implib,build\lib.win32-
> 2.7\jc
> c\jcc.lib -s build\temp.win32-2.7\Release\jcc\sources\jcc.o
build\temp.win32-
> 2.7
> \Release\jcc\sources\jccenv.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.dll -LC:\glassfish3\jdk/lib -ljvm -Wl,-S
-Wl,--out-implib,jcc\jcc.lib
> Creating library file:
>  jcc\jcc.lib
> build\temp.win32-2.7\Release\jcc\sources\jcc.o:jcc.cpp:(.text+0xc30):
> undefined
> reference to `JNI_GetDefaultJavaVMInitArgs@4'
> build\temp.win32-2.7\Release\jcc\sources\jcc.o:jcc.cpp:(.text+0xed0):
> undefined
> reference to `JNI_CreateJavaVM@12'
> collect2: ld returned 1 exit status
> error: command 'g++' failed with exit status 1



Re: Need help building JCC on windows

Posted by Bill Janssen <ja...@parc.com>.
Hi, Baseer.  Not sure what's the issue with your build, but here's a bit
of bash script which I use to build JCC with mingw on Windows:

echo "-- jcc --"
export PATH="$PATH:${javahome}/jre/bin/client"
echo "PATH is $PATH"
cd ../pylucene-3.0.*/jcc
# note that this patch still works for 3.0.1/3.0.2
patch -p0 < ${patchesdir}/jcc-2.9-mingw-PATCH
export JCC_ARGSEP=";"
export JCC_JDK="$WINSTYLEJAVAHOME"
export JCC_CFLAGS="-fno-strict-aliasing;-Wno-write-strings"
export JCC_LFLAGS="-L${WINSTYLEJAVAHOME}\\lib;-ljvm"
export JCC_INCLUDES="${WINSTYLEJAVAHOME}\\include;${WINSTYLEJAVAHOME}\\include\\win32"
export JCC_JAVAC="${WINSTYLEJAVAHOME}\\bin\\javac.exe"
${python} setup.py build --compiler=mingw32 install --single-version-externally-managed --root /c/ --prefix="${distdir}"
if [ -f jcc/jcc.lib ]; then
  cp -p jcc/jcc.lib "${sitepackages}/jcc/jcc.lib"
fi
# for 3.0.2 compiled with MinGW GCC 4.x and "--shared", we also need two
# GCC libraries
if [ -f /mingw/bin/libstdc++-6.dll ]; then
  install -m 555 /mingw/bin/libstdc++-6.dll "${distdir}/bin/"
  echo "copied libstdc++-6.dll"
fi
if [ -f /mingw/bin/libgcc_s_dw2-1.dll ]; then
  install -m 555 /mingw/bin/libgcc_s_dw2-1.dll "${distdir}/bin/"
  echo "copied libgcc_s_dw2-1.dll"
fi


The patch that I apply is this:

*** setup.py	2009-10-28 15:24:16.000000000 -0700
--- setup.py	2010-03-29 22:08:56.000000000 -0700
***************
*** 262,268 ****
          elif platform == 'win32':
              jcclib = 'jcc%s.lib' %(debug and '_d' or '')
              kwds["extra_link_args"] = \
!                 lflags + ["/IMPLIB:%s" %(os.path.join('jcc', jcclib))]
              package_data.append(jcclib)
          else:
              kwds["extra_link_args"] = lflags
--- 262,268 ----
          elif platform == 'win32':
              jcclib = 'jcc%s.lib' %(debug and '_d' or '')
              kwds["extra_link_args"] = \
!                 lflags + ["-Wl,--out-implib,%s" %(os.path.join('jcc', jcclib))]
              package_data.append(jcclib)
          else:
              kwds["extra_link_args"] = lflags

It makes sure to build the jcc.lib file so that I can use it in "shared" mode.

Bill