Cpp/Linker

From PeerFreedom Wiki
< Cpp
Jump to navigation Jump to search

Static vs dynamic linking

Windows - no decison

Linux Any(normally dynamic) Distribute: static

OSX Dynamic: Some problems with linking ststic libsodium on docker

 ld: warning: directory not found for option '-L/home/ubuntu/build/libsodium/libsodium-osx/lib'
 ld: warning: ignoring file /opt/lib/libsodium.a, file was built for archive which is not the architecture being linked (x86_64): /opt/lib/libsodium.a
 Undefined symbols for architecture x86_64:
 "_crypto_generichash", referenced from:
     n_pfp::n_crypto::n_detail::hash_blake2b_impl(stdpfp::byte const*, unsigned long) in libpfp-cpp.a(crypto.cpp.o)
 "_crypto_generichash_final", referenced from:
     trivialserialize::c_checksum_blake2b::crypto_finish() in libpfp-cpp.a(trivialserialize.cpp.o)
     n_pfp::n_crypto::c_blake2b_multipart::final() in libpfp-cpp.a(crypto.cpp.o)
 "_crypto_generichash_init", referenced from:
     trivialserialize::c_checksum_blake2b::crypto_init() in libpfp-cpp.a(trivialserialize.cpp.o)
     n_pfp::n_crypto::c_blake2b_multipart::c_blake2b_multipart() in libpfp-cpp.a(crypto.cpp.o)
 "_crypto_generichash_update", referenced from:
     trivialserialize::c_checksum_blake2b::crypto_process_one(stdpfp::byte) in libpfp-cpp.a(trivialserialize.cpp.o)
     trivialserialize::c_checksum_blake2b::crypto_process_many(stdpfp::span<stdpfp::byte const, 18446744073709551615ul>) in libpfp-cpp.a(trivialserialize.cpp.o)
     n_pfp::n_crypto::c_blake2b_multipart::update(stdpfp::span<stdpfp::byte const, 18446744073709551615ul>&) in libpfp-cpp.a(crypto.cpp.o)
 "_crypto_hash_sha256", referenced from:
     n_pfp::n_crypto::c_seed::hash_one_sha256(stdpfp::byte const*, unsigned long) const in libpfp-cpp.a(seed.cpp.o)
     n_pfp::n_crypto::hash_sha256(stdpfp::byte const*, unsigned long) in libpfp-cpp.a(crypto.cpp.o)
 "_crypto_sign_detached", referenced from:
     n_pfp::n_crypto::c_keypair::sign(stdpfp::span<stdpfp::byte const, 18446744073709551615ul>) const in libpfp-cpp.a(keypair.cpp.o)
 "_crypto_sign_keypair", referenced from:
     n_pfp::n_crypto::c_keypair::c_keypair() in libpfp-cpp.a(keypair.cpp.o)
 "_crypto_sign_seed_keypair", referenced from:
     n_pfp::n_crypto::c_keypair::c_keypair(std::__1::array<stdpfp::byte, 32ul> const&) in libpfp-cpp.a(keypair.cpp.o)
 "_crypto_sign_verify_detached", referenced from:
     n_pfp::n_crypto::verify(stdpfp::span<stdpfp::byte const, 18446744073709551615ul>, std::__1::array<stdpfp::byte, 32ul> const&, std::__1::array<stdpfp::byte, 64ul> const&) in libpfp-cpp.a(crypto.cpp.o)
 "_randombytes_buf", referenced from:
     n_pfp::n_crypto::c_seed::generate_from_rng_plus_entropy(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&) in libpfp-cpp.a(seed.cpp.o)
 "_sodium_bin2hex", referenced from:
     n_pfp::n_crypto::c_seed::hash_two_sha256_as_hex(stdpfp::byte const*, unsigned long) const in libpfp-cpp.a(seed.cpp.o)
 ld: symbol(s) not found for architecture x86_64