I'm trying to build PostgreSQL 13 server with LLVM JIT enabled from ports, but packaging phase fails due to missing next files:
[00:07:44] =======================<phase: package >============================
[00:07:44] ===> Building package for postgresql13-server-13.0
[00:07:44] pkg-static: Unable to access file /wrkdirs/usr/ports/databases/postgresql13-server/work/stage/usr/local/lib/postgresql/bitcode/postgres/access/heap/tuptoaster.bc:No such file or directory
[00:07:44] pkg-static: Unable to access file /wrkdirs/usr/ports/databases/postgresql13-server/work/stage/usr/local/lib/postgresql/bitcode/postgres/lib/stringinfo.bc:No such file or directory
[00:07:44] pkg-static: Unable to access file /wrkdirs/usr/ports/databases/postgresql13-server/work/stage/usr/local/lib/postgresql/bitcode/postgres/utils/adt/txid.bc:No such file or directory
[00:07:44] pkg-static: Unable to access file /wrkdirs/usr/ports/databases/postgresql13-server/work/stage/usr/local/lib/postgresql/bitcode/postgres/utils/hash/hashfn.bc:No such file or directory
[00:07:44] pkg-static: Unable to access file /wrkdirs/usr/ports/databases/postgresql13-server/work/stage/usr/local/lib/postgresql/bitcode/postgres/utils/mb/encnames.bc:No such file or directory
[00:07:44] pkg-static: Unable to access file /wrkdirs/usr/ports/databases/postgresql13-server/work/stage/usr/local/lib/postgresql/bitcode/postgres/utils/mb/wchar.bc:No such file or directory
FreeBSD 12.1 amd64.
*** Bug 249887 has been marked as a duplicate of this bug. ***
Created attachment 218292 [details]
Patch to fix build problems WRT llvm
Does this patch help?
It works for me, but the port is acting a bit strange WRT option settings.
(In reply to Palle Girgensohn from comment #2)
Yes, it does. The port passess all build stages successfully since I've applied the attached patch. Thank you!
A commit references this bug:
Date: Sun Sep 27 20:17:58 UTC 2020
New revision: 550339
Fix building with LLVM
Fix a plist issue .
Make sure the LLVM options are correctly handled. Setting the OPTIONS_DEFAULT
conditionally based on wheather the default compiler is cland doesn't work
properly, it is always set even if you deselect it. Just setting it per default
seems to work better.
Attempt a fix for building on FreeBSD-13.0 where clang is newer than the
default LLVM. First attempt is to use an lower version clang to match what LLVM
has as default. 
PR: 244403 , 249933 , 249875 
Fix committed. Thanks for the report!