Author Topic: Trying to get to 1st base with TDM gcc4.5.2 under WinXP  (Read 100621 times)

Leor

  • Newbie
  • *
  • Posts: 6
    • View Profile
Trying to get to 1st base with TDM gcc4.5.2 under WinXP
« on: November 18, 2011, 07:18:33 PM »
Still trying to get just:;thread to play nice with TDM gcc 4.5.2, on my WinXP Pro system.

First attempt to install the "vanilla" 32-bit TDM 4.5.2 failed due to the installer not finding a required file on the server.

So, I gave the 32/64-bit version a shot. Its installer did run normally, so supposedly I now have that version correctly installed in E:\MinGW64.

With the latest just::thread happily installed in E:\JustThread, and carefully following the readme.txt instructions, it seems to be hanging up at link time. Here's a little BAT file I'm using to try to compile a minimal test program, thread1.cpp:

set CPLUS_INCLUDE_PATH=e:\justthread\include
set LD_INCLUDE_PATH=e:\justthread\lib
g++ -mthreads -m32 -std=c++0x thread1.cpp -o thread1.exe -ljustthread32 -lwinmm

What I see when running this:

e:/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/4.6.1/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -ljustthread32
collect2: ld returned 1 exit status

Any idea why it fails to locate the file in the lib folder? (BTW, I've also tried doing this by setting the LIB environment variable, and it still can't find it...)

Thanks!

Anthony Williams

  • Administrator
  • Full Member
  • *****
  • Posts: 103
    • View Profile
    • just::thread C++ Thread Library
Re: Trying to get to 1st base with TDM gcc4.5.2 under WinXP
« Reply #1 on: November 19, 2011, 12:47:35 AM »
I am not sure why it is not working for you.

Probably the easiest option in the short term is to specify the path directly:

g++ -m32 -mthreads -std=c++0x -Ie:/justthread/include foo.cpp -o foo.exe e:/justthread/lib/libjustthread32.a -lwinmm

Leor

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Trying to get to 1st base with TDM gcc4.5.2 under WinXP
« Reply #2 on: November 19, 2011, 04:18:10 AM »
Well, one step forward and another back. Note that I misspelled the name of the library path variable above (using LD_INCLUDE PATH instead of LD_LIBRARY_PATH).

Even with that corrected, though, I still get the same linker error as above.

When I provide the full pathname as per your suggestion (or, in fact, copy the required .a file to the current directory and give its name without any path at all), it does not seem to resolve any symbols. The result of attempting the compilation is now:

c:\temp\ccb20mvj.o:thread1.cpp:(.text+0x9a): undefined reference to `std::__jssX
46::thread::join()'
c:\temp\ccb20mvj.o:thread1.cpp:(.text$_ZN5__jss6__cm4624__basic_thread_base_data
C2Ev[__ZN5__jss6__cm4624__basic_thread_base_dataC2Ev]+0x8): undefined reference
to `vtable for __jss::__cm46::__basic_thread_base_data'
c:\temp\ccb20mvj.o:thread1.cpp:(.text$_ZN5__jss5(T4, __thread_base_data, Ev cons
t)[__ZN5__jss5(T4, __thread_base_data, Ev const)]+0x16): undefined reference to
`vtable for __jss::__X46::__thread_base_data'
c:\temp\ccb20mvj.o:thread1.cpp:(.text$_ZNSt8__jssX466threadD1Ev[__ZNSt8__jssX466
threadD1Ev]+0xd): undefined reference to `std::__jssX46::thread::joinable() cons
t'
c:\temp\ccb20mvj.o:thread1.cpp:(.text$_ZNSt8__jssX466threadC1IRFvvEEEOT_[__ZNSt8
__jssX466threadC1IRFvvEEEOT_]+0x65): undefined reference to `std::__jssX46::thre
ad::start_thread(__jss::__X46::__thread_func_wrapper_base const&)'
c:\temp\ccb20mvj.o:thread1.cpp:(.text$_ZN5__jss5__X4611thread_dataINS0_9__invoke
rIvRFvvEIEEEED1Ev[__ZN5__jss5__X4611thread_dataINS0_9__invokerIvRFvvEIEEEED1Ev]+
0x21): undefined reference to `__jss::__X46::__thread_base_data::~__thread_base_
data()'
collect2: ld returned 1 exit status

This is just nuts. I'm having such a hard time today with stuff that is supposed to be simple...

Anthony Williams

  • Administrator
  • Full Member
  • *****
  • Posts: 103
    • View Profile
    • just::thread C++ Thread Library
Re: Trying to get to 1st base with TDM gcc4.5.2 under WinXP
« Reply #3 on: November 21, 2011, 08:29:28 AM »
When I provide the full pathname as per your suggestion (or, in fact, copy the required .a file to the current directory and give its name without any path at all), it does not seem to resolve any symbols. The result of attempting the compilation is now:

