From: Lutz H. <lut...@li...> - 2011-08-30 14:29:11
|
I need to link against a 3rd-party binary-only library that was produced with the Visual Studio compiler. All exported symbols The The library is compiled for 64 bit windows (x64). The header files are C, not C++, therefore name mangling should not be an issue. When I compile test programs with the x64 VC++-Compiler from the Windows SDK (7.1) and link against this library, all is well. But I'd rather use MinGW. I'm porting code from 32 bit MinGW and mixing a VC++ library and MinGW was straightforward on that architecture. When I compile the same test programs with MinGW-W64, I add the *.lib file to the end of the command line, and then I get a ton of errors like this: g++ -I. -L. murxtest.cpp libmurx_windows_x64.lib libmurx_windows_x64.lib(murx60.obj):(.text+0x6): undefined reference to `__chkstk'. How can I convince the linker into linking to the correct implementation of __chkstk for a VC++ compiled 64bit C library? I have tried the following distributions of MinGW-W64: tdm64-gcc-4.5.2.exe x86_64-w64-mingw32-gcc-4.6.2-2-rubenvb.7z |
From: Lutz H. <lut...@li...> - 2011-08-30 14:38:04
|
(Reposted to remove 1 line of garbage) I need to link against a 3rd-party binary-only library that was produced with the Visual Studio compiler. The library is compiled for 64 bit windows (x64). The header files are C, not C++, therefore name mangling should not be an issue. When I compile test programs with the x64 VC++-Compiler from the Windows SDK (7.1) and link against this library, all is well. But I'd rather use MinGW. I'm porting code from 32 bit MinGW and mixing a VC++ library and MinGW was straightforward on that architecture. When I compile the same test programs with MinGW-W64, I add the *.lib file to the end of the command line, and then I get a ton of errors like this: g++ -I. -L. murxtest.cpp libmurx_windows_x64.lib libmurx_windows_x64.lib(murx60.obj):(.text+0x6): undefined reference to `__chkstk'. How can I convince the linker into linking to the correct implementation of __chkstk for a VC++ compiled 64bit C library? I have tried the following distributions of MinGW-W64: tdm64-gcc-4.5.2.exe x86_64-w64-mingw32-gcc-4.6.2-2-rubenvb.7z |
From: Kai T. <kti...@go...> - 2011-08-30 14:47:40
|
2011/8/30 Lutz Hayen <lut...@li...>: > > (Reposted to remove 1 line of garbage) > > I need to link against a 3rd-party binary-only library that > was produced with the Visual Studio compiler. > > The library is compiled for 64 bit windows (x64). The header > files are C, not C++, therefore name mangling should not be > an issue. > > When I compile test programs with the x64 VC++-Compiler from > the Windows SDK (7.1) and link against this library, all is well. > > But I'd rather use MinGW. I'm porting code from 32 bit MinGW > and mixing a VC++ library and MinGW was straightforward on > that architecture. > > When I compile the same test programs with MinGW-W64, I add > the *.lib file to the end of the command line, and then I get a > ton of errors like this: > > g++ -I. -L. murxtest.cpp libmurx_windows_x64.lib > libmurx_windows_x64.lib(murx60.obj):(.text+0x6): undefined > reference to `__chkstk'. > > How can I convince the linker into linking to the correct > implementation of __chkstk for a VC++ compiled 64bit > C library? > > I have tried the following distributions of MinGW-W64: > > tdm64-gcc-4.5.2.exe > x86_64-w64-mingw32-gcc-4.6.2-2-rubenvb.7z add visual studios chkstk.obj to your link. This should solve your issue. Btw this isn't related to mingw-w64 at all Regards, Kai |
From: Lutz H. <lut...@li...> - 2011-08-30 15:32:02
|
kti...@go... > add visual studios chkstk.obj to your link. Thank you! This removed the __chkstk errors. Then I discovered that there were a few similar errors, where __security_check_cookie was missing. I found that symbol in runtmchk.lib. I had to remove chkstk.obj again, since that library also contained chkstk.obj. So for the record, if someone runs into a similar problem, install the Windows SDK 7.1 and then find the necessary files in c:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/lib/amd64 > This should solve your > issue. Btw this isn't related to mingw-w64 at all It is not? Sorry for the noise, then, and thanks anyways for enabling me to use mingw-w64 instead of VC. |
From: PcX <xun...@gm...> - 2011-08-30 15:41:58
|
If you link vc static lib using gcc, there will be many similar errors (adding chkstk.obj can solve some problems). So you'd better link a vc dynamic lib. On Tue, Aug 30, 2011 at 11:31 PM, Lutz Hayen <lut...@li...> wrote: > > kti...@go... > > add visual studios chkstk.obj to your link. > > Thank you! > > This removed the __chkstk errors. Then I discovered that > there were a few similar errors, where > __security_check_cookie was missing. I found that symbol in > runtmchk.lib. I had to remove chkstk.obj again, since that > library also contained chkstk.obj. > > So for the record, if someone runs into a similar problem, > install the Windows SDK 7.1 and then find the necessary > files in > c:/Program Files (x86)/Microsoft Visual Studio 10.0/VC/lib/amd64 > > > This should solve your > > issue. Btw this isn't related to mingw-w64 at all > > It is not? Sorry for the noise, then, and thanks anyways for > enabling me to use mingw-w64 instead of VC. > > > > ------------------------------------------------------------------------------ > Special Offer -- Download ArcSight Logger for FREE! > Finally, a world-class log management solution at an even better > price-free! And you'll get a free "Love Thy Logs" t-shirt when you > download Logger. Secure your free ArcSight Logger TODAY! > http://p.sf.net/sfu/arcsisghtdev2dev > _______________________________________________ > Mingw-w64-public mailing list > Min...@li... > https://lists.sourceforge.net/lists/listinfo/mingw-w64-public > -- Regards, PcX |