3

Running cargo build on MacBookPro M1 machine for the first time after cloning the solana repository. Error report:

  ld: warning: ignoring file ./.libs/libprotoc.a, building for macOS-arm64 but attempting to link with file built for unknown-unsupported file format ( 0x21 0x3C 0x61 0x72 0x63 0x68 0x3E 0x0A 0x2F 0x20 0x20 0x20 0x20 0x20 0x20 0x20 )
  ld: warning: ignoring file ./.libs/libprotobuf.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
  ld: warning: ignoring file ~/solana/target/debug/build/protobuf-src-3957990cd4f40fe4/out/install/build/src/.libs/libprotobuf.a, building for macOS-arm64 but attempting to link with file built for macOS-arm64
  Undefined symbols for architecture arm64:
    "google::protobuf::compiler::objectivec::ObjectiveCGenerator::ObjectiveCGenerator()", referenced from:
        google::protobuf::compiler::ProtobufMain(int, char**) in main.o
    "google::protobuf::compiler::objectivec::ObjectiveCGenerator::~ObjectiveCGenerator()", referenced from:
        google::protobuf::compiler::ProtobufMain(int, char**) in main.o
    "google::protobuf::compiler::CodeGenerator::~CodeGenerator()", referenced from:
        google::protobuf::compiler::js::Generator::~Generator() in main.o
        google::protobuf::compiler::ruby::Generator::~Generator() in main.o
        google::protobuf::compiler::php::Generator::~Generator() in main.o
    "google::protobuf::compiler::CommandLineInterface::AllowPlugins(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
        google::protobuf::compiler::ProtobufMain(int, char**) in main.o
    "google::protobuf::compiler::CommandLineInterface::RegisterGenerator(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&, google::protobuf::compiler::CodeGenerator*, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> > const&)", referenced from:
        google::protobuf::compiler::ProtobufMain(int, char**) in main.o
    "google::protobuf::compiler::CommandLineInterface::Run(int, char const* const*)", referenced from:
        google::protobuf::compiler::ProtobufMain(int, char**) in main.o
    "google::protobuf::compiler::CommandLineInterface::CommandLineInterface()", referenced from:
        google::protobuf::compiler::ProtobufMain(int, char**) in main.o
    "google::protobuf::compiler::CommandLineInterface::~CommandLineInterface()", referenced from:
        google::protobuf::compiler::ProtobufMain(int, char**) in main.o
    "google::protobuf::compiler::cpp::CppGenerator::CppGenerator()", referenced from:
        google::protobuf::compiler::ProtobufMain(int, char**) in main.o
    "google::protobuf::compiler::cpp::CppGenerator::~CppGenerator()", referenced from:
        google::protobuf::compiler::ProtobufMain(int, char**) in main.o
    "google::protobuf::compiler::java::JavaGenerator::JavaGenerator()", referenced from:
        google::protobuf::compiler::ProtobufMain(int, char**) in main.o
    "google::protobuf::compiler::java::JavaGenerator::~JavaGenerator()", referenced from:
        google::protobuf::compiler::ProtobufMain(int, char**) in main.o
    "google::protobuf::compiler::java::KotlinGenerator::KotlinGenerator()", referenced from:
        google::protobuf::compiler::ProtobufMain(int, char**) in main.o
    "google::protobuf::compiler::java::KotlinGenerator::~KotlinGenerator()", referenced from:
        google::protobuf::compiler::ProtobufMain(int, char**) in main.o
    "google::protobuf::compiler::csharp::Generator::Generator()", referenced from:
        google::protobuf::compiler::ProtobufMain(int, char**) in main.o
    "google::protobuf::compiler::csharp::Generator::~Generator()", referenced from:
        google::protobuf::compiler::ProtobufMain(int, char**) in main.o
    "google::protobuf::compiler::python::Generator::Generator()", referenced from:
        google::protobuf::compiler::ProtobufMain(int, char**) in main.o
    "google::protobuf::compiler::python::Generator::~Generator()", referenced from:
        google::protobuf::compiler::ProtobufMain(int, char**) in main.o
    "vtable for google::protobuf::compiler::CodeGenerator", referenced from:
        google::protobuf::compiler::CodeGenerator::CodeGenerator() in main.o
    NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
    "vtable for google::protobuf::compiler::js::Generator", referenced from:
        google::protobuf::compiler::js::Generator::Generator() in main.o
    NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
    "vtable for google::protobuf::compiler::php::Generator", referenced from:
        google::protobuf::compiler::php::Generator::Generator() in main.o
    NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
    "vtable for google::protobuf::compiler::ruby::Generator", referenced from:
        google::protobuf::compiler::ruby::Generator::Generator() in main.o
    NOTE: a missing vtable usually means the first non-inline virtual member function has no definition.
  ld: symbol(s) not found for architecture arm64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  make[1]: *** [protoc] Error 1
  make: *** [install-recursive] Error 1
  thread 'main' panicked at '
  command did not execute successfully, got: exit status: 2

build script failed, must exit now', ~/.cargo/registry/src/github.com-1ecc6299db9ec823/autotools-0.2.5/src/lib.rs:715:5

2 Answers 2

1

Try building from a release tag rather than whatever commit you are here.

2
  • Getting this for v1.14 or v1.16 so this isn't something new with protobuf-src upgrade. Maybe something has changed on macos and it breaks the build.
    – Arowana
    Commented Aug 16, 2023 at 1:33
  • tbf, op was from a year ago ;)
    – trent.sol
    Commented Aug 29, 2023 at 2:13
1

I was facing the same exact issue.

I found the "generic" answer here: https://github.com/bitcoin/bitcoin/issues/20825

In short, i installed binutils at some point, binutils build tool binaries are then used instead of the default ones, and they break the build of protobuf through protobuf-src.

The fix brew uninstall binutils, compilation works after that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.