c:\temp\ccb20mvj.o:thread1.cpp:(.text+0x9a): undefined reference to `std::__jssX
46::thread::join()'

This symbol will not be resolved by the current release of just::thread. The name indicates that this code was compiled with gcc 4.6, which is not supported for the TDM port. I guess your PATH still has TDM 4.6.1 on it.

Leor

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Trying to get to 1st base with TDM gcc4.5.2 under WinXP
« Reply #4 on: November 22, 2011, 12:56:41 AM »
Well, that's interesting, Anthony! The last thing I expected after installing from the tdm 4.5.2 installer would be to find out it had actually installed version 4.6.1 ... but that's exactly that the 32/64 bit 4.5.2 "experimental" version did. I guess the experiment is still in progress...

So I can't install the straight 32-bit 4.5.2 because the installer immediately fails, and when I try to install the 32/64-bit, it installs the 4.6.1 compiler and who the heck knows what versions of other things.

And those are the only two options the 4.5.2 installer gives me.

You gotta love it.

Unless you have some other idea of how I can get some version of gcc going that just::thread will work with, I guess I'm doing all my testing with VC10.

Leor

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Trying to get to 1st base with TDM gcc4.5.2 under WinXP
« Reply #5 on: November 22, 2011, 06:08:38 AM »
Major step forward: 'tdragon' on SourceForge replied to my bug report about the installation failure.

The tdm4.5.2 installer has a check box on the first screen labeled "Check for updated files on the TDM-GCC server" that is checked by default. I don't know about folks in the gcc world, but to ME there's a difference between "updated files" and "new releases"... apparently, what the installer really means to be saying is, "If you leave this box checked, then I will silently use the highest-numbered release there is, regardless of which version of the installer you're now running." Hence, my ending up with 4.6.1 installed when I thought I was installing 4.5.2.

So the installation error on the 32-bit version was actually an error attempting to grab a file for the 4.6.1 release (an error which doesn't seem to happen if you just run the 4.6.1 installer in the first place.) And the "experimental" version was 4.6.1 only, but I didn't know the 4.5.2 installer was doing the automatic swticheroo to that version.

If I uncheck the "check for updated files" checkbox, then I'm not offered the option of the experimental 32/64-bit version; there's only the one (32-bit) version, and it installs without error. Which leads me to wonder why you refer to the 32/64-bit version in your README file, since that only seems to be applicable to 4.6.1, and 4.6.1 isn't supposed to be just::thread-compatible? But I digress, as I now have a 32-bit 4.5.2 installed that does link with just::thread...but only if I use the explicit path name for the .a file (-ljustthread still fails to link).

Wow.

OK, next issue (lol). Consider the the following trivial program:

#include <iostream>
#include <thread>
using namespace std;

void hello()
{
   cout << "Hello from hello (in thread?)\n";
}

int main()
{
   thread t0(hello);
   cout << "Hello from main!\n";
   t0.join();
}



It builds clean under both VC9 and (now, finally) TDM4.5.2.

It runs fine under VC9, but under TDM4.5.2 I get the following "bonus" output after the expected two lines:

terminate called after throwing an instance of 'std::system_error'
  what():

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.


What's that about?

Thanks!


Anthony Williams

  • Administrator
  • Full Member
  • *****
  • Posts: 103
    • View Profile
    • just::thread C++ Thread Library
Re: Trying to get to 1st base with TDM gcc4.5.2 under WinXP
« Reply #6 on: November 22, 2011, 08:05:24 AM »
Hi Leor,

First the easy bit:

Which leads me to wonder why you refer to the 32/64-bit version in your README file, since that only seems to be applicable to 4.6.1

There's a separate installer for the 32/64-bit version. The libjustthread32.a and libjustthread64.a libraries were built with that.

It runs fine under VC9, but under TDM4.5.2 I get the following "bonus" output after the expected two lines:

terminate called after throwing an instance of 'std::system_error'
  what():

This application has requested the Runtime to terminate it in an unusual way.
Please contact the application's support team for more information.


What's that about?

That's a bug I just discovered this week. The internals of the library need to be destroyed in the right order, and sometimes the TDM linker destroys things in the wrong order, causing this problem. This is a bug that only applies to the TDM build as far as I can see. I'm working on a fix.

Sorry for the inconvenience; it seems you've hit more than your share of problems  :(

Leor

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Trying to get to 1st base with TDM gcc4.5.2 under WinXP
« Reply #7 on: November 22, 2011, 05:50:48 PM »
Hi Leor,

First the easy bit:

Which leads me to wonder why you refer to the 32/64-bit version in your README file, since that only seems to be applicable to 4.6.1

There's a separate installer for the 32/64-bit version. The libjustthread32.a and libjustthread64.a libraries were built with that.


Right, but from what I'm seeing (and I admit I don't always see things correctly, esp. when gcc is concerned...) is that the 32/64-bit version is ONLY a 4.6.1 option, and you've told me threading support isn't even there in 4.6.1, or at least not in a form compatible with just::thread (which is why I've been laboring to get 4.5.2 going). So why is there a just::thread lib for the 32/64-bit platform?

Yeah, I usually bring out the "best" in software. I've concluded it's some sort of karmic thing  :)

Anthony Williams

  • Administrator
  • Full Member
  • *****
  • Posts: 103
    • View Profile
    • just::thread C++ Thread Library
Re: Trying to get to 1st base with TDM gcc4.5.2 under WinXP
« Reply #8 on: November 22, 2011, 07:29:10 PM »
There's a separate installer for the 32/64-bit version. The libjustthread32.a and libjustthread64.a libraries were built with that.

Right, but from what I'm seeing (and I admit I don't always see things correctly, esp. when gcc is concerned...) is that the 32/64-bit version is ONLY a 4.6.1 option

The 32/64-bit installer for 4.5.2 is at http://sourceforge.net/projects/tdm-gcc/files/TDM-GCC%20Installer/Previous/1.1006.0/tdm64-gcc-4.5.2.exe/download

Leor

  • Newbie
  • *
  • Posts: 6
    • View Profile
Re: Trying to get to 1st base with TDM gcc4.5.2 under WinXP
« Reply #9 on: November 22, 2011, 08:01:59 PM »
OK, thanks, I think I've got it straight. For my purposes, I'll stick with the straight 32-bit 4.5.2 installation, since it now works.