Bug 244403 - databases/postgresql11-server: Fix build with clang 10.0.0
Summary: databases/postgresql11-server: Fix build with clang 10.0.0
Status: Open
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Some People
Assignee: pgsql
URL:
Keywords:
Depends on:
Blocks: 244251
  Show dependency treegraph
 
Reported: 2020-02-25 18:02 UTC by Dimitry Andric
Modified: 2020-02-26 23:16 UTC (History)
2 users (show)

See Also:
bugzilla: maintainer-feedback? (pgsql)


Attachments
Ensure postgresl-server ports use clang90 (782 bytes, patch)
2020-02-25 19:08 UTC, Dimitry Andric
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer 2020-02-25 18:02:24 UTC
As reported in bug 244251, with clang 10.0.0 the databases/postgresql11-server port fails to build with a fatal llvm-lto error:

cd '/wrkdirs/usr/ports/databases/postgresql11-server/work/stage/usr/local/lib/postgresql/bitcode' && /usr/local/llvm90/bin/llvm-lto -thinlto -thinlto-action=thinlink -o postgres.index.bc [... lots of .bc files ...]
error: can't create module summary index for buffer: Invalid summary version 8. Version should be in the range [1-7].
LLVM ERROR: ThinLink didn't create an index

This is because the .bc files are produced by /usr/bin/clang, which is clang 10.0.0 in the clang1000-import branch, while the llvm-lto command line uses the executable from the llvm90 port.

The bitcode is not backwards compatible, so the easiest solution is probably to make the port also *compile* with clang90, similar to what e.g. firefox and other ports do.

Alternatively, we could see if a llvm100 port becomes available, and use the llvm-lto tool from that?
Comment 1 Dimitry Andric freebsd_committer 2020-02-25 19:08:28 UTC
Created attachment 211936 [details]
Ensure postgresl-server ports use clang90

Here is a patch that appears to work, for me at least.  It sets CC, CPP and CXX to the executables from the llvm90 port, and also puts CLANG=${CC} into the configure environment.  The CLANG variable is specifically used by the postgresql Makefiles to produce bitcode.
Comment 2 Palle Girgensohn freebsd_committer 2020-02-26 23:16:50 UTC
Nice, I'll check it out. It should only be needed when the LLVM option is on.