Hi,

 

I'm not sure this could be of any help, but I have a pretty extensive palette of JNI DLLs… and thy are ALL written in C++ and compiled with mingw32-g++ (and even its 64bit version, i.e. x86_64-w64-mingw32-g++)! The headers generated by Java are fully compatible with C++ (no idea why you would stick to C).

 

Good luck,

 

Emanuel

 

De : Sultan Saini [mailto:javagrendel@gmail.com]
Envoyé : Sunday, 18 December, 2011 06:19
À : MinGW Users List
Objet : Re: [Mingw-users] Undefined references when linking with mingw32-gcc

 

Yes, I contemplated that. The thing is that I'd really rather not rewrite one of the jni source files in C++. It's currently using the C implementation of the JNI api. It feels like I'm missing something obvious and important that will fix this problem for me. I'm hoping someone is able to point it out.

 

-Sultan.

On Sat, Dec 17, 2011 at 11:51 PM, xunxun <xunxun1982@gmail.com> wrote:

Using mingw32-g++ please


On Sun, Dec 18, 2011 at 12:42 PM, Sultan Saini <javagrendel@gmail.com> wrote:
> Hello,
>
> I'm trying to build a small jni dll with mingw gcc and am having trouble
> during the linking step of the build.
>
> The linker command is thus:
>
> /c/MinGW/bin/mingw32-gcc.exe -w -fPIC -lstdc++ -shared -mwindows
> -LC:/MinGW/lib/glut -LC:/MinGW/lib/GLU -LC:/MinGW/lib/GL -lm
> -LC:/MinGW/lib/glib-2.0 -lopengl32 -lglu32 -lglut32 -lglib-2.0 build/gl2ps.o
> build/gl2psjni.o build/mathml2ps.o -o build/gl2psjni.dll
>
> Here is a list of undefined symbols from the individual object files:
> $ nm -C -u build/gl2ps.o
>          U _imp___iob
>          U cos
>          U ctime
>          U destroyEPSOutput
>          U fflush
>          U fprintf
>          U fputc
>          U free
>          U fwrite
>          U getEPS
>          U getFontDefinitionsMemSize
>          U glBegin@4
>          U glBitmap@28
>          U glEnd@0
>          U glFeedbackBuffer@12
>          U glGetBooleanv@8
>          U glGetFloatv@8
>          U glGetIntegerv@8
>          U glIsEnabled@4
>          U glPassThrough@4
>          U glRenderMode@4
>          U glVertex3f@12
>          U gmtime
>          U log10
>          U malloc
>          U popFontDefinitions
>          U pow
>          U qsort
>          U realloc
>          U sin
>          U sprintf
>          U sqrt
>          U strcpy
>          U strncpy
>          U time
>          U vfprintf
> $ nm -C -u build/gl2psjni.o
>          U fopen
>          U free
>          U gl2psBeginPage
>          U gl2psBeginViewport
>          U gl2psBlendFunc
>          U gl2psDisable
>          U gl2psDrawPixels
>          U gl2psEnable
>          U gl2psEndPage
>          U gl2psEndViewport
>          U gl2psGetFileExtension
>          U gl2psGetFormat
>          U gl2psGetFormatDescription
>          U gl2psGetOptions
>          U gl2psLineWidth
>          U gl2psMathML
>          U gl2psMathMLFooter
>          U gl2psMathMLHeader
>          U gl2psPointSize
>          U gl2psSetOptions
>          U gl2psSpecial
>          U gl2psText
>          U gl2psTextOpt
>          U malloc
>          U printf
>          U puts
> $ nm -C -u build/mathml2ps.o
>          U _Unwind_Resume
>          U std::string::find_last_not_of(char const*, unsigned int) const
>          U std::string::data() const
>          U std::string::find(char const*, unsigned int) const
>          U std::string::find(std::string const&, unsigned int) const
>          U std::string::size() const
>          U std::string::c_str() const
>          U std::string::length() const
>          U std::string::substr(unsigned int, unsigned int) const
>          U std::string::compare(char const*) const
>          U std::basic_ostringstream<char, std::char_traits<char>,
> std::allocator<char> >::str() const
>          U std::allocator<char>::allocator()
>          U std::allocator<char>::~allocator()
>          U std::string::erase(unsigned int, unsigned int)
>          U std::string::append(std::string const&)
>          U std::basic_string<char, std::char_traits<char>,
> std::allocator<char> >::basic_string(char const*, std::allocator<char>
> const&)
>          U std::basic_string<char, std::char_traits<char>,
> std::allocator<char> >::basic_string(std::string const&)
>          U std::basic_string<char, std::char_traits<char>,
> std::allocator<char> >::~basic_string()
>          U std::string::operator=(std::string const&)
>          U std::basic_ostringstream<char, std::char_traits<char>,
> std::allocator<char> >::basic_ostringstream(std::_Ios_Openmode)
>          U std::basic_ostringstream<char, std::char_traits<char>,
> std::allocator<char> >::~basic_ostringstream()
>          U std::ios_base::Init::Init()
>          U std::ios_base::Init::~Init()
>          U std::__throw_bad_alloc()
>          U std::__throw_length_error(char const*)
>          U operator delete(void*)
>          U operator new(unsigned int)
>          U __cxa_begin_catch
>          U __cxa_end_catch
>          U __cxa_rethrow
>          U __gxx_personality_v0
>          U _assert
>          U _imp___ZN10MathViewNS10fileExistsEPKc
>          U
> _imp___ZN10PS_Backend6createERK8SmartPtrI14AbstractLoggerERKS0_I13ConfigurationE
>          U _imp___ZN12FontDataBase6createEv
>          U _imp___ZN13Configuration16getBinaryVersionEv
>          U _imp___ZN13Configuration21getConfigurationPathsEv
>          U _imp___ZN13ConfigurationC1Ev
>          U _imp___ZN14AbstractLoggerC2Ev
>          U
> _imp___ZN15T1_FontDataBase6createERK8SmartPtrI14AbstractLoggerERKS0_I13ConfigurationEb
>          U _imp___ZN16libxml2_MathView10loadBufferEPKc
>          U
> _imp___ZN16libxml2_MathView17loadConfigurationERK8SmartPtrI14AbstractLoggerERKS0_I13ConfigurationERKSs
>          U
> _imp___ZN16libxml2_MathView22loadOperatorDictionaryERK8SmartPtrI14AbstractLoggerERKS0_I24MathMLOperatorDictionaryERKSs
>          U _imp___ZN16libxml2_MathView6createERK8SmartPtrI14AbstractLoggerE
>          U _imp___ZN17FormattingContextC1ERK8SmartPtrI17MathGraphicDeviceE
>          U _imp___ZN17FormattingContextD1Ev
>          U
> _imp___ZN22MathMLNamespaceContextC1ERK8SmartPtrI4ViewERKS0_I17MathGraphicDeviceE
>          U _imp___ZN24MathMLOperatorDictionaryC1Ev
>          U _imp___ZN25PS_StreamRenderingContext11documentEndEv
>          U
> _imp___ZN25PS_StreamRenderingContext13documentStartERK5fixedIiLi10EES3_RK11BoundingBoxPKc
>          U
> _imp___ZN25PS_StreamRenderingContextC1ERK8SmartPtrI14AbstractLoggerERSoS0_I12FontDataBaseE
>          U _imp___ZN25PS_StreamRenderingContextD1Ev
>          U _imp___ZN4View16resetRootElementEv
>          U _imp___ZN4View17setAvailableWidthERK5fixedIiLi10EE
>          U _imp___ZN4View18setDefaultFontSizeEj
>          U
> _imp___ZN4View21setOperatorDictionaryERK8SmartPtrI24MathMLOperatorDictionaryE
>          U
> _imp___ZN4View25setMathMLNamespaceContextERK8SmartPtrI22MathMLNamespaceContextE
>          U _imp___ZN4View27getDefaultConfigurationPathEv
>          U _imp___ZN4View32getDefaultOperatorDictionaryPathEv
>          U _imp___ZNK13Configuration13getStringListERKSs
>          U
> _imp___ZNK13Configuration6getIntERK8SmartPtrI14AbstractLoggerERKSsi
>          U
> _imp___ZNK13Configuration9getStringERK8SmartPtrI14AbstractLoggerERKSsS6_
>          U _imp___ZNK14AbstractLogger11setLogLevelE10LogLevelId
>          U _imp___ZNK14AbstractLogger3outE10LogLevelIdPKcz
>          U _imp___ZNK4View14getBoundingBoxEv
>          U _imp___ZNK4View6renderER16RenderingContextRK5fixedIiLi10EES5_
>          U _imp___ZTV6Logger
>          U atexit
>          U free
>          U malloc
>          U strcat
>          U strcpy
>          U strdup
>          U strncpy
>          U strtof
>          U strtok
>
> What is very confusing is all the undefined references from the stdc++
> library and standard C functions (malloc, strcat etc).
>
> I must be missing something, because there are also undefined references
> even between these objects. For instance, gl2psjni.o has undefined
> references that *should* be there from gl2ps.o (gl2psBeginPage,
> gl2psBeginViewport etc).
>
> Any insights would be greatly appreciated, and many thanks in advance for
> taking the time to read this.
>
> -Sultan.
>



--
Best Regards,
xunxun

------------------------------------------------------------------------------
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for
developers. It will provide a great way to learn Windows Azure and what it
provides. You can attend the event by watching it streamed LIVE online.
Learn more at http://p.sf.net/sfu/ms-windowsazure
_______________________________________________
MinGW-users mailing list
MinGW-users@lists.sourceforge.net

This list observes the Etiquette found at
http://www.mingw.org/Mailing_Lists.
We ask that you be polite and do the same.  Disregard for the list etiquette may cause your account to be moderated.

_______________________________________________
You may change your MinGW Account Options or unsubscribe at:
https://lists.sourceforge.net/lists/listinfo/mingw-users
Also: mailto:mingw-users-request@lists.sourceforge.net?subject=unsubscribe



 

--
-sultan