llvm / llvm-project

The LLVM Project is a collection of modular and reusable compiler and toolchain technologies.
http://llvm.org
Other
27.81k stars 11.45k forks source link

Attempt to install postgresql14 on Arch Linux with clang15 and LLVM15 fails with a reference to "kind" from LLVM17? #85075

Open TheRealTomDavidson opened 5 months ago

TheRealTomDavidson commented 5 months ago

LLVM ERROR: ThinLTO cannot create input file: Unknown attribute kind (86) (Producer: 'LLVM17.0.6' Reader: 'LLVM 15.0.7') PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace. Stack dump:

  1. Program arguments: /usr/lib/llvm15/bin/llvm-lto -thinlto -thinlto-action=thinlink -o postgres.index.bc postgres/access/brin/brin>

    0 0x00007fa89dba655a llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /usr/src/debug/llvm15/llvm-15.0.7.src/lib/Support/Unix/Signal>

    1 0x00007fa89dba655a PrintStackTraceSignalHandler /usr/src/debug/llvm15/llvm-15.0.7.src/lib/Support/Unix/Signals.inc:631:23

    2 0x00007fa89dba362f llvm::sys::RunSignalHandlers() /usr/src/debug/llvm15/llvm-15.0.7.src/lib/Support/Signals.cpp:103:20

    3 0x00007fa89dba377d SignalHandler /usr/src/debug/llvm15/llvm-15.0.7.src/lib/Support/Unix/Signals.inc:397:31

    4 0x00007fa89c85a770 (/usr/lib/libc.so.6+0x3c770)

    5 0x00007fa89c8ab32c (/usr/lib/libc.so.6+0x8d32c)

    6 0x00007fa89c85a6c8 raise (/usr/lib/libc.so.6+0x3c6c8)

    7 0x00007fa89c8424b8 abort (/usr/lib/libc.so.6+0x244b8)

    8 0x00007fa89d8e3281 std::__cxx11::basic_string<char, std::char_traits, std::allocator>::_M_replace(unsigned long, unsigne>

    9 0x00007fa89d8e3281 std::__cxx11::basic_string<char, std::char_traits, std::allocator>::assign(char const*) /usr/include/>

    10 0x00007fa89d8e3281 std::__cxx11::basic_string<char, std::char_traits, std::allocator>::operator=(char const*) /usr/inclu>

    11 0x00007fa89d8e3281 CompareNumbers /usr/src/debug/llvm15/llvm-15.0.7.src/lib/Support/FileUtilities.cpp:133:19

    12 0x00007fa89f7cf193 llvm::ThinLTOCodeGenerator::addModule(llvm::StringRef, llvm::StringRef) /usr/src/debug/llvm15/llvm-15.0.7.src/lib>

    13 0x000055c788b9ac27 llvm::ErrorOr<std::unique_ptr<llvm::MemoryBuffer, std::default_delete>>::~ErrorOr() /usr/src/>

    14 0x000055c788b9ac27 thinlto::ThinLTOProcessing::thinLink() /usr/src/debug/llvm15/llvm-15.0.7.src/tools/llvm-lto/llvm-lto.cpp:654:5

    15 0x000055c788b8e441 thinlto::ThinLTOProcessing::~ThinLTOProcessing() /usr/src/debug/llvm15/llvm-15.0.7.src/tools/llvm-lto/llvm-lto.cp>

    16 0x000055c788b8e441 main /usr/src/debug/llvm15/llvm-15.0.7.src/tools/llvm-lto/llvm-lto.cpp:996:3

    17 0x00007fa89c843cd0 (/usr/lib/libc.so.6+0x25cd0)

    18 0x00007fa89c843d8a __libc_start_main (/usr/lib/libc.so.6+0x25d8a)

    19 0x000055c788b908d5 (/usr/lib/llvm15/bin/llvm-lto+0xc8d5)

    make[3]: *** [Makefile:219: install-postgres-bitcode] Aborted (core dumped)

As far as I know, LLVM17 is not installed on this machine. Any ideas?

EugeneZelenko commented 5 months ago

Could you please try 18 or main branch?

@teresajohnson

TheRealTomDavidson commented 5 months ago

By "try 18," do you mean try LLVM18? Isn't that completely incompatible with postgresql14?

EugeneZelenko commented 5 months ago

Only most recent release is maintained. Also bugs may be fixed in versions newer than 15.

TheRealTomDavidson commented 5 months ago

Can you confirm postgresql14 compatibility with llvm18? I need to build and install postgresql14 SPECIFICALLY to load database files of a specific version.

EugeneZelenko commented 5 months ago

Sorry, I don't know details about PostgreSQL. If LLVM/Clang are used only for compilation, just try.

TheRealTomDavidson commented 5 months ago

LLVM 18 is not available by default on Arch. Should I try to force an upgrade to it, or install the latest version that exists (17) and try to figure out the postgresql incompatibilities? What would be more likely to get me actual help from people? :)

