Skip to content

Error compiling with --with-lto -- undefined reference to vtable for strictmod::objects::StrictExceptionObject #128

@ravirahman

Description

@ravirahman

I am trying to compile with Cinder with --with-lto but am getting the following errors:

dfg++ -pthread   -flto -fuse-linker-plugin -ffat-lto-objects -flto-partition=none -g -fprofile-generate -Xlinker -export-dynamic -o python Programs/python.o libpython3.10_static.a -lcrypt -lpthread -ldl  -lz -lutil -lm   -lm  -lrt 
/usr/bin/ld: python.lto.o: in function `std::__shared_ptr<strictmod::objects::StrictExceptionObject, (__gnu_cxx::_Lock_policy)2>::__shared_ptr<std::allocator<strictmod::objects::StrictExceptionObject>, std::shared_ptr<strictmod::objects::StrictType>, std::weak_ptr<strictmod::objects::StrictModuleObject> const&, std::shared_ptr<sequence_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<strictmod::objects::BaseStrictObject>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > > >(std::_Sp_alloc_shared_tag<std::allocator<strictmod::objects::StrictExceptionObject> >, std::shared_ptr<strictmod::objects::StrictType>&&, std::weak_ptr<strictmod::objects::StrictModuleObject> const&, std::shared_ptr<sequence_map<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> >, std::shared_ptr<strictmod::objects::BaseStrictObject>, std::hash<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > >, std::equal_to<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > > > >&&) [clone .isra.0]':
/vol/./StrictModules/Objects/exception_object.h:10: undefined reference to `vtable for strictmod::objects::StrictExceptionObject'
/usr/bin/ld: python.lto.o: in function `std::shared_ptr<strictmod::objects::StrictType> strictmod::objects::makeType<strictmod::objects::StrictExceptionType, char const (&) [10], std::shared_ptr<strictmod::objects::StrictModuleObject>&, std::vector<std::shared_ptr<strictmod::objects::BaseStrictObject>, std::allocator<std::shared_ptr<strictmod::objects::BaseStrictObject> > >, std::shared_ptr<strictmod::objects::StrictType> >(char const (&) [10], std::shared_ptr<strictmod::objects::StrictModuleObject>&, std::vector<std::shared_ptr<strictmod::objects::BaseStrictObject>, std::allocator<std::shared_ptr<strictmod::objects::BaseStrictObject> > >&&, std::shared_ptr<strictmod::objects::StrictType>&&) [clone .constprop.0]':
/vol/./StrictModules/Objects/exception_object.h:26: undefined reference to `vtable for strictmod::objects::StrictExceptionType'
/usr/bin/ld: python.lto.o: in function `strictmod::objects::AttributeErrorType()':
/vol/./StrictModules/Objects/exception_object.h:26: undefined reference to `vtable for strictmod::objects::StrictExceptionType'
/usr/bin/ld: python.lto.o: in function `strictmod::objects::AssertionErrorType()':
/vol/./StrictModules/Objects/exception_object.h:26: undefined reference to `vtable for strictmod::objects::StrictExceptionType'
/usr/bin/ld: python.lto.o: in function `strictmod::objects::ValueErrorType()':
/vol/./StrictModules/Objects/exception_object.h:26: undefined reference to `vtable for strictmod::objects::StrictExceptionType'
/usr/bin/ld: python.lto.o: in function `strictmod::objects::NotImplementedErrorType()':
/vol/./StrictModules/Objects/exception_object.h:26: undefined reference to `vtable for strictmod::objects::StrictExceptionType'
/usr/bin/ld: python.lto.o:/vol/./StrictModules/Objects/exception_object.h:26: more undefined references to `vtable for strictmod::objects::StrictExceptionType' follow

I am using the python-build-env dockerimage. It appears that all of the strict modules are getting compiled, so I am confused why it is failing to link.

Steps to reproduce:

git clone https://github.com/facebookincubator/cinder
docker run -v "$PWD/cinder:/vol" -w /vol -it --rm ghcr.io/facebookincubator/cinder/python-build-env:latest bash
./configure --with-lto
make VERBOSE=1

I am able to build it without LTO. Would appreciate if you could let me know what I need to do differently. Thanks!

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