stanford-centaur / pono

Pono: A flexible and extensible SMT-based model checker
Other
66 stars 32 forks source link

Link error when building in github actions environment #110

Open leonardt opened 3 years ago

leonardt commented 3 years ago

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> >)'
makaimann commented 3 years ago

Thanks for documenting this -- I'll try to look into it when I get a chance. Glad you were able to unblock yourself for now. I have no idea what the issue is unfortunately. Do you know what OS the version of coreir you're downloading is compiled on? I'm not sure if it matters as long as it's linux and there's no ABI issue, but in case it's relevant.

That's a good idea to use a SOURCES variable though. I'll make that change at some point just to avoid the re-linking.

leonardt commented 3 years ago

CoreIR release is built on travis, here is an example log https://travis-ci.org/github/rdaly525/coreir/jobs/737560277

It uses Ubuntu 14.04 (trusty) with gcc-4.8 as the default but we install gcc-7 https://github.com/rdaly525/coreir/blob/master/.travis.yml#L11