TheRealTomDavidson commented 5 months ago

I was able to successfully install postgresql14 despite this error, but running any query with more than a couple values forces a disconnect following this error: Unknown attribute kind (86) (Producer: 'LLVM17.0.6' Reader: 'LLVM 15.0.7').

When that error does NOT occur, the system works fine. Is there a way to convince my Arch installation to simply never look to LLVM17 for anything?

ms178 commented 5 months ago

@TheRealTomDavidson Have you tried to install https://aur.archlinux.org/packages/clang15 and related packages? That might help to overcome this issue by using that older toolchain instead of the default 17.0.6 for compiling that particular package.

shiz01 commented 3 months ago

Also, a similar error will occur when assembling postgis, when compiling postgres with llvm 18, using llvm 17.

  cd '/var/tmp/portage/dev-db/postgis-3.4.1/image/usr/lib64/postgresql-15/lib64/bitcode' && /usr/lib/llvm/17/bin/llvm-lto -thinlto -thinlto-action=thinlink -o postgis-3.index.bc postgis-3/postgis_module.bc postgis-3/lwgeom_accum.bc postgis-3/lwgeom_union.bc postgis-3/lwgeom_spheroid.bc postgis-3/lwgeom_ogc.bc postgis-3/lwgeom_functions_analytic.bc postgis-3/lwgeom_inout.bc postgis-3/lwgeom_functions_basic.bc postgis-3/lwgeom_btree.bc postgis-3/lwgeom_box.bc postgis-3/lwgeom_box3d.bc postgis-3/lwgeom_geos.bc postgis-3/lwgeom_geos_prepared.bc postgis-3/lwgeom_geos_clean.bc postgis-3/lwgeom_geos_relatematch.bc postgis-3/lwgeom_generate_grid.bc postgis-3/lwgeom_export.bc postgis-3/lwgeom_in_gml.bc postgis-3/lwgeom_in_kml.bc postgis-3/lwgeom_in_marc21.bc postgis-3/lwgeom_out_marc21.bc postgis-3/lwgeom_in_geohash.bc postgis-3/lwgeom_in_geojson.bc postgis-3/lwgeom_in_encoded_polyline.bc postgis-3/lwgeom_triggers.bc postgis-3/lwgeom_dump.bc postgis-3/lwgeom_dumppoints.bc postgis-3/lwgeom_functions_lrs.bc postgis-3/lwgeom_functions_temporal.bc postgis-3/lwgeom_rectree.bc postgis-3/long_xact.bc postgis-3/lwgeom_sqlmm.bc postgis-3/lwgeom_rtree.bc postgis-3/lwgeom_transform.bc postgis-3/lwgeom_window.bc postgis-3/gserialized_typmod.bc postgis-3/gserialized_gist_2d.bc postgis-3/gserialized_gist_nd.bc postgis-3/gserialized_supportfn.bc postgis-3/gserialized_spgist_2d.bc postgis-3/gserialized_spgist_3d.bc postgis-3/gserialized_spgist_nd.bc postgis-3/brin_2d.bc postgis-3/brin_nd.bc postgis-3/brin_common.bc postgis-3/gserialized_estimate.bc postgis-3/geography_inout.bc postgis-3/geography_btree.bc postgis-3/geography_centroid.bc postgis-3/geography_measurement.bc postgis-3/geography_measurement_trees.bc postgis-3/geometry_inout.bc postgis-3/postgis_libprotobuf.bc postgis-3/vector_tile.pb-c.bc postgis-3/geobuf.pb-c.bc postgis-3/mvt.bc postgis-3/lwgeom_out_mvt.bc postgis-3/geobuf.bc postgis-3/lwgeom_out_geobuf.bc postgis-3/lwgeom_out_geojson.bc postgis-3/flatgeobuf.bc postgis-3/lwgeom_in_flatgeobuf.bc postgis-3/lwgeom_out_flatgeobuf.bc postgis-3/postgis_legacy.bc
