I've spent some time trying to figure this out, but I haven't gotten very far. I'm not very well versed in gcc LTO or partial linking.
Here's what I've found. I've trimmed out everything except what's relevant to a single lib.fo.partial error. This was with "gcc (Ubuntu 5.4.1-2ubuntu1~16.04) 5.4.1 20160904". If you want to test this on your own, you can simply use a docker image to get a different compiler version. The following command line should "just work" with my docker image. (Note: it's called gcc-6, but gcc-5 is the default. Oops.) > docker run -v `pwd`:`pwd` -it powerjg/gem5-gcc-6-build /bin/bash > cd <your gem5 directory> > scons ... One thing stands out to me below. Every single partial linking includes "-Lbuild/nomali -Lbuild/drampower -Lbuild/iostream3 -Lbuild/libfdt -Lbuild/libelf -Lbuild/fputils". However, this doesn't seem to be the problem. It seems like it may be something with header files. Could it be that all of the functions defined in header files are causing the problem? The error below is all for the Stats members. Other common errors are SimObject::drain() and Drainable::drainResume(). I'm grasping at straws here. If anyone has any ideas, we really need to get this fixed. If we can't solve this (relatively) quickly, we should revert the partial linking patch so we can use gem5.fast again! Thanks, Jason ERROR: ------------- build/X86/mem/ruby/profiler/lib.fo.partial:(.rodata+0x3e0): multiple definition of `typeinfo name for Stats::HistStor::Params' build/X86/mem/ruby/system/lib.fo.partial:(.rodata+0xdd0): first defined here build/X86/mem/ruby/profiler/lib.fo.partial:(.rodata+0x0): multiple definition of `typeinfo name for Stats::DistInfo' build/X86/mem/ruby/system/lib.fo.partial:(.rodata+0x11c0): first defined here build/X86/mem/ruby/profiler/lib.fo.partial:(.rodata+0xa0): multiple definition of `typeinfo for Stats::InfoProxy<Stats::Histogram, Stats::DistInfo>' build/X86/mem/ruby/system/lib.fo.partial:(.rodata+0x1260): first defined here build/X86/mem/ruby/profiler/lib.fo.partial:(.rodata+0x60): multiple definition of `typeinfo name for Stats::DistInfoProxy<Stats::Histogram>' build/X86/mem/ruby/system/lib.fo.partial:(.rodata+0x1220): first defined here build/X86/mem/ruby/profiler/lib.fo.partial: In function `std::vector<std::vector<Stats::Histogram*, std::allocator<Stats::Histogram*> >, std::allocator<std::vector<Stats::Histogram*, std::allocator<Stats::Histogram*> > > >::~vector()': (.text.unlikely+0x82): multiple definition of `std::vector<std::vector<Stats::Histogram*, std::allocator<Stats::Histogram*> >, std::allocator<std::vector<Stats::Histogram*, std::allocator<Stats::Histogram*> > > >::~vector()' build/X86/mem/ruby/system/lib.fo.partial:(.text.unlikely+0x4d8): first defined here build/X86/mem/ruby/profiler/lib.fo.partial:(.rodata+0x430): multiple definition of `typeinfo for Stats::DistParams' build/X86/mem/ruby/system/lib.fo.partial:(.rodata+0xe20): first defined here build/X86/mem/ruby/profiler/lib.fo.partial:(.rodata+0x140): multiple definition of `typeinfo name for Stats::ScalarInfoProxy<Stats::Scalar>' build/X86/mem/ruby/system/lib.fo.partial:(.rodata+0x1340): first defined here build/X86/mem/ruby/profiler/lib.fo.partial:(.rodata+0x168): multiple definition of `typeinfo for Stats::ScalarInfo' build/X86/mem/ruby/system/lib.fo.partial:(.rodata+0x1368): first defined here build/X86/mem/ruby/profiler/lib.fo.partial: In function `Stats::HistStor::Params::~Params()': (.text+0x7720): multiple definition of `Stats::HistStor::Params::~Params()' build/X86/mem/ruby/system/lib.fo.partial:(.text+0xf2f0): first defined here build/X86/mem/ruby/profiler/lib.fo.partial:(.rodata+0x20): multiple definition of `typeinfo name for Stats::InfoProxy<Stats::Histogram, Stats::DistInfo>' build/X86/mem/ruby/system/lib.fo.partial:(.rodata+0x11e0): first defined here build/X86/mem/ruby/profiler/lib.fo.partial:(.rodata+0x180): multiple definition of `typeinfo for Stats::InfoProxy<Stats::Scalar, Stats::ScalarInfo>' build/X86/mem/ruby/system/lib.fo.partial:(.rodata+0x1380): first defined here build/X86/mem/ruby/profiler/lib.fo.partial:(.rodata+0x400): multiple definition of `typeinfo name for Stats::DistParams' build/X86/mem/ruby/system/lib.fo.partial:(.rodata+0xdf0): first defined here build/X86/mem/ruby/profiler/lib.fo.partial:(.rodata+0xd0): multiple definition of `typeinfo name for Stats::ScalarInfo' build/X86/mem/ruby/system/lib.fo.partial:(.rodata+0x12e0): first defined here build/X86/mem/ruby/profiler/lib.fo.partial: In function `void std::vector<std::vector<Stats::Histogram*, std::allocator<Stats::Histogram*> >, std::allocator<std::vector<Stats::Histogram*, std::allocator<Stats::Histogram*> > > >::emplace_back<std::vector<Stats::Histogram*, std::allocator<Stats::Histogram*> > >(std::vector<Stats::Histogram*, std::allocator<Stats::Histogram*> >&&) [clone .constprop.0]': (.text+0x9e40): multiple definition of `void std::vector<std::vector<Stats::Histogram*, std::allocator<Stats::Histogram*> >, std::allocator<std::vector<Stats::Histogram*, std::allocator<Stats::Histogram*> > > >::emplace_back<std::vector<Stats::Histogram*, std::allocator<Stats::Histogram*> > >(std::vector<Stats::Histogram*, std::allocator<Stats::Histogram*> >&&) [clone .constprop.0]' build/X86/mem/ruby/system/lib.fo.partial:(.text+0xc640): first defined here build/X86/mem/ruby/profiler/lib.fo.partial:(.rodata+0x448): multiple definition of `vtable for Stats::HistStor::Params' build/X86/mem/ruby/system/lib.fo.partial:(.rodata+0xe70): first defined here build/X86/mem/ruby/profiler/lib.fo.partial: In function `Stats::DistParams::~DistParams()': (.text+0x8230): multiple definition of `Stats::DistParams::~DistParams()' build/X86/mem/ruby/system/lib.fo.partial:(.text+0x4d30): first defined here build/X86/mem/ruby/profiler/lib.fo.partial:(.rodata+0x468): multiple definition of `vtable for Stats::DistParams' build/X86/mem/ruby/system/lib.fo.partial:(.rodata+0xe90): first defined here build/X86/mem/ruby/profiler/lib.fo.partial: In function `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*)': (.text+0xb020): multiple definition of `std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > std::operator+<char, std::char_traits<char>, std::allocator<char> >(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&, char const*)' build/X86/mem/ruby/system/lib.fo.partial:(.text+0x6c10): first defined here build/X86/mem/ruby/profiler/lib.fo.partial:(.rodata+0x88): multiple definition of `typeinfo for Stats::DistInfo' build/X86/mem/ruby/system/lib.fo.partial:(.rodata+0x1248): first defined here build/X86/mem/ruby/profiler/lib.fo.partial:(.rodata+0x100): multiple definition of `typeinfo name for Stats::InfoProxy<Stats::Scalar, Stats::ScalarInfo>' build/X86/mem/ruby/system/lib.fo.partial:(.rodata+0x1300): first defined here Tracing back: ---------------------- g++ -o build/X86/mem/ruby/profiler/lib.fo.partial -r -nostdlib build/X86/mem/ruby/profiler/AccessTraceForAddress.fo build/X86/mem/ruby/profiler/AddressProfiler.fo build/X86/mem/ruby/profiler/Profiler.fo build/X86/mem/ruby/profiler/StoreTrace.fo -Lbuild/nomali -Lbuild/drampower -Lbuild/iostream3 -Lbuild/libfdt -Lbuild/libelf -Lbuild/fputils g++ -o build/X86/mem/ruby/profiler/AccessTraceForAddress.fo -c -std=c++11 -pipe -fno-strict-aliasing -Wall -Wundef -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-error=suggest-override -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DPROTOBUF_INLINE_NOT_IN_HEADERS=0 -O3 -flto=8 -Werror -Wno-error=deprecated-declarations -Wno-error=deprecated -DNDEBUG -DTRACING_ON=0 -Iext/pybind11/include -Ibuild/nomali/include -Ibuild/drampower/src -Ibuild/iostream3 -Ibuild/libfdt -Ibuild/libelf -Ibuild/fputils/include -Iext -I/usr/include/python2.7 -I/usr/include/x86_64-linux-gnu/python2.7 -Ibuild/X86 build/X86/mem/ruby/profiler/AccessTraceForAddress.cc g++ -o build/X86/mem/ruby/profiler/AddressProfiler.fo -c -std=c++11 -pipe -fno-strict-aliasing -Wall -Wundef -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-error=suggest-override -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DPROTOBUF_INLINE_NOT_IN_HEADERS=0 -O3 -flto=8 -Werror -Wno-error=deprecated-declarations -Wno-error=deprecated -DNDEBUG -DTRACING_ON=0 -Iext/pybind11/include -Ibuild/nomali/include -Ibuild/drampower/src -Ibuild/iostream3 -Ibuild/libfdt -Ibuild/libelf -Ibuild/fputils/include -Iext -I/usr/include/python2.7 -I/usr/include/x86_64-linux-gnu/python2.7 -Ibuild/X86 build/X86/mem/ruby/profiler/AddressProfiler.cc g++ -o build/X86/mem/ruby/profiler/Profiler.fo -c -std=c++11 -pipe -fno-strict-aliasing -Wall -Wundef -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-error=suggest-override -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DPROTOBUF_INLINE_NOT_IN_HEADERS=0 -O3 -flto=8 -Werror -Wno-error=deprecated-declarations -Wno-error=deprecated -DNDEBUG -DTRACING_ON=0 -Iext/pybind11/include -Ibuild/nomali/include -Ibuild/drampower/src -Ibuild/iostream3 -Ibuild/libfdt -Ibuild/libelf -Ibuild/fputils/include -Iext -I/usr/include/python2.7 -I/usr/include/x86_64-linux-gnu/python2.7 -Ibuild/X86 build/X86/mem/ruby/profiler/Profiler.cc g++ -o build/X86/mem/ruby/profiler/StoreTrace.fo -c -std=c++11 -pipe -fno-strict-aliasing -Wall -Wundef -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-error=suggest-override -fno-builtin-malloc -fno-builtin-calloc -fno-builtin-realloc -fno-builtin-free -DPROTOBUF_INLINE_NOT_IN_HEADERS=0 -O3 -flto=8 -Werror -Wno-error=deprecated-declarations -Wno-error=deprecated -DNDEBUG -DTRACING_ON=0 -Iext/pybind11/include -Ibuild/nomali/include -Ibuild/drampower/src -Ibuild/iostream3 -Ibuild/libfdt -Ibuild/libelf -Ibuild/fputils/include -Iext -I/usr/include/python2.7 -I/usr/include/x86_64-linux-gnu/python2.7 -Ibuild/X86 build/X86/mem/ruby/profiler/StoreTrace.cc On Sun, May 28, 2017 at 2:57 PM Gabe Black <[email protected]> wrote: > I was thinking about this, and while I don't have the right compiler > installed to try this myself, the solution might be to filter out the LTO > option when doing the partial link like the -shared option. I *think* what > will happen is that the sections with the GIMPLE (LTO data) will be merged, > and then the LTO will still happen during the final link. I think what > might be happening is that g++ is doing actual LTO during the partial > links, and that's messing things up later since things which should only be > done at the end have been done multiple times before then. This is largely > speculation, but probably worth a try. > > Gabe > > On Sat, May 27, 2017 at 2:41 PM, Alec Roelke <[email protected]> wrote: > >> Sorry for the late reply; I've been traveling. I did try this with a >> clean build of a fresh clone of the repository, and got the error with both >> RISC-V and x86. The version of GCC that I'm using is gcc (Ubuntu >> 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609. >> >> On May 24, 2017 10:23 PM, "Gabe Black" <[email protected]> wrote: >> >>> My workstation doesn't have a version of gcc on it that hits the error, >>> so it's going to be difficult for me to do very much debugging. The major >>> difference I see between m5.opt and m5.fast, particularly on gcc of >>> approximately the right versions, is that LTO is turned on. >>> >>> Gabe >>> >>> On Wed, May 24, 2017 at 7:04 PM, Gabe Black <[email protected]> >>> wrote: >>> >>>> I think this has to do with the interaction between partial linking and >>>> link time optimization. I'll keep looking into it. >>>> >>>> Gabe >>>> >>>> On Wed, May 24, 2017 at 2:00 PM, Jason Lowe-Power <[email protected]> >>>> wrote: >>>> >>>>> Hi everyone, >>>>> >>>>> So I've been able to reproduce the problem. I would bet it's due to >>>>> the new partial linking code ( >>>>> https://gem5.googlesource.com/public/gem5/+/6bdd897f04f4efdf90d0761c6d31d3f960f4eacf). >>>>> I'm not sure what the solution is, yet, or if I'll have time to look at it >>>>> in the next few day. Gabe might have an idea, though, if that is the >>>>> problem. >>>>> >>>>> Here's a matrix of what compilers are working and which aren't >>>>> (gcc-4.8 is working, too, though not tested on travis). >>>>> https://travis-ci.org/powerjg/gem5-ci-test/builds/235779432 >>>>> >>>>> Jason >>>>> >>>>> On Tue, May 23, 2017 at 4:33 PM Moussa, Ayman < >>>>> [email protected]> wrote: >>>>> >>>>>> How can I check which compiler scons uses? These are the compilers on >>>>>> my system >>>>>> >>>>>> >>>>>> gcc (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 >>>>>> g++ (Ubuntu 5.4.0-6ubuntu1~16.04.4) 5.4.0 20160609 >>>>>> Linux 4.4.0-75-generic #96-Ubuntu SMP >>>>>> >>>>>> ------------------------------ >>>>>> *From:* gem5-users <[email protected]> on behalf of Jason >>>>>> Lowe-Power <[email protected]> >>>>>> *Sent:* 23 May 2017 22:27:34 >>>>>> >>>>>> *To:* gem5 users mailing list >>>>>> *Subject:* Re: [gem5-users] Link error building gem5.fast >>>>>> >>>>>> I just tried again and still cannot reproduce the error. What >>>>>> compiler are you using? >>>>>> >>>>>> Jason >>>>>> >>>>>> On Tue, May 23, 2017 at 3:41 PM Moussa, Ayman < >>>>>> [email protected]> wrote: >>>>>> >>>>>>> Hey >>>>>>> >>>>>>> >>>>>>> I've encountered this exact problem with x86 and it only seems to be >>>>>>> for gem5.fast (gem5.opt works fine). I still have problems with a clean >>>>>>> build as Jason suggested so I reverted back to some random commit on the >>>>>>> gem5 repository and it works but it's not what I was looking for though. >>>>>>> Hope this gets fixed soon. >>>>>>> >>>>>>> >>>>>>> >>>>>>> ------------------------------ >>>>>>> *From:* gem5-users <[email protected]> on behalf of Alec >>>>>>> Roelke <[email protected]> >>>>>>> *Sent:* 23 May 2017 21:14:10 >>>>>>> *To:* gem5 users mailing list >>>>>>> *Subject:* [gem5-users] Link error building gem5.fast >>>>>>> >>>>>>> Hi Everyone, >>>>>>> >>>>>>> When I try to build gem5.fast using any ISA, I get a lot of multiple >>>>>>> definition errors during the final linking stage. For example, with >>>>>>> x86: >>>>>>> >>>>>>> [ LINK] -> X86/gem5.fast.unstripped >>>>>>> build/X86/arch/x86/bios/lib.fo.partial: In function >>>>>>> `Drainable::drainResume()': >>>>>>> (.text+0x5b00): multiple definition of `Drainable::drainResume()' >>>>>>> build/X86/dev/x86/lib.fo.partial:(.text+0x0): first defined here >>>>>>> >>>>>>> There are way too many of these to list them all, but they're all >>>>>>> multiple definitions of symbols. Has anyone else encountered this? >>>>>>> >>>>>>> Thanks, >>>>>>> Alec Roelke >>>>>>> _______________________________________________ >>>>>>> gem5-users mailing list >>>>>>> [email protected] >>>>>>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users >>>>>> >>>>>> _______________________________________________ >>>>>> gem5-users mailing list >>>>>> [email protected] >>>>>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users >>>>> >>>>> >>>> >>> >>> _______________________________________________ >>> gem5-users mailing list >>> [email protected] >>> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users >>> >> >> _______________________________________________ >> gem5-users mailing list >> [email protected] >> http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users >> > > _______________________________________________ > gem5-users mailing list > [email protected] > http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
_______________________________________________ gem5-users mailing list [email protected] http://m5sim.org/cgi-bin/mailman/listinfo/gem5-users
