You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@thrift.apache.org by "Tomasz Kloczko (Jira)" <ji...@apache.org> on 2022/06/12 16:33:00 UTC

[jira] [Commented] (THRIFT-5596) Build fails with LTO

    [ https://issues.apache.org/jira/browse/THRIFT-5596?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17553290#comment-17553290 ] 

Tomasz Kloczko commented on THRIFT-5596:
----------------------------------------

 

That was with using GNU autotools.

When I found that even with disabled LTO I was unable to link libevent test program because some parts of the code depends on define used only in cmake 

 
{noformat}
[tkloczko@devel-g2v thrift-0.16.0]$ grep -r BOOST_TEST_DYN_LINK
build/cmake/DefineOptions.cmake:    add_definitions(-DBOOST_TEST_DYN_LINK)
lib/cpp/test/TransportTest.cpp:#ifdef BOOST_TEST_DYN_LINK
lib/cpp/test/OpenSSLManualInitTest.cpp:#ifdef BOOST_TEST_DYN_LINK
lib/cpp/test/ZlibTest.cpp:#ifdef BOOST_TEST_DYN_LINK
lib/cpp/test/processor/ProcessorTest.cpp:#ifdef BOOST_TEST_DYN_LINK
lib/cpp/test/TFileTransportTest.cpp:#ifdef BOOST_TEST_DYN_LINK
{noformat}
I've switched to build thrift using cmake and I was able to build without problems with LTO.

 

However now I see several other issue like
 * cmake files are  installed  in $(prefix)/lib/cmake instead in $(libdir)/cmake
 * pkgconfig the same are installed in $(prefix)/lib/pkgconfig instead in $(libdir)/pkgconfig
 * perl, pythis  and lua files are not installed at all

In other words GNU autotools suppoort is broken and cmake seems is not finished.

 

> Build fails with LTO
> --------------------
>
>                 Key: THRIFT-5596
>                 URL: https://issues.apache.org/jira/browse/THRIFT-5596
>             Project: Thrift
>          Issue Type: Bug
>          Components: HTML - Compiler
>    Affects Versions: 0.16.0
>            Reporter: Tomasz Kloczko
>            Priority: Major
>
> Looks like linking is failing when is used LTO
> Linux x86/64
> gcc 12.1.0
> {noformat}
> [tkloczko@devel-g2v thrift-0.16.0]$ make
> make  all-recursive
> make[1]: Entering directory '/home/tkloczko/rpmbuild/BUILD/thrift-0.16.0'
> Making all in compiler/cpp
> make[2]: Entering directory '/home/tkloczko/rpmbuild/BUILD/thrift-0.16.0/compiler/cpp'
> Making all in src
> make[3]: Entering directory '/home/tkloczko/rpmbuild/BUILD/thrift-0.16.0/compiler/cpp/src'
> make  all-am
> make[4]: Entering directory '/home/tkloczko/rpmbuild/BUILD/thrift-0.16.0/compiler/cpp/src'
> make[4]: Nothing to be done for 'all-am'.
> make[4]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/thrift-0.16.0/compiler/cpp/src'
> make[3]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/thrift-0.16.0/compiler/cpp/src'
> Making all in .
> make[3]: Entering directory '/home/tkloczko/rpmbuild/BUILD/thrift-0.16.0/compiler/cpp'
> /bin/sh ../../libtool  --tag=CXX   --mode=link /usr/bin/g++ -std=c++11 -Wall -Wextra -pedantic -Werror -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none  -Wl,-z,relro -Wl,--as-needed -Wl,--gc-sections -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -flto-partition=none -fuse-linker-plugin -Wl,--build-id=sha1 -o thrift src/thrift/audit/thrift-t_audit.o src/thrift/thrift-common.o src/thrift/generate/thrift-t_generator.o src/thrift/thrift-main.o src/thrift/parse/thrift-parse.o src/thrift/parse/thrift-t_typedef.o src/thrift/generate/thrift-t_c_glib_generator.o src/thrift/generate/thrift-t_cl_generator.o src/thrift/generate/thrift-t_cpp_generator.o src/thrift/generate/thrift-t_d_generator.o src/thrift/generate/thrift-t_dart_generator.o src/thrift/generate/thrift-t_delphi_generator.o src/thrift/generate/thrift-t_erl_generator.o src/thrift/generate/thrift-t_go_generator.o src/thrift/generate/thrift-t_gv_generator.o src/thrift/generate/thrift-t_haxe_generator.o src/thrift/generate/thrift-t_html_generator.o src/thrift/generate/thrift-t_markdown_generator.o src/thrift/generate/thrift-t_java_generator.o src/thrift/generate/thrift-t_javame_generator.o src/thrift/generate/thrift-t_js_generator.o src/thrift/generate/thrift-t_json_generator.o src/thrift/generate/thrift-t_lua_generator.o src/thrift/generate/thrift-t_netstd_generator.o src/thrift/generate/thrift-t_ocaml_generator.o src/thrift/generate/thrift-t_perl_generator.o src/thrift/generate/thrift-t_php_generator.o src/thrift/generate/thrift-t_py_generator.o src/thrift/generate/thrift-t_rb_generator.o src/thrift/generate/thrift-t_rs_generator.o src/thrift/generate/thrift-t_st_generator.o src/thrift/generate/thrift-t_swift_generator.o src/thrift/generate/thrift-t_xml_generator.o src/thrift/generate/thrift-t_xsd_generator.o src/thrift/libparse.a -lrt -lpthread
> libtool: link: /usr/bin/g++ -std=c++11 -Wall -Wextra -pedantic -Werror -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -Wl,-z -Wl,relro -Wl,--as-needed -Wl,--gc-sections -Wl,-z -Wl,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -flto=auto -flto-partition=none -fuse-linker-plugin -Wl,--build-id=sha1 -o thrift src/thrift/audit/thrift-t_audit.o src/thrift/thrift-common.o src/thrift/generate/thrift-t_generator.o src/thrift/thrift-main.o src/thrift/parse/thrift-parse.o src/thrift/parse/thrift-t_typedef.o src/thrift/generate/thrift-t_c_glib_generator.o src/thrift/generate/thrift-t_cl_generator.o src/thrift/generate/thrift-t_cpp_generator.o src/thrift/generate/thrift-t_d_generator.o src/thrift/generate/thrift-t_dart_generator.o src/thrift/generate/thrift-t_delphi_generator.o src/thrift/generate/thrift-t_erl_generator.o src/thrift/generate/thrift-t_go_generator.o src/thrift/generate/thrift-t_gv_generator.o src/thrift/generate/thrift-t_haxe_generator.o src/thrift/generate/thrift-t_html_generator.o src/thrift/generate/thrift-t_markdown_generator.o src/thrift/generate/thrift-t_java_generator.o src/thrift/generate/thrift-t_javame_generator.o src/thrift/generate/thrift-t_js_generator.o src/thrift/generate/thrift-t_json_generator.o src/thrift/generate/thrift-t_lua_generator.o src/thrift/generate/thrift-t_netstd_generator.o src/thrift/generate/thrift-t_ocaml_generator.o src/thrift/generate/thrift-t_perl_generator.o src/thrift/generate/thrift-t_php_generator.o src/thrift/generate/thrift-t_py_generator.o src/thrift/generate/thrift-t_rb_generator.o src/thrift/generate/thrift-t_rs_generator.o src/thrift/generate/thrift-t_st_generator.o src/thrift/generate/thrift-t_swift_generator.o src/thrift/generate/thrift-t_xml_generator.o src/thrift/generate/thrift-t_xsd_generator.o  src/thrift/libparse.a -lrt -lpthread
> In member function 'deallocate',
>     inlined from 'deallocate' at /usr/include/c++/12/bits/alloc_traits.h:496:0,
>     inlined from '_M_deallocate' at /usr/include/c++/12/bits/stl_vector.h:387:0,
>     inlined from '__dt_base ' at /usr/include/c++/12/bits/stl_vector.h:366:0,
>     inlined from '__dt_base ' at /usr/include/c++/12/bits/stl_vector.h:733:0,
>     inlined from 'generate_program' at src/thrift/generate/t_html_generator.cc:271:0:
> /usr/include/c++/12/bits/new_allocator.h:158: error: 'operator delete' called on pointer '_607' with nonzero offset [1, 9223372036854775800] [-Werror=free-nonheap-object]
>   158 |         _GLIBCXX_OPERATOR_DELETE(_GLIBCXX_SIZED_DEALLOC(__p, __n));
>       |
> In member function 'allocate',
>     inlined from 'allocate' at /usr/include/c++/12/bits/alloc_traits.h:464:28,
>     inlined from '_M_allocate' at /usr/include/c++/12/bits/stl_vector.h:378:33,
>     inlined from '_M_create_storage' at /usr/include/c++/12/bits/stl_vector.h:395:44,
>     inlined from '__ct ' at /usr/include/c++/12/bits/stl_vector.h:332:26,
>     inlined from '__ct ' at /usr/include/c++/12/bits/stl_vector.h:598:61,
>     inlined from 'generate_program' at src/thrift/generate/t_html_generator.cc:271:0:
> /usr/include/c++/12/bits/new_allocator.h:137:55: note: returned from 'operator new'
>   137 |         return static_cast<_Tp*>(_GLIBCXX_OPERATOR_NEW(__n * sizeof(_Tp)));
>       |                                                       ^
> lto1: all warnings being treated as errors
> lto-wrapper: fatal error: /usr/bin/g++ returned 1 exit status
> compilation terminated.
> /usr/bin/ld: error: lto-wrapper failed
> collect2: error: ld returned 1 exit status
> make[3]: *** [Makefile:888: thrift] Error 1
> make[3]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/thrift-0.16.0/compiler/cpp'
> make[2]: *** [Makefile:1478: all-recursive] Error 1
> make[2]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/thrift-0.16.0/compiler/cpp'
> make[1]: *** [Makefile:686: all-recursive] Error 1
> make[1]: Leaving directory '/home/tkloczko/rpmbuild/BUILD/thrift-0.16.0'
> make: *** [Makefile:602: all] Error 2
> {noformat}
>  



--
This message was sent by Atlassian Jira
(v8.20.7#820007)