LLVM ERROR: ThinLTO cannot create input file: Unknown attribute kind (91) (Producer: 'LLVM18.1.5' Reader: 'LLVM 17.0.6')
PLEASE submit a bug report to https://github.com/llvm/llvm-project/issues/ and include the crash backtrace.
Stack dump:
0.  Program arguments: /usr/lib/llvm/17/bin/llvm-lto -thinlto -thinlto-action=thinlink -o postgis-3.index.bc postgis-3/postgis_module.bc postgis-3/lwgeom_accum.bc postgis-3/lwgeom_union.bc postgis-3/lwgeom_spheroid.bc postgis-3/lwgeom_ogc.bc postgis-3/lwgeom_functions_analytic.bc postgis-3/lwgeom_inout.bc postgis-3/lwgeom_functions_basic.bc postgis-3/lwgeom_btree.bc postgis-3/lwgeom_box.bc postgis-3/lwgeom_box3d.bc postgis-3/lwgeom_geos.bc postgis-3/lwgeom_geos_prepared.bc postgis-3/lwgeom_geos_clean.bc postgis-3/lwgeom_geos_relatematch.bc postgis-3/lwgeom_generate_grid.bc postgis-3/lwgeom_export.bc postgis-3/lwgeom_in_gml.bc postgis-3/lwgeom_in_kml.bc postgis-3/lwgeom_in_marc21.bc postgis-3/lwgeom_out_marc21.bc postgis-3/lwgeom_in_geohash.bc postgis-3/lwgeom_in_geojson.bc postgis-3/lwgeom_in_encoded_polyline.bc postgis-3/lwgeom_triggers.bc postgis-3/lwgeom_dump.bc postgis-3/lwgeom_dumppoints.bc postgis-3/lwgeom_functions_lrs.bc postgis-3/lwgeom_functions_temporal.bc postgis-3/lwgeom_rectree.bc postgis-3/long_xact.bc postgis-3/lwgeom_sqlmm.bc postgis-3/lwgeom_rtree.bc postgis-3/lwgeom_transform.bc postgis-3/lwgeom_window.bc postgis-3/gserialized_typmod.bc postgis-3/gserialized_gist_2d.bc postgis-3/gserialized_gist_nd.bc postgis-3/gserialized_supportfn.bc postgis-3/gserialized_spgist_2d.bc postgis-3/gserialized_spgist_3d.bc postgis-3/gserialized_spgist_nd.bc postgis-3/brin_2d.bc postgis-3/brin_nd.bc postgis-3/brin_common.bc postgis-3/gserialized_estimate.bc postgis-3/geography_inout.bc postgis-3/geography_btree.bc postgis-3/geography_centroid.bc postgis-3/geography_measurement.bc postgis-3/geography_measurement_trees.bc postgis-3/geometry_inout.bc postgis-3/postgis_libprotobuf.bc postgis-3/vector_tile.pb-c.bc postgis-3/geobuf.pb-c.bc postgis-3/mvt.bc postgis-3/lwgeom_out_mvt.bc postgis-3/geobuf.bc postgis-3/lwgeom_out_geobuf.bc postgis-3/lwgeom_out_geojson.bc postgis-3/flatgeobuf.bc postgis-3/lwgeom_in_flatgeobuf.bc postgis-3/lwgeom_out_flatgeobuf.bc postgis-3/postgis_legacy.bc
 #0 0x00007f40764b202b llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0xc9902b)
 #1 0x00007f40764afb7b llvm::sys::RunSignalHandlers() (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0xc96b7b)
 #2 0x00007f40764afcd6 (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0xc96cd6)
 #3 0x00007f407535a5b0 (/usr/lib64/libc.so.6+0x395b0)
 #4 0x00007f40753a8b1c (/usr/lib64/libc.so.6+0x87b1c)
 #5 0x00007f407535a512 gsignal (/usr/lib64/libc.so.6+0x39512)
 #6 0x00007f40753434ed abort (/usr/lib64/libc.so.6+0x224ed)
 #7 0x00007f4076024a07 (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0x80ba07)
 #8 0x00007f4077d9f01b llvm::ThinLTOCodeGenerator::addModule(llvm::StringRef, llvm::StringRef) (/usr/lib/llvm/17/bin/../lib64/libLLVM-17.so+0x258601b)
 #9 0x000055872c5a7193 (/usr/lib/llvm/17/bin/llvm-lto+0x1a193)
#10 0x000055872c59ad04 (/usr/lib/llvm/17/bin/llvm-lto+0xdd04)
#11 0x00007f4075344c8a (/usr/lib64/libc.so.6+0x23c8a)
#12 0x00007f4075344d45 __libc_start_main (/usr/lib64/libc.so.6+0x23d45)
#13 0x000055872c59ccd1 (/usr/lib/llvm/17/bin/llvm-lto+0xfcd1)

Is the LTO format backwards compatible?

cachemeifyoucan commented 3 months ago

The Reader has to be newer than Producer and that is the only compatibility we support. That means the LLVM version used when you are linking has to be newer than the version that used to compile any of the source file.

This behaves correctly.