Boost program will not working on Linux
        Posted  
        
            by Martin Lauridsen
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by Martin Lauridsen
        
        
        
        Published on 2010-06-17T20:42:03Z
        Indexed on 
            2010/06/17
            21:03 UTC
        
        
        Read the original article
        Hit count: 272
        
Hi SOF,
I have this program which uses Boost::Asio for sockets. I pretty much altered some code from the Boost examples. The program compiles and runs just like it should on Windows in VS. However, when I compile the program on Linux and run it, I get a Segmentation fault.
I posted the code here
The command I use to compile it is this:
c++ -I/appl/htopopt/Linux_x86_64/NTL-5.4.2/include 
-I/appl/htopopt/Linux_x86_64/boost_1_43_0/include 
mpqs.cpp mpqs_polynomial.cpp mpqs_host.cpp -o mpqs_host 
-L/appl/htopopt/Linux_x86_64/NTL-5.4.2/lib -lntl 
-L/appl/htopopt/Linux_x86_64/gmp-4.2.1/lib -lgmp -lm 
-L/appl/htopopt/Linux_x86_64/boost_1_43_0/lib -lboost_system 
-lboost_thread -static -lpthread
By commenting out code, I have found out that I get the Segmentation fault due to the following line:
boost::asio::io_service io_service;
Can anyone provide any assistance, as to what may be the problem (and the solution)?
Thanks!
Edit: I tried changing the program to a minimal example, using no other libraries or headers, just boost/asio.hpp:
#define DEBUG 0
#include <boost/asio.hpp>
int main(int argc, char* argv[]) {  
     boost::asio::io_service io_service;
     return 0;
}
I also removed other library inclusions and linking on compilation, however this minimal example still gives me a segmentation fault.
© Stack Overflow or respective owner