[arch-general] crypto++ broken on arch? (unable to link)

Caleb Cushing xenoterracide at gmail.com
Thu Sep 17 17:03:45 EDT 2009


#include <cryptopp/sha.h>
#include <cryptopp/hex.h>
#include <cryptopp/files.h>
#include <boost/filesystem.hpp>
#include <string>
#include <iostream>

using namespace std;
using namespace boost::filesystem;

string getSha1Hash(const path &file, bool uppercase)
{
    string result;
    CryptoPP::SHA1 hash;
    CryptoPP::FileSource(file.file_string().c_str(),true,
        new CryptoPP::HashFilter(hash, new CryptoPP::HexEncoder(
        new CryptoPP::StringSink(result),uppercase)));
    return result;
}

int main()
{
    string sha1;
    path file("test.txt");
    sha1 = getSha1Hash(file, true);
    cout << sha1 << endl;
}

g++ -lboost_filesystem-mt -lcryptopp sha1.cpp


/tmp/cc5IJR4i.o: In function
`getSha1Hash(boost::filesystem::basic_path<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >,
boost::filesystem::path_traits> const&, bool)':
sha1.cpp:(.text+0x5a): undefined reference to
`CryptoPP::StringSinkTemplate<std::basic_string<char,
std::char_traits<char>, std::allocator<char> >
>::StringSinkTemplate(std::basic_string<char, std::char_traits<char>,
std::allocator<char> >&)'
sha1.cpp:(.text+0x117): undefined reference to `CryptoPP::DEFAULT_CHANNEL'
sha1.cpp:(.text+0x11d): undefined reference to `CryptoPP::DEFAULT_CHANNEL'
sha1.cpp:(.text+0x133): undefined reference to `CryptoPP::HashFilter::HashFilter
...
collect2: ld returned 1 exit status



according to the crypto++ mailing list my code does compile with that
command on ubuntu. if I'm doing something wrong for arch I'd like to
know. But I'm concerned that something is not being compiled right for
crypto++ on arch.
-- 
Caleb Cushing

http://xenoterracide.blogspot.com


More information about the arch-general mailing list