From: Danny S. <dan...@cl...> - 2007-08-17 07:48:41
|
> -----Original Message----- > From: min...@li... > [mailto:min...@li...] On Behalf Of JonY > Sent: Friday, 17 August 2007 7:03 p.m. > To: MinGW Users List > Subject: [Mingw-users] Problem building ImageMagick++ <snip> > const&)]+0x4): undefined reference to `__imp___ZTVSt9exception > ' > collect2: ld returned 1 exit status > > The only manually added library is libstdc++, which doesn't work. > However, linking to libstdc++_s works, but makes resulting > c++ programs > fail to start, with "Application failed to initialize > 0x00000005." error. > > Can somebody explain? Perhaps if you explained what you did in sufficient detail so that others could reproduce the problem somebody might be able to explain. For starters, what was your command line? Danny |
From: Danny S. <dan...@cl...> - 2007-08-18 07:13:47
|
> -----Original Message----- > From: min...@li... > [mailto:min...@li...] On Behalf Of JonY > Sent: Saturday, 18 August 2007 2:29 p.m. > To: min...@li... > Subject: Re: [Mingw-users] Problem building ImageMagick++ > > > Creating library file: > Magick++/lib/.libs/libMagick++.dll.aMagick++/lib/.libs/Excepti > on.o: In > function `Exception': > f:\sources\ImageMagick-6.3.5/Magick++/lib/Exception.cpp:29: undefined > reference to `__imp___ZNSt9exceptionD2Ev' Who is telling libsdc++ headers to dllimport libstdc++ exports? How was your compiler built? What does g++ -v say? Danny |
From: JonY <10...@gm...> - 2007-08-18 07:38:14
|
Danny Smith wrote: >> -----Original Message----- >> From: min...@li... >> [mailto:min...@li...] On Behalf Of JonY >> Sent: Saturday, 18 August 2007 2:29 p.m. >> To: min...@li... >> Subject: Re: [Mingw-users] Problem building ImageMagick++ >> >> > >> Creating library file: >> Magick++/lib/.libs/libMagick++.dll.aMagick++/lib/.libs/Excepti >> on.o: In >> function `Exception': >> f:\sources\ImageMagick-6.3.5/Magick++/lib/Exception.cpp:29: undefined >> reference to `__imp___ZNSt9exceptionD2Ev' > > > Who is telling libsdc++ headers to dllimport libstdc++ exports? > How was your compiler built? What does g++ -v say? > > Danny > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > MinGW-users mailing list > Min...@li... > > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users > The older "gcc version 3.4.5 (mingw special)" was used to build gcc 4, the one from sourceforge. $ g++ -v Reading specs from c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1/specs Target: i686-pc-mingw32 Configured with: ../gcc-4.2.1-2-src/configure --enable-languages=c,ada,c++,fortran,java,objc,obj-c++ --prefix=/mingw --disable-rpath --enable-static --enable-shared --enable-c99 --enable-long-long --enable-bootstrap --enable-hash-syncronization --enable-libgcj --enable-libssp --enable-libgomp --enable-threads=win32 --disable-werror --with-dwarf2 --with-win32-nlsapi=unicode --disable-werror --disable-win32-registry --disable-sjlj-exceptions --enable-libstdcxx-debug --enable-version-specific-runtime-libs --enable-bootstrap --with-gcc --enable-c-flags=-g -O3 -D__USE_MINGW_ACCESS -pipe --enable-cxx-flags=-g -O3 -D__USE_MINGW_ACCESS -mthreads -pipe --enable-gcj-flags=-O0 -pipe Thread model: win32 gcc version 4.2.1 (mingw32-2) I used a slightly modified gcc-4.2.1-build-dw2-2.sh script to run the gcc configure, hope you don't mind. I enabled bootstrap to make sure gcc was compiled properly. The specs file is unmodified from the "gcc -dumpspecs". The only modification I did to gcc was changing the Baseversion file so it emits only 4.2.1 when given the -dumpversion command. Also, since __imp___ZNSt9exceptionD2Ev is only found in libstdc++_s, does this mean the shared and static versions have different headers? I'll try to rebuild gcc with the default script this weekend to see if it changes anything. |
From: Danny S. <dan...@cl...> - 2007-08-18 08:06:43
|
> Also, since __imp___ZNSt9exceptionD2Ev is only found in libstdc++_s, > does this mean the shared and static versions have different headers? sortof In lib/gcc/mingw32/4.2.1-dw2/include/bits/mingw32/os_defines.h (or your more standard path to c++ headers): #ifdef _DLL #define _GLIBCXX_IMPORT __attribute__((dllimport)) #else #define _GLIBCXX_IMPORT #endif and the header <exception> should have class _GLIBCXX_IMPORT exception Is _DLL defined anyway in your project? Maybe os_defines.h should use _GLIBCXX_DLL instead of the MSVC++ prior art _DLL If you really want to link against libstdc++_s.dll (with dwarf2), you will also need to add -shared-libgcc to compiler switches. I know it is messy, but current binutils does not handle 'weak' symbols in dll's as one might expect, and -shared-libgcc has the effect of making the undefined references to dwarf2 table registration strong. Anyway, thanks very much for testing. It is appreciated. Danny |
From: JonY <10...@gm...> - 2007-08-18 11:05:33
|
Danny Smith wrote: >> Also, since __imp___ZNSt9exceptionD2Ev is only found in libstdc++_s, >> does this mean the shared and static versions have different headers? > > sortof > In lib/gcc/mingw32/4.2.1-dw2/include/bits/mingw32/os_defines.h (or your > more standard path to c++ headers): > > #ifdef _DLL > #define _GLIBCXX_IMPORT __attribute__((dllimport)) > #else > #define _GLIBCXX_IMPORT > #endif > > > and the header <exception> should have > class _GLIBCXX_IMPORT exception > > Is _DLL defined anyway in your project? > Maybe os_defines.h should use _GLIBCXX_DLL instead of the MSVC++ prior > art _DLL > > If you really want to link against libstdc++_s.dll (with dwarf2), you > will also need to add -shared-libgcc to compiler switches. > I know it is messy, but current binutils does not handle 'weak' symbols > in dll's as one might expect, and -shared-libgcc has the effect of > making the undefined references to dwarf2 table registration strong. > > Anyway, thanks very much for testing. It is appreciated. > > Danny > > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > MinGW-users mailing list > Min...@li... > > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users > Hey, removing -D_DLL from ImageMagick top level makefile solves the problem, not only the missing symbols problem, programs now initialize properly. It now links properly to the static libstdc++. It wasn't my intention to link to libstdc++_s, I guess ImageMagick uses it for some internal purposes and got messed up with the C++ libraries. Maybe _DLL should be renamed to something less generic? Thanks, Danny. |
From: Danny S. <dan...@cl...> - 2007-08-18 11:24:49
|
> -----Original Message----- > From: min...@li... > [mailto:min...@li...] On Behalf Of JonY > > Hey, > > removing -D_DLL from ImageMagick top level makefile solves > the problem, > not only the missing symbols problem, programs now initialize > properly. > It now links properly to the static libstdc++. > > It wasn't my intention to link to libstdc++_s, I guess > ImageMagick uses > it for some internal purposes and got messed up with the C++ > libraries. > Maybe _DLL should be renamed to something less generic? Cool. Unless there are objections, it shall be _GLIBCXX_DLL in next update. I'm still curious about "Application failed to initialize 0x00000005." when using shared libstdc++. D > > Thanks, Danny. > > -------------------------------------------------------------- > ----------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and > a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > MinGW-users mailing list > Min...@li... > > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users > |
From: JonY <10...@gm...> - 2007-08-18 12:33:07
|
Danny Smith wrote: > > > Cool. Unless there are objections, it shall be _GLIBCXX_DLL in next > update. > > I'm still curious about "Application failed to initialize 0x00000005." > when using shared libstdc++. > > D Hi, I guess _GLIBCXX_DLL is cool, doesn't sound like anything I've encountered before. About the runtime error, is it possible that a mixture of static libgcc + shared libstdc++_s caused this? I added -lstdc++_s but not -shared-libgcc after g++, which caused linking to be successful, but fail at runtime (before I put fixed libtool.) |
From: JonY <10...@gm...> - 2007-08-17 08:46:36
|
Danny Smith wrote: > >> -----Original Message----- >> From: min...@li... >> [mailto:min...@li...] On Behalf Of JonY >> Sent: Friday, 17 August 2007 7:03 p.m. >> To: MinGW Users List >> Subject: [Mingw-users] Problem building ImageMagick++ > <snip> >> const&)]+0x4): undefined reference to `__imp___ZTVSt9exception >> ' >> collect2: ld returned 1 exit status >> >> The only manually added library is libstdc++, which doesn't work. >> However, linking to libstdc++_s works, but makes resulting >> c++ programs >> fail to start, with "Application failed to initialize >> 0x00000005." error. >> >> Can somebody explain? > > > Perhaps if you explained what you did in sufficient detail so that > others could reproduce the problem somebody might be able to explain. > > For starters, what was your command line? > > Danny > > Sorry, my bad, here's the link command from libtool, nothing out of the ordinary, except the manaully added libstdc++. I am using gcc 4.2.1-2-dw2. gcc -shared Magick++/lib/.libs/Blob.o Magick++/lib/.libs/BlobRef.o Magick++/lib/.libs/CoderInfo.o Magick++/lib/.libs/Color.o Magick++/lib/.libs/Drawable.o Magick++/lib/.libs/Exception.o Magick++/lib/.libs/Functions.o Magick++/lib/.libs/Geometry.o Magick++/lib/.libs/Image.o Magick++/lib/.libs/ImageRef.o Magick++/lib/.libs/Montage.o Magick++/lib/.libs/Options.o Magick++/lib/.libs/Pixels.o Magick++/lib/.libs/STL.o Magick++/lib/.libs/Thread.o Magick++/lib/.libs/TypeMetric.o -L/f/sources/ImageMagick-6.3.5/magick/.libs -L/mingw/lib /mingw/lib/libfreetype.dll.a -lz magick/.libs/libMagick.dll.a -Lc:/mingw/lib wand/.libs/libWand.dll.a /mingw/lib/gcc/i686-pc-mingw32/4.2.1/libstdc++.a -o Magick++/lib/.libs/libMagick++-10.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker Magick++/lib/.libs/libMagick++.dll.a My internet connection has some problems, ignore if this message is a duplicate. |
From: JonY <10...@gm...> - 2007-08-17 17:14:03
|
JonY wrote: > Danny Smith wrote: >> >>> -----Original Message----- >>> From: min...@li... >>> [mailto:min...@li...] On Behalf Of JonY >>> Sent: Friday, 17 August 2007 7:03 p.m. >>> To: MinGW Users List >>> Subject: [Mingw-users] Problem building ImageMagick++ >> <snip> >>> const&)]+0x4): undefined reference to `__imp___ZTVSt9exception >>> ' >>> collect2: ld returned 1 exit status >>> >>> The only manually added library is libstdc++, which doesn't work. >>> However, linking to libstdc++_s works, but makes resulting c++ >>> programs fail to start, with "Application failed to initialize >>> 0x00000005." error. >>> >>> Can somebody explain? >> >> >> Perhaps if you explained what you did in sufficient detail so that >> others could reproduce the problem somebody might be able to explain. >> >> For starters, what was your command line? >> >> Danny >> >> > Sorry, my bad, here's the link command from libtool, nothing out of the > ordinary, except the manaully added libstdc++. I am using gcc 4.2.1-2-dw2. > > gcc -shared Magick++/lib/.libs/Blob.o Magick++/lib/.libs/BlobRef.o > Magick++/lib/.libs/CoderInfo.o Magick++/lib/.libs/Color.o > Magick++/lib/.libs/Drawable.o Magick++/lib/.libs/Exception.o > Magick++/lib/.libs/Functions.o Magick++/lib/.libs/Geometry.o > Magick++/lib/.libs/Image.o > Magick++/lib/.libs/ImageRef.o Magick++/lib/.libs/Montage.o > Magick++/lib/.libs/Options.o Magick++/lib/.libs/Pixels.o > Magick++/lib/.libs/STL.o > Magick++/lib/.libs/Thread.o Magick++/lib/.libs/TypeMetric.o > -L/f/sources/ImageMagick-6.3.5/magick/.libs -L/mingw/lib > /mingw/lib/libfreetype.dll.a > -lz magick/.libs/libMagick.dll.a -Lc:/mingw/lib wand/.libs/libWand.dll.a > /mingw/lib/gcc/i686-pc-mingw32/4.2.1/libstdc++.a -o > Magick++/lib/.libs/libMagick++-10.dll -Wl,--enable-auto-image-base > -Xlinker --out-implib -Xlinker Magick++/lib/.libs/libMagick++.dll.a > > My internet connection has some problems, ignore if this message is a > duplicate. > Hmm, I am beginning to think that there is some miscommunication, by "my bad", I mean I forgot to include more details, I haven't found out what is wrong yet. The gcc I used is from gcc-4.2.1-2-src.tar.gz from sourceforge. Any idea what caused the errors? |
From: Ralf W. <Ral...@gm...> - 2007-08-17 18:40:31
|
* JonY wrote on Fri, Aug 17, 2007 at 10:45:39AM CEST: > > gcc -shared Magick++/lib/.libs/Blob.o Magick++/lib/.libs/BlobRef.o [...] Why is not g++ used for linking? Did you use ./configure CXX=gcc instead of ./configure CXX=g++ and if not, could you find out how gcc came to be used? What says ./libtool --tag=CXX --config | grep ^CC and does the link command for this library even use --tag=CXX? > Magick++/lib/.libs/Thread.o Magick++/lib/.libs/TypeMetric.o > -L/f/sources/ImageMagick-6.3.5/magick/.libs -L/mingw/lib > /mingw/lib/libfreetype.dll.a > -lz magick/.libs/libMagick.dll.a -Lc:/mingw/lib wand/.libs/libWand.dll.a > /mingw/lib/gcc/i686-pc-mingw32/4.2.1/libstdc++.a -o > Magick++/lib/.libs/libMagick++-10.dll -Wl,--enable-auto-image-base > -Xlinker --out-implib -Xlinker Magick++/lib/.libs/libMagick++.dll.a Cheers, Ralf |
From: JonY <10...@gm...> - 2007-08-18 02:30:22
|
Ralf Wildenhues wrote: > * JonY wrote on Fri, Aug 17, 2007 at 10:45:39AM CEST: >> gcc -shared Magick++/lib/.libs/Blob.o Magick++/lib/.libs/BlobRef.o > [...] > > Why is not g++ used for linking? Did you use > ./configure CXX=gcc > > instead of > ./configure CXX=g++ > > and if not, could you find out how gcc came to be used? What says > ./libtool --tag=CXX --config | grep ^CC > > and does the link command for this library even use --tag=CXX? > >> Magick++/lib/.libs/Thread.o Magick++/lib/.libs/TypeMetric.o >> -L/f/sources/ImageMagick-6.3.5/magick/.libs -L/mingw/lib >> /mingw/lib/libfreetype.dll.a >> -lz magick/.libs/libMagick.dll.a -Lc:/mingw/lib wand/.libs/libWand.dll.a >> /mingw/lib/gcc/i686-pc-mingw32/4.2.1/libstdc++.a -o >> Magick++/lib/.libs/libMagick++-10.dll -Wl,--enable-auto-image-base >> -Xlinker --out-implib -Xlinker Magick++/lib/.libs/libMagick++.dll.a > > Cheers, > Ralf > > ------------------------------------------------------------------------- > This SF.net email is sponsored by: Splunk Inc. > Still grepping through log files to find problems? Stop. > Now Search log events and configuration files using AJAX and a browser. > Download your FREE copy of Splunk now >> http://get.splunk.com/ > _______________________________________________ > MinGW-users mailing list > Min...@li... > > You may change your MinGW Account Options or unsubscribe at: > https://lists.sourceforge.net/lists/listinfo/mingw-users > It seems libtool is fault here, $ ./libtool --tag=CXX --config libtool: ignoring unknown tag CXX # Libtool was configured on host JONY: # Shell to use when invoking shell scripts. ....... The rest is found here http://pastebin.com/m104d0f65 I then replaced libtool with the locally installed one, now it links libstdc++ automatically, but I still get even after "make clean all": g++ -shared -nostdlib c:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1/../../../dllcrt2.o Magick++/lib/.libs/Blob.o Magick++/lib/.libs/BlobRef.o Magick++/lib/.libs/CoderInfo.o Magick++/lib/.libs/Color.o Magick++/lib/.libs/Drawable.o Magick++/lib/.libs/Exception.o Magick++/lib/.libs/Functions.o Magick++/lib/.libs/Geometry.o Magick++/lib/.libs/Image.o Magick++/lib/.libs/ImageRef.o Magick++/lib/.libs/Montage.o Magick++/lib/.libs/Options.o Magick++/lib/.libs/Pixels.o Magick++/lib/.libs/STL.o Magick++/lib/.libs/Thread.o Magick++/lib/.libs/TypeMetric.o -L/f/sources/ImageMagick-6.3.5/magick/.libs -L/mingw/lib /mingw/lib/libfreetype.dll.a -lz magick/.libs/libMagick.dll.a -Lc:/mingw/lib wand/.libs/libWand.dll.a -Lc:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1 -Lc:/mingw/bin/../lib/gcc -Lc:/mingw/lib/gcc/i686-pc-mingw32/4.2.1 -Lc:/mingw/bin/../lib/gcc/i686-pc-mingw32/4.2.1/../../.. -Lc:/mingw/lib/gcc/i686-pc-mingw32/4.2.1/../../.. -lstdc++ -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -luser32 -lkernel32 -ladvapi32 -lshell32 -lmingw32 -lgcc -lmoldname -lmingwex -lmsvcrt -o Magick++/lib/.libs/libMagick++-10.dll -Wl,--enable-auto-image-base -Xlinker --out-implib -Xlinker Magick++/lib/.libs/libMagick++.dll.a Creating library file: Magick++/lib/.libs/libMagick++.dll.aMagick++/lib/.libs/Exception.o: In function `Exception': f:\sources\ImageMagick-6.3.5/Magick++/lib/Exception.cpp:29: undefined reference to `__imp___ZNSt9exceptionD2Ev' f:\sources\ImageMagick-6.3.5/Magick++/lib/Exception.cpp:23: undefined reference to `__imp___ZNSt9exceptionD2Ev' f:\sources\ImageMagick-6.3.5/Magick++/lib/Exception.cpp:23: undefined reference to `__imp___ZNSt9exceptionD2Ev' f:\sources\ImageMagick-6.3.5/Magick++/lib/Exception.cpp:29: undefined reference to `__imp___ZNSt9exceptionD2Ev' Magick++/lib/.libs/Exception.o: In function `~Exception': f:\sources\ImageMagick-6.3.5/Magick++/lib/Exception.cpp:50: undefined reference to `__imp___ZNSt9exceptionD2Ev' Magick++/lib/.libs/Exception.o:f:\sources\ImageMagick-6.3.5/Magick++/lib/Exception.cpp:50: more undefined references to `__imp___ZNSt9exceptionD2Ev' follow collect2: ld returned 1 exit status make: *** [Magick++/lib/libMagick++.la] Error 1 At first I thought g++ was miscompiled, then, I saw ilmbase and OpenEXR (both C++ apps) working perfectly well. |