This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

difficulty with c++ boost::thread (1.53.0) on Cygwin 1.7.20(0.266/5/3)


first off, I'm getting "cygcheck: Wrong architecture. Only ix86
executables supported." when running cygcheck.
That said, ...

The attached multithread.cpp ought to run as far as I can tell from
Cygwin, Boost, & the web.
(There is a posting from 2010 regarding problems with building
boost::thread on Cygwin, but I'm able to build, and anyway, the Cygwin
package already includes an up-to-date version of  boost::thread.)

If I try to compile the attached code thus:
     $  g++ -D THREADED multithread.cpp
I get:
     /tmp/ccpBRr49.o:multithread.cpp:(.text+0x259): undefined
reference to `boost::system::generic_category()'
     /tmp/ccpBRr49.o:multithread.cpp:(.text+0x263): undefined
reference to `boost::system::generic_category()'
     /tmp/ccpBRr49.o:multithread.cpp:(.text+0x26d): undefined
reference to `boost::system::system_category()'
     /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld:
/tmp/ccpBRr49.o: bad reloc address 0xb in
section`.text$_ZN5boost6system14error_categoryD1Ev[boost::system::error_category::~error_category()]'
     collect2: ld returned 1 exit status

If I add the option to load libbost_system (as suggested by some
threads on the web):
     $  g++ -D THREADED -llibboost_system multithread.cpp
I get:
     /usr/lib/gcc/i686-pc-cygwin/4.5.3/../../../../i686-pc-cygwin/bin/ld:
cannot find -l/usr/local/lib/libboost_system
     collect2: ld returned 1 exit status

This result is consistent regardless of whether I specify the full
file name or absolute path.

BTW:
     $ updatedb && locate libboost_program_options

/cygdrive/f/_engineeringStocks/boost_1_53_0/bin.v2/libs/program_options/build/gcc-4.5.3/release/link-static/threading-multi/libboost_program_options.a

/cygdrive/f/_engineeringStocks/boost_1_53_0/bin.v2/libs/program_options/build/gcc-4.5.3/release/threading-multi/libboost_program_options.dll.a
     /lib/libboost_program_options-mt.dll.a
     /usr/lib/libboost_program_options-mt.dll.a
     /usr/local/lib/libboost_program_options.a
     /usr/local/lib/libboost_program_options.dll.a


thank you for your attention and (hopefully) help,
Lewis

Attachment: cygcheck.out
Description: Binary data

#include <iostream>
#ifdef THREADED
  #include <boost/thread/thread.hpp>
#endif

using namespace std;

 // load_db_and_find_trades()



double x[4];

void foo(int jj, int tid) {
  for (double ii=1 ; ii < 100000000 ; ii=ii+1) {
    for (int kk=0 ; kk < jj ; kk++) {
      x[tid] += (1 / ii );
      x[tid] -= (1 / ii );
    };
  };
};


int main(int argc, char **argv) {
  cout << x[0] << ", " << x[1] << ", " << x[2] << ", " << x[3]  << endl;
  int mult=15;
  #ifdef THREADED
    for(int tid=0; tid<4 ; tid++){
      boost::thread threaded_load_db_and_find_trades(foo, mult, tid);
    };
  #else
    foo(mult, 0);
  #endif
  cout << x[0] << ", " << x[1] << ", " << x[2] << ", " << x[3]  << endl;
}

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]