Skip to content

Link error when building in github actions environment #110

@leonardt

Description

@leonardt

Here's an example log: https://github.com/leonardt/fault/runs/1311361414?check_suite_focus=true

Since the undefined references involved string methods, I thought it might be related to -D_GLIBCXX_USE_CXX11_ABI=0. However from what I can tell, the coreir release being used is built on travis with gcc-7 without setting that define, and when I forced gcc-8 on github actions, still got the same error. One thing I haven't tried is building pono with -D_GLIBCXX_USE_CXX11_ABI=0, but given the next finding detailed below, I didn't pursue this.

What's even more confusing: building pono-lib works (linking coreir), but building the pono executable (which links pono-lib) fails with the linker errors, so that makes me think it's not related to the string ABI problems. I poked around and still couldn't seem to resolve the issue. This process seems to work fine on the pono travis environment, as well as my local macos environment, so I'm guessing it's something different about the github environment. I haven't been able to figure out what might be the cause though.

I did find that it seems that using target_sources (https://github.com/upscale-project/pono/blob/master/CMakeLists.txt#L167) causes the coreir_encoder.cpp file to be rebuilt for the executable. However, even when I changed the cmake logic to just use a SOURCES variable (https://github.com/upscale-project/pono/blob/7777658cbf349892341906ccb8716ab2117eef35/CMakeLists.txt#L157) to avoid the recompilation, I still got linker errors related to coreir (here's an example log: https://github.com/leonardt/fault/runs/1311285582?check_suite_focus=true). (again this recompilation doesn't seem to be problematic for pono travis or my local env)

FWIW: I managed to unblock myself by just building pono-lib since that's actually all I need for my flow, so I don't think this should be high priority until someone else comes along that is blocked by this issue. But I figured it's worth documenting so if it does come up again we have somewhere to start.

Here are the relevant error messages so it may be easier to find this note.

CMakeFiles/pono-bin.dir/frontends/coreir_encoder.cpp.o: In function `pono::CoreIREncoder::read_coreir_file(CoreIR::Context*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
coreir_encoder.cpp:(.text+0x54c): undefined reference to `CoreIR::loadFromFile(CoreIR::Context*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, CoreIR::Module**)'
CMakeFiles/pono-bin.dir/build.make:125: recipe for target 'pono' failed
CMakeFiles/pono-bin.dir/frontends/coreir_encoder.cpp.o: In function `pono::CoreIREncoder::process_instance(CoreIR::Instance*)':
CMakeFiles/Makefile2:277: recipe for target 'CMakeFiles/pono-bin.dir/all' failed
coreir_encoder.cpp:(.text+0x87d): undefined reference to `CoreIR::Instance::sel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
coreir_encoder.cpp:(.text+0x8c3): undefined reference to `CoreIR::Instance::sel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
coreir_encoder.cpp:(.text+0xa33): undefined reference to `CoreIR::Instance::sel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
coreir_encoder.cpp:(.text+0xceb): undefined reference to `CoreIR::Instance::sel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
coreir_encoder.cpp:(.text+0xd51): undefined reference to `CoreIR::Instance::sel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/pono-bin.dir/frontends/coreir_encoder.cpp.o:coreir_encoder.cpp:(.text+0xdbb): more undefined references to `CoreIR::Instance::sel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' follow
CMakeFiles/pono-bin.dir/frontends/coreir_encoder.cpp.o: In function `pono::CoreIREncoder::wire_connection(std::pair<CoreIR::Wireable*, CoreIR::Wireable*>)':
coreir_encoder.cpp:(.text+0x2606): undefined reference to `CoreIR::isNumber(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
coreir_encoder.cpp:(.text+0x2819): undefined reference to `CoreIR::isNumber(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
CMakeFiles/pono-bin.dir/frontends/coreir_encoder.cpp.o: In function `pono::CoreIREncoder::process_state_element(CoreIR::Instance*)':
coreir_encoder.cpp:(.text+0x30d7): undefined reference to `CoreIR::Instance::sel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
coreir_encoder.cpp:(.text+0x3143): undefined reference to `CoreIR::Instance::sel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
coreir_encoder.cpp:(.text+0x348d): undefined reference to `CoreIR::Instance::sel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
coreir_encoder.cpp:(.text+0x34f3): undefined reference to `CoreIR::Instance::sel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
coreir_encoder.cpp:(.text+0x3565): undefined reference to `CoreIR::Instance::sel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
CMakeFiles/pono-bin.dir/frontends/coreir_encoder.cpp.o:coreir_encoder.cpp:(.text+0x35c0): more undefined references to `CoreIR::Instance::sel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)' follow
CMakeFiles/pono-bin.dir/frontends/coreir_encoder.cpp.o: In function `pono::CoreIREncoder::encode()':
coreir_encoder.cpp:(.text+0x4a79): undefined reference to `CoreIR::Context::runPasses(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >)'
coreir_encoder.cpp:(.text+0x573c): undefined reference to `CoreIR::isNumber(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
coreir_encoder.cpp:(.text+0x6185): undefined reference to `CoreIR::isNumber(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'
CMakeFiles/pono-bin.dir/frontends/coreir_encoder.cpp.o: In function `CoreIR::Module::getGenArgs[abi:cxx11]()':
coreir_encoder.cpp:(.text._ZN6CoreIR6Module10getGenArgsB5cxx11Ev[_ZN6CoreIR6Module10getGenArgsB5cxx11Ev]+0x127): undefined reference to `CoreIR::GlobalValue::getRefName[abi:cxx11]() const'
collect2: error: ld returned 1 exit status
libpono.so: undefined reference to `CoreIR::GlobalValue::getRefName[abi:cxx11]() const'
libpono.so: undefined reference to `CoreIR::Context::runPasses(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >, std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > >)'
CMakeFiles/pono-bin.dir/build.make:110: recipe for target 'pono' failed
libpono.so: undefined reference to `CoreIR::loadFromFile(CoreIR::Context*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, CoreIR::Module**)'
CMakeFiles/Makefile2:277: recipe for target 'CMakeFiles/pono-bin.dir/all' failed
libpono.so: undefined reference to `CoreIR::Instance::sel(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)'
libpono.so: undefined reference to `CoreIR::isNumber(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >)'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions