Skip to content

Linking without -lpthread causes seg faults for me on Linux #2

@bobblestiltskin

Description

@bobblestiltskin

TL;DR - please add -lpthread to build instructions

Hello

I built cryptopp and installed then compiled the example program via the instructions on README.md.

bob@bobspc ~/s/CryptoStreamPP> clang++ -std=c++11 -I/usr/local/include -L/usr/local/lib example.cpp -lcryptopp -o example
bob@bobspc ~/s/CryptoStreamPP> ./example
terminate called after throwing an instance of 'std::system_error'
what(): Unknown error -1
fish: Job 3, “./example” terminated by signal SIGABRT (Abort)
bob@bobspc ~/s/CryptoStreamPP>

Next I tried using g++

bob@bobspc ~/s/CryptoStreamPP> g++ -std=c++11 -I/usr/local/include -L/usr/local/lib example.cpp -lcryptopp -o example
bob@bobspc ~/s/CryptoStreamPP> ./example
terminate called after throwing an instance of 'std::system_error'
what(): Unknown error -1
fish: Job 3, “./example” terminated by signal SIGABRT (Abort)
bob@bobspc ~/s/CryptoStreamPP>

I went away and got cryptopp to build and install on AIX (with help - https://groups.google.com/forum/#!topic/cryptopp-users/gPJOMOUMLhU). I built CryptoStreamPP there and saw it work via ...

bash-4.4$ g++ -pthread -std=c++11 -I/usr/local/include -L/usr/local/lib example.cpp -lpthread -lcryptopp -o example
bash-4.4$ ./example
Hello, world!
Hello, Universe!
bash-4.4$

So I tried that same command line on Linux

bob@bobspc ~/s/CryptoStreamPP> g++ -pthread -std=c++11 -I/usr/local/include -L/usr/local/lib example.cpp -lpthread -lcryptopp -o example
bob@bobspc ~/s/CryptoStreamPP> ./example
Hello, world!
Hello, Universe!
bob@bobspc ~/s/CryptoStreamPP> g++ -std=c++11 -I/usr/local/include -L/usr/local/lib example.cpp -lpthread -lcryptopp -o example
bob@bobspc ~/s/CryptoStreamPP> ./example
Hello, world!
Hello, Universe!
bob@bobspc ~/s/CryptoStreamPP>

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions