Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sniff for libclang-version-correct headers #1325

Conversation

workingjubilee
Copy link
Member

@workingjubilee workingjubilee commented Oct 10, 2023

Bindgen's strategy of autodetecting headers attempts to use a hacky route used by clang-sys, however, it doesn't take into account that the strategy of clang-sys uses $CLANG_PATH instead of $LIBCLANG_PATH, and then falls back to searching the entire directory structure. This means it's fairly easy for it to pull the headers for a different version, trying to compile them with the wrong clang!

This adopts a mesh of approaches, using the collected information from pg_config, clang-sys, and rust-bindgen to try to locate the correct compiler headers. If it can't find anything, it falls back to doing what currently happens.

@BradyBonnette
Copy link
Contributor

🙈

@eeeebbbbrrrr
Copy link
Contributor

I got cha! #1326

You can probably close this.

@workingjubilee
Copy link
Member Author

Hmm, yeah I won't have time to investigate a "proper" fix right now. Thanks!

@workingjubilee
Copy link
Member Author

Actually, it turns out I don't feel I have a choice!

@workingjubilee workingjubilee marked this pull request as draft November 9, 2023 20:05
@workingjubilee workingjubilee force-pushed the fix-pg16-clang-problems branch 2 times, most recently from 561b267 to cbafd30 Compare November 10, 2023 01:04
@workingjubilee
Copy link
Member Author

Okay, so the answer is to override the include path so that it points invariably at the same root.

This is the map of our includes:

2023-11-10T02:09:07.2710385Z   . /usr/include/postgresql/16/server/postgres.h
2023-11-10T02:09:07.2710779Z   .. /usr/include/postgresql/16/server/c.h
2023-11-10T02:09:07.2711204Z   ... /usr/include/postgresql/16/server/postgres_ext.h
2023-11-10T02:09:07.2711785Z   .... /usr/include/postgresql/16/server/pg_config_ext.h
2023-11-10T02:09:07.2712270Z   ... /usr/include/postgresql/16/server/pg_config.h
2023-11-10T02:09:07.2712885Z   ... /usr/include/postgresql/16/server/pg_config_manual.h
2023-11-10T02:09:07.2713335Z   ... /usr/include/postgresql/16/server/pg_config_os.h
2023-11-10T02:09:07.2713711Z   ... /usr/include/stdio.h
2023-11-10T02:09:07.2714123Z   .... /usr/include/x86_64-linux-gnu/bits/libc-header-start.h
2023-11-10T02:09:07.2714528Z   ..... /usr/include/features.h
2023-11-10T02:09:07.2714875Z   ...... /usr/include/features-time64.h
2023-11-10T02:09:07.2715298Z   ....... /usr/include/x86_64-linux-gnu/bits/wordsize.h
2023-11-10T02:09:07.2715980Z   ....... /usr/include/x86_64-linux-gnu/bits/timesize.h
2023-11-10T02:09:07.2716479Z   ........ /usr/include/x86_64-linux-gnu/bits/wordsize.h
2023-11-10T02:09:07.2716887Z   ...... /usr/include/stdc-predef.h
2023-11-10T02:09:07.2717280Z   ...... /usr/include/x86_64-linux-gnu/sys/cdefs.h
2023-11-10T02:09:07.2717726Z   ....... /usr/include/x86_64-linux-gnu/bits/wordsize.h
2023-11-10T02:09:07.2718204Z   ....... /usr/include/x86_64-linux-gnu/bits/long-double.h
2023-11-10T02:09:07.2718917Z   ...... /usr/include/x86_64-linux-gnu/gnu/stubs.h
2023-11-10T02:09:07.2719359Z   ....... /usr/include/x86_64-linux-gnu/gnu/stubs-64.h
2023-11-10T02:09:07.2719856Z   .... /usr/lib/llvm-14/lib/clang/14.0.0/include/stddef.h
2023-11-10T02:09:07.2720405Z   .... /usr/lib/llvm-14/lib/clang/14.0.0/include/stdarg.h
2023-11-10T02:09:07.2720855Z   .... /usr/include/x86_64-linux-gnu/bits/types.h
2023-11-10T02:09:07.2721290Z   ..... /usr/include/x86_64-linux-gnu/bits/wordsize.h
2023-11-10T02:09:07.2721745Z   ..... /usr/include/x86_64-linux-gnu/bits/timesize.h
2023-11-10T02:09:07.2722201Z   ...... /usr/include/x86_64-linux-gnu/bits/wordsize.h
2023-11-10T02:09:07.2722664Z   ..... /usr/include/x86_64-linux-gnu/bits/typesizes.h
2023-11-10T02:09:07.2723276Z   ..... /usr/include/x86_64-linux-gnu/bits/time64.h
2023-11-10T02:09:07.2723762Z   .... /usr/include/x86_64-linux-gnu/bits/types/__fpos_t.h
2023-11-10T02:09:07.2724264Z   ..... /usr/include/x86_64-linux-gnu/bits/types/__mbstate_t.h
2023-11-10T02:09:07.2724785Z   .... /usr/include/x86_64-linux-gnu/bits/types/__fpos64_t.h
2023-11-10T02:09:07.2725280Z   .... /usr/include/x86_64-linux-gnu/bits/types/__FILE.h
2023-11-10T02:09:07.2725750Z   .... /usr/include/x86_64-linux-gnu/bits/types/FILE.h
2023-11-10T02:09:07.2726236Z   .... /usr/include/x86_64-linux-gnu/bits/types/struct_FILE.h
2023-11-10T02:09:07.2726719Z   .... /usr/include/x86_64-linux-gnu/bits/stdio_lim.h
2023-11-10T02:09:07.2727157Z   .... /usr/include/x86_64-linux-gnu/bits/floatn.h
2023-11-10T02:09:07.2727618Z   ..... /usr/include/x86_64-linux-gnu/bits/floatn-common.h
2023-11-10T02:09:07.2728100Z   ...... /usr/include/x86_64-linux-gnu/bits/long-double.h
2023-11-10T02:09:07.2728467Z   ... /usr/include/stdlib.h
2023-11-10T02:09:07.2728877Z   .... /usr/include/x86_64-linux-gnu/bits/libc-header-start.h
2023-11-10T02:09:07.2729368Z   .... /usr/lib/llvm-14/lib/clang/14.0.0/include/stddef.h
2023-11-10T02:09:07.2729833Z   .... /usr/include/x86_64-linux-gnu/bits/waitflags.h
2023-11-10T02:09:07.2730289Z   .... /usr/include/x86_64-linux-gnu/bits/waitstatus.h
2023-11-10T02:09:07.2730727Z   .... /usr/include/x86_64-linux-gnu/sys/types.h
2023-11-10T02:09:07.2731188Z   ..... /usr/include/x86_64-linux-gnu/bits/types/clock_t.h
2023-11-10T02:09:07.2731689Z   ..... /usr/include/x86_64-linux-gnu/bits/types/clockid_t.h
2023-11-10T02:09:07.2732185Z   ..... /usr/include/x86_64-linux-gnu/bits/types/time_t.h
2023-11-10T02:09:07.2732686Z   ..... /usr/include/x86_64-linux-gnu/bits/types/timer_t.h
2023-11-10T02:09:07.2733159Z   ..... /usr/lib/llvm-14/lib/clang/14.0.0/include/stddef.h
2023-11-10T02:09:07.2733633Z   ..... /usr/include/x86_64-linux-gnu/bits/stdint-intn.h
2023-11-10T02:09:07.2734005Z   ..... /usr/include/endian.h
2023-11-10T02:09:07.2734378Z   ...... /usr/include/x86_64-linux-gnu/bits/endian.h
2023-11-10T02:09:07.2734839Z   ....... /usr/include/x86_64-linux-gnu/bits/endianness.h
2023-11-10T02:09:07.2735303Z   ...... /usr/include/x86_64-linux-gnu/bits/byteswap.h
2023-11-10T02:09:07.2735785Z   ...... /usr/include/x86_64-linux-gnu/bits/uintn-identity.h
2023-11-10T02:09:07.2736399Z   ..... /usr/include/x86_64-linux-gnu/sys/select.h
2023-11-10T02:09:07.2736838Z   ...... /usr/include/x86_64-linux-gnu/bits/select.h
2023-11-10T02:09:07.2737307Z   ...... /usr/include/x86_64-linux-gnu/bits/types/sigset_t.h
2023-11-10T02:09:07.2737818Z   ....... /usr/include/x86_64-linux-gnu/bits/types/__sigset_t.h
2023-11-10T02:09:07.2738357Z   ...... /usr/include/x86_64-linux-gnu/bits/types/struct_timeval.h
2023-11-10T02:09:07.2738918Z   ...... /usr/include/x86_64-linux-gnu/bits/types/struct_timespec.h
2023-11-10T02:09:07.2739443Z   ..... /usr/include/x86_64-linux-gnu/bits/pthreadtypes.h
2023-11-10T02:09:07.2739963Z   ...... /usr/include/x86_64-linux-gnu/bits/thread-shared-types.h
2023-11-10T02:09:07.2740514Z   ....... /usr/include/x86_64-linux-gnu/bits/pthreadtypes-arch.h
2023-11-10T02:09:07.2741018Z   ........ /usr/include/x86_64-linux-gnu/bits/wordsize.h
2023-11-10T02:09:07.2741525Z   ....... /usr/include/x86_64-linux-gnu/bits/atomic_wide_counter.h
2023-11-10T02:09:07.2742048Z   ....... /usr/include/x86_64-linux-gnu/bits/struct_mutex.h
2023-11-10T02:09:07.2742541Z   ....... /usr/include/x86_64-linux-gnu/bits/struct_rwlock.h
2023-11-10T02:09:07.2742918Z   .... /usr/include/alloca.h
2023-11-10T02:09:07.2743311Z   ..... /usr/lib/llvm-14/lib/clang/14.0.0/include/stddef.h
2023-11-10T02:09:07.2743794Z   .... /usr/include/x86_64-linux-gnu/bits/stdlib-float.h
2023-11-10T02:09:07.2744168Z   ... /usr/include/string.h
2023-11-10T02:09:07.2744566Z   .... /usr/include/x86_64-linux-gnu/bits/libc-header-start.h
2023-11-10T02:09:07.2745065Z   .... /usr/lib/llvm-14/lib/clang/14.0.0/include/stddef.h
2023-11-10T02:09:07.2745549Z   .... /usr/include/x86_64-linux-gnu/bits/types/locale_t.h
2023-11-10T02:09:07.2746165Z   ..... /usr/include/x86_64-linux-gnu/bits/types/__locale_t.h
2023-11-10T02:09:07.2746559Z   .... /usr/include/strings.h
2023-11-10T02:09:07.2746949Z   ..... /usr/lib/llvm-14/lib/clang/14.0.0/include/stddef.h
2023-11-10T02:09:07.2747424Z   ... /usr/lib/llvm-14/lib/clang/14.0.0/include/stddef.h
2023-11-10T02:09:07.2747978Z   .... /usr/lib/llvm-14/lib/clang/14.0.0/include/__stddef_max_align_t.h
2023-11-10T02:09:07.2748510Z   ... /usr/lib/llvm-14/lib/clang/14.0.0/include/stdint.h
2023-11-10T02:09:07.2748884Z   .... /usr/include/stdint.h
2023-11-10T02:09:07.2749289Z   ..... /usr/include/x86_64-linux-gnu/bits/libc-header-start.h
2023-11-10T02:09:07.2749762Z   ..... /usr/include/x86_64-linux-gnu/bits/wchar.h
2023-11-10T02:09:07.2750206Z   ..... /usr/include/x86_64-linux-gnu/bits/wordsize.h
2023-11-10T02:09:07.2750670Z   ..... /usr/include/x86_64-linux-gnu/bits/stdint-uintn.h
2023-11-10T02:09:07.2751045Z   ... /usr/include/errno.h
2023-11-10T02:09:07.2751394Z   .... /usr/include/x86_64-linux-gnu/bits/errno.h
2023-11-10T02:09:07.2751758Z   ..... /usr/include/linux/errno.h
2023-11-10T02:09:07.2752139Z   ...... /usr/include/x86_64-linux-gnu/asm/errno.h
2023-11-10T02:09:07.2752550Z   ....... /usr/include/asm-generic/errno.h
2023-11-10T02:09:07.2752962Z   ........ /usr/include/asm-generic/errno-base.h
2023-11-10T02:09:07.2753321Z   ... /usr/include/locale.h
2023-11-10T02:09:07.2753705Z   .... /usr/lib/llvm-14/lib/clang/14.0.0/include/stddef.h
2023-11-10T02:09:07.2754159Z   .... /usr/include/x86_64-linux-gnu/bits/locale.h
2023-11-10T02:09:07.2754525Z   ... /usr/include/libintl.h
2023-11-10T02:09:07.2754906Z   ... /usr/lib/llvm-14/lib/clang/14.0.0/include/stdbool.h
2023-11-10T02:09:07.2755333Z   ... /usr/include/postgresql/16/server/port.h
2023-11-10T02:09:07.2755699Z   .... /usr/include/ctype.h
2023-11-10T02:09:07.2755979Z   .... /usr/include/math.h
2023-11-10T02:09:07.2756406Z   ..... /usr/include/x86_64-linux-gnu/bits/libc-header-start.h
2023-11-10T02:09:07.2756907Z   ..... /usr/include/x86_64-linux-gnu/bits/math-vector.h
2023-11-10T02:09:07.2757426Z   ...... /usr/include/x86_64-linux-gnu/bits/libm-simd-decl-stubs.h
2023-11-10T02:09:07.2757963Z   ..... /usr/include/x86_64-linux-gnu/bits/flt-eval-method.h
2023-11-10T02:09:07.2758631Z   ..... /usr/include/x86_64-linux-gnu/bits/fp-logb.h
2023-11-10T02:09:07.2759242Z   ..... /usr/include/x86_64-linux-gnu/bits/fp-fast.h
2023-11-10T02:09:07.2759779Z   ..... /usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h
2023-11-10T02:09:07.2760374Z   ..... /usr/include/x86_64-linux-gnu/bits/mathcalls.h
2023-11-10T02:09:07.2761295Z   ..... /usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h
2023-11-10T02:09:07.2762219Z   ..... /usr/include/x86_64-linux-gnu/bits/mathcalls.h
2023-11-10T02:09:07.2762990Z   ..... /usr/include/x86_64-linux-gnu/bits/mathcalls-helper-functions.h
2023-11-10T02:09:07.2763523Z   ..... /usr/include/x86_64-linux-gnu/bits/mathcalls.h
2023-11-10T02:09:07.2763942Z   .. /usr/include/postgresql/16/server/utils/elog.h
2023-11-10T02:09:07.2764322Z   ... /usr/include/setjmp.h
2023-11-10T02:09:07.2764689Z   .... /usr/include/x86_64-linux-gnu/bits/setjmp.h
2023-11-10T02:09:07.2765139Z   ..... /usr/include/x86_64-linux-gnu/bits/wordsize.h
2023-11-10T02:09:07.2765670Z   .... /usr/include/x86_64-linux-gnu/bits/types/struct___jmp_buf_tag.h
2023-11-10T02:09:07.2766188Z   ... /usr/include/postgresql/16/server/lib/stringinfo.h
2023-11-10T02:09:07.2766647Z   ... /usr/include/postgresql/16/server/utils/errcodes.h
2023-11-10T02:09:07.2767089Z   .. /usr/include/postgresql/16/server/utils/palloc.h
2023-11-10T02:09:07.2767514Z   . /usr/include/postgresql/16/server/pg_config.h
2023-11-10T02:09:07.2767913Z   . /usr/include/postgresql/16/server/funcapi.h
2023-11-10T02:09:07.2768336Z   .. /usr/include/postgresql/16/server/access/tupdesc.h
2023-11-10T02:09:07.2768782Z   ... /usr/include/postgresql/16/server/access/attnum.h
2023-11-10T02:09:07.2769257Z   ... /usr/include/postgresql/16/server/catalog/pg_attribute.h
2023-11-10T02:09:07.2769910Z   .... /usr/include/postgresql/16/server/catalog/genbki.h
2023-11-10T02:09:07.2770414Z   .... /usr/include/postgresql/16/server/catalog/pg_attribute_d.h
2023-11-10T02:09:07.2770909Z   ... /usr/include/postgresql/16/server/nodes/pg_list.h
2023-11-10T02:09:07.2771356Z   .... /usr/include/postgresql/16/server/nodes/nodes.h
2023-11-10T02:09:07.2771815Z   ..... /usr/include/postgresql/16/server/nodes/nodetags.h
2023-11-10T02:09:07.2772292Z   .. /usr/include/postgresql/16/server/executor/executor.h
2023-11-10T02:09:07.2772766Z   ... /usr/include/postgresql/16/server/executor/execdesc.h
2023-11-10T02:09:07.2773235Z   .... /usr/include/postgresql/16/server/nodes/execnodes.h
2023-11-10T02:09:07.2773710Z   ..... /usr/include/postgresql/16/server/access/tupconvert.h
2023-11-10T02:09:07.2774181Z   ...... /usr/include/postgresql/16/server/access/attmap.h
2023-11-10T02:09:07.2774623Z   ...... /usr/include/postgresql/16/server/access/htup.h
2023-11-10T02:09:07.2775083Z   ....... /usr/include/postgresql/16/server/storage/itemptr.h
2023-11-10T02:09:07.2775554Z   ........ /usr/include/postgresql/16/server/storage/block.h
2023-11-10T02:09:07.2776003Z   ........ /usr/include/postgresql/16/server/storage/off.h
2023-11-10T02:09:07.2776458Z   ......... /usr/include/postgresql/16/server/storage/itemid.h
2023-11-10T02:09:07.2776938Z   ...... /usr/include/postgresql/16/server/executor/tuptable.h
2023-11-10T02:09:07.2777440Z   ....... /usr/include/postgresql/16/server/access/htup_details.h
2023-11-10T02:09:07.2777921Z   ........ /usr/include/postgresql/16/server/access/transam.h
2023-11-10T02:09:07.2778390Z   ......... /usr/include/postgresql/16/server/access/xlogdefs.h
2023-11-10T02:09:07.2778807Z   .......... /usr/include/fcntl.h
2023-11-10T02:09:07.2779213Z   ........... /usr/include/x86_64-linux-gnu/bits/fcntl.h
2023-11-10T02:09:07.2779696Z   ............ /usr/include/x86_64-linux-gnu/bits/fcntl-linux.h
2023-11-10T02:09:07.2780175Z   ........... /usr/include/x86_64-linux-gnu/bits/stat.h
2023-11-10T02:09:07.2780650Z   ............ /usr/include/x86_64-linux-gnu/bits/struct_stat.h
2023-11-10T02:09:07.2781115Z   ........ /usr/include/postgresql/16/server/access/tupmacs.h
2023-11-10T02:09:07.2781600Z   ......... /usr/include/postgresql/16/server/catalog/pg_type_d.h
2023-11-10T02:09:07.2782098Z   ........ /usr/include/postgresql/16/server/storage/bufpage.h
2023-11-10T02:09:07.2782727Z   ......... /usr/include/postgresql/16/server/storage/item.h
2023-11-10T02:09:07.2783164Z   ........ /usr/include/postgresql/16/server/varatt.h
2023-11-10T02:09:07.2783603Z   ....... /usr/include/postgresql/16/server/access/sysattr.h
2023-11-10T02:09:07.2784054Z   ....... /usr/include/postgresql/16/server/storage/buf.h
2023-11-10T02:09:07.2784503Z   ...... /usr/include/postgresql/16/server/nodes/bitmapset.h
2023-11-10T02:09:07.2784980Z   ..... /usr/include/postgresql/16/server/executor/instrument.h
2023-11-10T02:09:07.2785506Z   ...... /usr/include/postgresql/16/server/portability/instr_time.h
2023-11-10T02:09:07.2785940Z   ....... /usr/include/time.h
2023-11-10T02:09:07.2786349Z   ........ /usr/lib/llvm-14/lib/clang/14.0.0/include/stddef.h
2023-11-10T02:09:07.2786813Z   ........ /usr/include/x86_64-linux-gnu/bits/time.h
2023-11-10T02:09:07.2787293Z   ........ /usr/include/x86_64-linux-gnu/bits/types/struct_tm.h
2023-11-10T02:09:07.2787847Z   ........ /usr/include/x86_64-linux-gnu/bits/types/struct_itimerspec.h
2023-11-10T02:09:07.2788317Z   ..... /usr/include/postgresql/16/server/fmgr.h
2023-11-10T02:09:07.2788719Z   ..... /usr/include/postgresql/16/server/lib/ilist.h
2023-11-10T02:09:07.2789169Z   ..... /usr/include/postgresql/16/server/lib/pairingheap.h
2023-11-10T02:09:07.2789626Z   ..... /usr/include/postgresql/16/server/nodes/params.h
2023-11-10T02:09:07.2790078Z   ..... /usr/include/postgresql/16/server/nodes/plannodes.h
2023-11-10T02:09:07.2790525Z   ...... /usr/include/postgresql/16/server/access/sdir.h
2023-11-10T02:09:07.2790969Z   ...... /usr/include/postgresql/16/server/access/stratnum.h
2023-11-10T02:09:07.2791428Z   ...... /usr/include/postgresql/16/server/common/relpath.h
2023-11-10T02:09:07.2792030Z   ....... /usr/include/postgresql/16/server/catalog/catversion.h
2023-11-10T02:09:07.2792524Z   ...... /usr/include/postgresql/16/server/nodes/lockoptions.h
2023-11-10T02:09:07.2793004Z   ...... /usr/include/postgresql/16/server/nodes/parsenodes.h
2023-11-10T02:09:07.2793485Z   ....... /usr/include/postgresql/16/server/nodes/primnodes.h
2023-11-10T02:09:07.2793948Z   ....... /usr/include/postgresql/16/server/nodes/value.h
2023-11-10T02:09:07.2794450Z   ....... /usr/include/postgresql/16/server/partitioning/partdefs.h
2023-11-10T02:09:07.2794960Z   ..... /usr/include/postgresql/16/server/nodes/tidbitmap.h
2023-11-10T02:09:07.2795412Z   ...... /usr/include/postgresql/16/server/utils/dsa.h
2023-11-10T02:09:07.2795865Z   ....... /usr/include/postgresql/16/server/port/atomics.h
2023-11-10T02:09:07.2796371Z   ........ /usr/lib/llvm-14/lib/clang/14.0.0/include/limits.h
2023-11-10T02:09:07.2796761Z   ......... /usr/include/limits.h
2023-11-10T02:09:07.2797206Z   .......... /usr/include/x86_64-linux-gnu/bits/libc-header-start.h
2023-11-10T02:09:07.2797718Z   .......... /usr/include/x86_64-linux-gnu/bits/posix1_lim.h
2023-11-10T02:09:07.2798200Z   ........... /usr/include/x86_64-linux-gnu/bits/wordsize.h
2023-11-10T02:09:07.2798868Z   ........... /usr/include/x86_64-linux-gnu/bits/local_lim.h
2023-11-10T02:09:07.2799271Z   ............ /usr/include/linux/limits.h
2023-11-10T02:09:07.2799775Z   ............ /usr/include/x86_64-linux-gnu/bits/pthread_stack_min-dynamic.h
2023-11-10T02:09:07.2800364Z   ............. /usr/include/x86_64-linux-gnu/bits/pthread_stack_min.h
2023-11-10T02:09:07.2800882Z   .......... /usr/include/x86_64-linux-gnu/bits/posix2_lim.h
2023-11-10T02:09:07.2801426Z   ........ /usr/include/postgresql/16/server/port/atomics/arch-x86.h
2023-11-10T02:09:07.2802033Z   ........ /usr/include/postgresql/16/server/port/atomics/generic-gcc.h
2023-11-10T02:09:07.2802588Z   ........ /usr/include/postgresql/16/server/port/atomics/fallback.h
2023-11-10T02:09:07.2803127Z   ........ /usr/include/postgresql/16/server/port/atomics/generic.h
2023-11-10T02:09:07.2803604Z   ....... /usr/include/postgresql/16/server/storage/dsm.h
2023-11-10T02:09:07.2804068Z   ........ /usr/include/postgresql/16/server/storage/dsm_impl.h
2023-11-10T02:09:07.2804600Z   ..... /usr/include/postgresql/16/server/storage/condition_variable.h
2023-11-10T02:09:07.2805313Z   ...... /usr/include/postgresql/16/server/storage/proclist_types.h
2023-11-10T02:09:07.2805816Z   ...... /usr/include/postgresql/16/server/storage/spin.h
2023-11-10T02:09:07.2806277Z   ....... /usr/include/postgresql/16/server/storage/s_lock.h
2023-11-10T02:09:07.2806758Z   ..... /usr/include/postgresql/16/server/utils/hsearch.h
2023-11-10T02:09:07.2807293Z   ..... /usr/include/postgresql/16/server/utils/queryenvironment.h
2023-11-10T02:09:07.2807820Z   ..... /usr/include/postgresql/16/server/utils/reltrigger.h
2023-11-10T02:09:07.2808327Z   ..... /usr/include/postgresql/16/server/utils/sharedtuplestore.h
2023-11-10T02:09:07.2808809Z   ...... /usr/include/postgresql/16/server/storage/fd.h
2023-11-10T02:09:07.2809190Z   ....... /usr/include/dirent.h
2023-11-10T02:09:07.2809584Z   ........ /usr/include/x86_64-linux-gnu/bits/dirent.h
2023-11-10T02:09:07.2810069Z   ........ /usr/lib/llvm-14/lib/clang/14.0.0/include/stddef.h
2023-11-10T02:09:07.2810559Z   ........ /usr/include/x86_64-linux-gnu/bits/dirent_ext.h
2023-11-10T02:09:07.2811046Z   ...... /usr/include/postgresql/16/server/storage/sharedfileset.h
2023-11-10T02:09:07.2811547Z   ....... /usr/include/postgresql/16/server/storage/fileset.h
2023-11-10T02:09:07.2812053Z   ..... /usr/include/postgresql/16/server/utils/snapshot.h
2023-11-10T02:09:07.2812534Z   ...... /usr/include/postgresql/16/server/datatype/timestamp.h
2023-11-10T02:09:07.2813066Z   ..... /usr/include/postgresql/16/server/utils/sortsupport.h
2023-11-10T02:09:07.2813542Z   ...... /usr/include/postgresql/16/server/utils/relcache.h
2023-11-10T02:09:07.2814002Z   ..... /usr/include/postgresql/16/server/utils/tuplesort.h
2023-11-10T02:09:07.2814742Z   ...... /usr/include/postgresql/16/server/access/itup.h
2023-11-10T02:09:07.2815196Z   ...... /usr/include/postgresql/16/server/utils/logtape.h
2023-11-10T02:09:07.2815659Z   ..... /usr/include/postgresql/16/server/utils/tuplestore.h
2023-11-10T02:09:07.2816125Z   ..... /usr/include/postgresql/16/server/lib/simplehash.h
2023-11-10T02:09:07.2816586Z   ...... /usr/include/postgresql/16/server/port/pg_bitutils.h
2023-11-10T02:09:07.2817039Z   .... /usr/include/postgresql/16/server/tcop/dest.h
2023-11-10T02:09:07.2817464Z   ..... /usr/include/postgresql/16/server/tcop/cmdtag.h
2023-11-10T02:09:07.2817920Z   ...... /usr/include/postgresql/16/server/tcop/cmdtaglist.h
2023-11-10T02:09:07.2818397Z   ... /usr/include/postgresql/16/server/utils/memutils.h
2023-11-10T02:09:07.2818855Z   .... /usr/include/postgresql/16/server/nodes/memnodes.h
2023-11-10T02:09:07.2819285Z   . /usr/include/postgresql/16/server/miscadmin.h
2023-11-10T02:09:07.2819651Z   .. /usr/include/signal.h
2023-11-10T02:09:07.2820056Z   ... /usr/include/x86_64-linux-gnu/bits/signum-generic.h
2023-11-10T02:09:07.2820541Z   .... /usr/include/x86_64-linux-gnu/bits/signum-arch.h
2023-11-10T02:09:07.2821038Z   ... /usr/include/x86_64-linux-gnu/bits/types/sig_atomic_t.h
2023-11-10T02:09:07.2821542Z   ... /usr/include/x86_64-linux-gnu/bits/types/siginfo_t.h
2023-11-10T02:09:07.2822020Z   .... /usr/include/x86_64-linux-gnu/bits/wordsize.h
2023-11-10T02:09:07.2822502Z   .... /usr/include/x86_64-linux-gnu/bits/types/__sigval_t.h
2023-11-10T02:09:07.2823019Z   .... /usr/include/x86_64-linux-gnu/bits/siginfo-arch.h
2023-11-10T02:09:07.2823501Z   ... /usr/include/x86_64-linux-gnu/bits/siginfo-consts.h
2023-11-10T02:09:07.2823989Z   ... /usr/include/x86_64-linux-gnu/bits/types/sigval_t.h
2023-11-10T02:09:07.2824495Z   ... /usr/include/x86_64-linux-gnu/bits/types/sigevent_t.h
2023-11-10T02:09:07.2824974Z   .... /usr/include/x86_64-linux-gnu/bits/wordsize.h
2023-11-10T02:09:07.2825450Z   ... /usr/include/x86_64-linux-gnu/bits/sigevent-consts.h
2023-11-10T02:09:07.2825920Z   ... /usr/include/x86_64-linux-gnu/bits/sigaction.h
2023-11-10T02:09:07.2826370Z   ... /usr/include/x86_64-linux-gnu/bits/sigcontext.h
2023-11-10T02:09:07.2826841Z   ... /usr/lib/llvm-14/lib/clang/14.0.0/include/stddef.h
2023-11-10T02:09:07.2827313Z   ... /usr/include/x86_64-linux-gnu/bits/types/stack_t.h
2023-11-10T02:09:07.2827918Z   .... /usr/lib/llvm-14/lib/clang/14.0.0/include/stddef.h
2023-11-10T02:09:07.2828376Z   ... /usr/include/x86_64-linux-gnu/sys/ucontext.h
2023-11-10T02:09:07.2828811Z   ... /usr/include/x86_64-linux-gnu/bits/sigstack.h
2023-11-10T02:09:07.2829249Z   ... /usr/include/x86_64-linux-gnu/bits/sigstksz.h
2023-11-10T02:09:07.2829680Z   ... /usr/include/x86_64-linux-gnu/bits/ss_flags.h
2023-11-10T02:09:07.2830179Z   ... /usr/include/x86_64-linux-gnu/bits/types/struct_sigstack.h
2023-11-10T02:09:07.2830671Z   ... /usr/include/x86_64-linux-gnu/bits/sigthread.h
2023-11-10T02:09:07.2831118Z   ... /usr/include/x86_64-linux-gnu/bits/signal_ext.h
2023-11-10T02:09:07.2831521Z   .. /usr/include/postgresql/16/server/pgtime.h
2023-11-10T02:09:07.2831917Z   . /usr/include/postgresql/16/server/pgstat.h
2023-11-10T02:09:07.2832348Z   .. /usr/include/postgresql/16/server/postmaster/pgarch.h
2023-11-10T02:09:07.2832856Z   .. /usr/include/postgresql/16/server/utils/backend_progress.h
2023-11-10T02:09:07.2833382Z   .. /usr/include/postgresql/16/server/utils/backend_status.h
2023-11-10T02:09:07.2833856Z   ... /usr/include/postgresql/16/server/libpq/pqcomm.h
2023-11-10T02:09:07.2834315Z   .... /usr/include/x86_64-linux-gnu/sys/socket.h
2023-11-10T02:09:07.2834796Z   ..... /usr/include/x86_64-linux-gnu/bits/types/struct_iovec.h
2023-11-10T02:09:07.2835306Z   ...... /usr/lib/llvm-14/lib/clang/14.0.0/include/stddef.h
2023-11-10T02:09:07.2835791Z   ..... /usr/lib/llvm-14/lib/clang/14.0.0/include/stddef.h
2023-11-10T02:09:07.2836245Z   ..... /usr/include/x86_64-linux-gnu/bits/socket.h
2023-11-10T02:09:07.2836707Z   ...... /usr/lib/llvm-14/lib/clang/14.0.0/include/stddef.h
2023-11-10T02:09:07.2837307Z   ...... /usr/include/x86_64-linux-gnu/bits/socket_type.h
2023-11-10T02:09:07.2837783Z   ...... /usr/include/x86_64-linux-gnu/bits/sockaddr.h
2023-11-10T02:09:07.2838233Z   ...... /usr/include/x86_64-linux-gnu/asm/socket.h
2023-11-10T02:09:07.2838863Z   ....... /usr/include/asm-generic/socket.h
2023-11-10T02:09:07.2839238Z   ........ /usr/include/linux/posix_types.h
2023-11-10T02:09:07.2839590Z   ......... /usr/include/linux/stddef.h
2023-11-10T02:09:07.2840020Z   ......... /usr/include/x86_64-linux-gnu/asm/posix_types.h
2023-11-10T02:09:07.2840518Z   .......... /usr/include/x86_64-linux-gnu/asm/posix_types_64.h
2023-11-10T02:09:07.2840997Z   ........... /usr/include/asm-generic/posix_types.h
2023-11-10T02:09:07.2841476Z   ............ /usr/include/x86_64-linux-gnu/asm/bitsperlong.h
2023-11-10T02:09:07.2841954Z   ............. /usr/include/asm-generic/bitsperlong.h
2023-11-10T02:09:07.2842420Z   ........ /usr/include/x86_64-linux-gnu/asm/sockios.h
2023-11-10T02:09:07.2842846Z   ......... /usr/include/asm-generic/sockios.h
2023-11-10T02:09:07.2843349Z   ..... /usr/include/x86_64-linux-gnu/bits/types/struct_osockaddr.h
2023-11-10T02:09:07.2843836Z   .... /usr/include/x86_64-linux-gnu/sys/un.h
2023-11-10T02:09:07.2844179Z   .... /usr/include/netdb.h
2023-11-10T02:09:07.2844460Z   ..... /usr/include/netinet/in.h
2023-11-10T02:09:07.2844839Z   ...... /usr/include/x86_64-linux-gnu/bits/in.h
2023-11-10T02:09:07.2845282Z   ...... /usr/include/x86_64-linux-gnu/bits/byteswap.h
2023-11-10T02:09:07.2845764Z   ...... /usr/include/x86_64-linux-gnu/bits/uintn-identity.h
2023-11-10T02:09:07.2846158Z   ..... /usr/include/rpc/netdb.h
2023-11-10T02:09:07.2846565Z   ...... /usr/lib/llvm-14/lib/clang/14.0.0/include/stddef.h
2023-11-10T02:09:07.2847024Z   ..... /usr/include/x86_64-linux-gnu/bits/netdb.h
2023-11-10T02:09:07.2847466Z   ... /usr/include/postgresql/16/server/storage/backendid.h
2023-11-10T02:09:07.2847933Z   .. /usr/include/postgresql/16/server/utils/wait_event.h
2023-11-10T02:09:07.2848385Z   . /usr/include/postgresql/16/server/access/amapi.h
2023-11-10T02:09:07.2848826Z   .. /usr/include/postgresql/16/server/access/genam.h
2023-11-10T02:09:07.2849255Z   ... /usr/include/postgresql/16/server/access/skey.h
2023-11-10T02:09:07.2849702Z   ... /usr/include/postgresql/16/server/storage/lockdefs.h
2023-11-10T02:09:07.2850338Z   . /usr/include/postgresql/16/server/access/generic_xlog.h
2023-11-10T02:09:07.2850791Z   .. /usr/include/postgresql/16/server/access/xlog.h
2023-11-10T02:09:07.2851244Z   ... /usr/include/postgresql/16/server/access/xlogbackup.h
2023-11-10T02:09:07.2851728Z   .. /usr/include/postgresql/16/server/access/xlog_internal.h
2023-11-10T02:09:07.2852230Z   ... /usr/include/postgresql/16/server/access/xlogreader.h
2023-11-10T02:09:07.2852701Z   .... /usr/include/postgresql/16/server/access/xlogrecord.h
2023-11-10T02:09:07.2853161Z   ..... /usr/include/postgresql/16/server/access/rmgr.h
2023-11-10T02:09:07.2853609Z   ...... /usr/include/postgresql/16/server/access/rmgrlist.h
2023-11-10T02:09:07.2854079Z   ..... /usr/include/postgresql/16/server/port/pg_crc32c.h
2023-11-10T02:09:07.2854543Z   ...... /usr/include/postgresql/16/server/port/pg_bswap.h
2023-11-10T02:09:07.2855047Z   ..... /usr/include/postgresql/16/server/storage/relfilelocator.h
2023-11-10T02:09:07.2855557Z   .. /usr/include/postgresql/16/server/access/xloginsert.h
2023-11-10T02:09:07.2855994Z   .. /usr/include/postgresql/16/server/utils/rel.h
2023-11-10T02:09:07.2856430Z   ... /usr/include/postgresql/16/server/catalog/catalog.h
2023-11-10T02:09:07.2856893Z   .... /usr/include/postgresql/16/server/catalog/pg_class.h
2023-11-10T02:09:07.2857375Z   ..... /usr/include/postgresql/16/server/catalog/pg_class_d.h
2023-11-10T02:09:07.2857853Z   ... /usr/include/postgresql/16/server/catalog/pg_index.h
2023-11-10T02:09:07.2858322Z   .... /usr/include/postgresql/16/server/catalog/pg_index_d.h
2023-11-10T02:09:07.2858839Z   ... /usr/include/postgresql/16/server/catalog/pg_publication.h
2023-11-10T02:09:07.2859373Z   .... /usr/include/postgresql/16/server/catalog/objectaddress.h
2023-11-10T02:09:07.2860055Z   .... /usr/include/postgresql/16/server/catalog/pg_publication_d.h
2023-11-10T02:09:07.2860572Z   ... /usr/include/postgresql/16/server/rewrite/prs2lock.h
2023-11-10T02:09:07.2861023Z   ... /usr/include/postgresql/16/server/storage/smgr.h
2023-11-10T02:09:07.2861461Z   . /usr/include/postgresql/16/server/access/gin.h
2023-11-10T02:09:07.2861878Z   . /usr/include/postgresql/16/server/access/gist.h
2023-11-10T02:09:07.2862311Z   . /usr/include/postgresql/16/server/access/heapam.h
2023-11-10T02:09:07.2862768Z   .. /usr/include/postgresql/16/server/access/relation.h
2023-11-10T02:09:07.2863224Z   .. /usr/include/postgresql/16/server/access/relscan.h
2023-11-10T02:09:07.2863662Z   .. /usr/include/postgresql/16/server/access/table.h
2023-11-10T02:09:07.2864097Z   .. /usr/include/postgresql/16/server/access/tableam.h
2023-11-10T02:09:07.2864530Z   ... /usr/include/postgresql/16/server/access/xact.h
2023-11-10T02:09:07.2864970Z   .... /usr/include/postgresql/16/server/storage/sinval.h
2023-11-10T02:09:07.2865426Z   .. /usr/include/postgresql/16/server/storage/shm_toc.h
2023-11-10T02:09:07.2865871Z   ... /usr/include/postgresql/16/server/storage/shmem.h
2023-11-10T02:09:07.2866335Z   . /usr/include/postgresql/16/server/access/reloptions.h
2023-11-10T02:09:07.2866788Z   .. /usr/include/postgresql/16/server/storage/lock.h
2023-11-10T02:09:07.2867232Z   ... /usr/include/postgresql/16/server/storage/lwlock.h
2023-11-10T02:09:07.2867710Z   .... /usr/include/postgresql/16/server/storage/lwlocknames.h
2023-11-10T02:09:07.2868192Z   ... /usr/include/postgresql/16/server/utils/timestamp.h
2023-11-10T02:09:07.2868666Z   . /usr/include/postgresql/16/server/access/xlogrecovery.h
2023-11-10T02:09:07.2869154Z   .. /usr/include/postgresql/16/server/catalog/pg_control.h
2023-11-10T02:09:07.2869637Z   . /usr/include/postgresql/16/server/catalog/dependency.h
2023-11-10T02:09:07.2870099Z   . /usr/include/postgresql/16/server/catalog/index.h
2023-11-10T02:09:07.2870547Z   . /usr/include/postgresql/16/server/catalog/indexing.h
2023-11-10T02:09:07.2871013Z   . /usr/include/postgresql/16/server/catalog/namespace.h
2023-11-10T02:09:07.2871503Z   . /usr/include/postgresql/16/server/catalog/objectaccess.h
2023-11-10T02:09:07.2871974Z   . /usr/include/postgresql/16/server/catalog/pg_am.h
2023-11-10T02:09:07.2872528Z   .. /usr/include/postgresql/16/server/catalog/pg_am_d.h
2023-11-10T02:09:07.2872977Z   . /usr/include/postgresql/16/server/catalog/pg_amop.h
2023-11-10T02:09:07.2873437Z   .. /usr/include/postgresql/16/server/catalog/pg_amop_d.h
2023-11-10T02:09:07.2873907Z   . /usr/include/postgresql/16/server/catalog/pg_amproc.h
2023-11-10T02:09:07.2874382Z   .. /usr/include/postgresql/16/server/catalog/pg_amproc_d.h
2023-11-10T02:09:07.2874857Z   . /usr/include/postgresql/16/server/catalog/pg_authid.h
2023-11-10T02:09:07.2875335Z   .. /usr/include/postgresql/16/server/catalog/pg_authid_d.h
2023-11-10T02:09:07.2875829Z   . /usr/include/postgresql/16/server/catalog/pg_collation.h
2023-11-10T02:09:07.2876346Z   .. /usr/include/postgresql/16/server/catalog/pg_collation_d.h
2023-11-10T02:09:07.2876852Z   . /usr/include/postgresql/16/server/catalog/pg_database.h
2023-11-10T02:09:07.2877354Z   .. /usr/include/postgresql/16/server/catalog/pg_database_d.h
2023-11-10T02:09:07.2877841Z   . /usr/include/postgresql/16/server/catalog/pg_enum.h
2023-11-10T02:09:07.2878468Z   .. /usr/include/postgresql/16/server/catalog/pg_enum_d.h
2023-11-10T02:09:07.2878984Z   . /usr/include/postgresql/16/server/catalog/pg_extension.h
2023-11-10T02:09:07.2879498Z   .. /usr/include/postgresql/16/server/catalog/pg_extension_d.h
2023-11-10T02:09:07.2880041Z   . /usr/include/postgresql/16/server/catalog/pg_foreign_server.h
2023-11-10T02:09:07.2880596Z   .. /usr/include/postgresql/16/server/catalog/pg_foreign_server_d.h
2023-11-10T02:09:07.2881153Z   . /usr/include/postgresql/16/server/catalog/pg_foreign_table.h
2023-11-10T02:09:07.2881702Z   .. /usr/include/postgresql/16/server/catalog/pg_foreign_table_d.h
2023-11-10T02:09:07.2882230Z   . /usr/include/postgresql/16/server/catalog/pg_operator.h
2023-11-10T02:09:07.2882876Z   .. /usr/include/postgresql/16/server/catalog/pg_operator_d.h
2023-11-10T02:09:07.2883384Z   . /usr/include/postgresql/16/server/catalog/pg_opclass.h
2023-11-10T02:09:07.2883874Z   .. /usr/include/postgresql/16/server/catalog/pg_opclass_d.h
2023-11-10T02:09:07.2884373Z   . /usr/include/postgresql/16/server/catalog/pg_opfamily.h
2023-11-10T02:09:07.2884875Z   .. /usr/include/postgresql/16/server/catalog/pg_opfamily_d.h
2023-11-10T02:09:07.2885362Z   . /usr/include/postgresql/16/server/catalog/pg_proc.h
2023-11-10T02:09:07.2885825Z   .. /usr/include/postgresql/16/server/catalog/pg_proc_d.h
2023-11-10T02:09:07.2886314Z   . /usr/include/postgresql/16/server/catalog/pg_namespace.h
2023-11-10T02:09:07.2886829Z   .. /usr/include/postgresql/16/server/catalog/pg_namespace_d.h
2023-11-10T02:09:07.2887300Z   .. /usr/include/postgresql/16/server/utils/acl.h
2023-11-10T02:09:07.2887746Z   ... /usr/include/postgresql/16/server/parser/parse_node.h
2023-11-10T02:09:07.2888250Z   . /usr/include/postgresql/16/server/catalog/pg_tablespace.h
2023-11-10T02:09:07.2888775Z   .. /usr/include/postgresql/16/server/catalog/pg_tablespace_d.h
2023-11-10T02:09:07.2889285Z   . /usr/include/postgresql/16/server/catalog/pg_trigger.h
2023-11-10T02:09:07.2889782Z   .. /usr/include/postgresql/16/server/catalog/pg_trigger_d.h
2023-11-10T02:09:07.2890260Z   . /usr/include/postgresql/16/server/catalog/pg_type.h
2023-11-10T02:09:07.2890714Z   . /usr/include/postgresql/16/server/commands/comment.h
2023-11-10T02:09:07.2891179Z   . /usr/include/postgresql/16/server/commands/dbcommands.h
2023-11-10T02:09:07.2891645Z   . /usr/include/postgresql/16/server/commands/defrem.h
2023-11-10T02:09:07.2892079Z   .. /usr/include/postgresql/16/server/utils/array.h
2023-11-10T02:09:07.2892538Z   ... /usr/include/postgresql/16/server/utils/expandeddatum.h
2023-11-10T02:09:07.2893051Z   . /usr/include/postgresql/16/server/commands/event_trigger.h
2023-11-10T02:09:07.2893591Z   .. /usr/include/postgresql/16/server/catalog/pg_event_trigger.h
2023-11-10T02:09:07.2894154Z   ... /usr/include/postgresql/16/server/catalog/pg_event_trigger_d.h
2023-11-10T02:09:07.2894686Z   .. /usr/include/postgresql/16/server/tcop/deparse_utility.h
2023-11-10T02:09:07.2895204Z   ... /usr/include/postgresql/16/server/utils/aclchk_internal.h
2023-11-10T02:09:07.2895943Z   . /usr/include/postgresql/16/server/commands/explain.h
2023-11-10T02:09:07.2896739Z   . /usr/include/postgresql/16/server/commands/proclang.h
2023-11-10T02:09:07.2897400Z   . /usr/include/postgresql/16/server/commands/seclabel.h
2023-11-10T02:09:07.2897880Z   . /usr/include/postgresql/16/server/commands/tablespace.h
2023-11-10T02:09:07.2898366Z   . /usr/include/postgresql/16/server/commands/tablecmds.h
2023-11-10T02:09:07.2898840Z   . /usr/include/postgresql/16/server/commands/trigger.h
2023-11-10T02:09:07.2899295Z   . /usr/include/postgresql/16/server/commands/user.h
2023-11-10T02:09:07.2899728Z   .. /usr/include/postgresql/16/server/libpq/crypt.h
2023-11-10T02:09:07.2900155Z   .. /usr/include/postgresql/16/server/utils/guc.h
2023-11-10T02:09:07.2900590Z   . /usr/include/postgresql/16/server/commands/vacuum.h
2023-11-10T02:09:07.2901050Z   .. /usr/include/postgresql/16/server/access/parallel.h
2023-11-10T02:09:07.2901534Z   ... /usr/include/postgresql/16/server/postmaster/bgworker.h
2023-11-10T02:09:07.2902016Z   ... /usr/include/postgresql/16/server/storage/shm_mq.h
2023-11-10T02:09:07.2902465Z   .... /usr/include/postgresql/16/server/storage/proc.h
2023-11-10T02:09:07.2902901Z   ..... /usr/include/postgresql/16/server/access/clog.h
2023-11-10T02:09:07.2903335Z   ...... /usr/include/postgresql/16/server/storage/sync.h
2023-11-10T02:09:07.2903787Z   ..... /usr/include/postgresql/16/server/storage/latch.h
2023-11-10T02:09:07.2904246Z   ..... /usr/include/postgresql/16/server/storage/pg_sema.h
2023-11-10T02:09:07.2904733Z   .. /usr/include/postgresql/16/server/catalog/pg_statistic.h
2023-11-10T02:09:07.2905263Z   ... /usr/include/postgresql/16/server/catalog/pg_statistic_d.h
2023-11-10T02:09:07.2905921Z   . /usr/include/postgresql/16/server/common/config_info.h
2023-11-10T02:09:07.2906448Z   . /usr/include/postgresql/16/server/common/controldata_utils.h
2023-11-10T02:09:07.2906943Z   . /usr/include/postgresql/16/server/executor/spi.h
2023-11-10T02:09:07.2907389Z   .. /usr/include/postgresql/16/server/parser/parser.h
2023-11-10T02:09:07.2907834Z   .. /usr/include/postgresql/16/server/utils/portal.h
2023-11-10T02:09:07.2908285Z   ... /usr/include/postgresql/16/server/utils/plancache.h
2023-11-10T02:09:07.2908747Z   .... /usr/include/postgresql/16/server/utils/resowner.h
2023-11-10T02:09:07.2909208Z   . /usr/include/postgresql/16/server/foreign/fdwapi.h
2023-11-10T02:09:07.2909662Z   .. /usr/include/postgresql/16/server/nodes/pathnodes.h
2023-11-10T02:09:07.2910128Z   . /usr/include/postgresql/16/server/foreign/foreign.h
2023-11-10T02:09:07.2910565Z   . /usr/include/postgresql/16/server/mb/pg_wchar.h
2023-11-10T02:09:07.2910984Z   .. /usr/include/postgresql/16/server/port/simd.h
2023-11-10T02:09:07.2911506Z   ... /usr/lib/llvm-14/lib/clang/14.0.0/include/emmintrin.h
2023-11-10T02:09:07.2912012Z   .... /usr/lib/llvm-14/lib/clang/14.0.0/include/xmmintrin.h
2023-11-10T02:09:07.2912557Z   ..... /usr/lib/llvm-14/lib/clang/14.0.0/include/mmintrin.h
2023-11-10T02:09:07.2913073Z   ..... /usr/lib/llvm-14/lib/clang/14.0.0/include/mm_malloc.h
2023-11-10T02:09:07.2913578Z   ..... /usr/lib/llvm-14/lib/clang/14.0.0/include/emmintrin.h

@workingjubilee
Copy link
Member Author

not sure how this brings in llvm-14 headers

  • search dirs:
    • programs: =/usr/bin:/usr/lib/llvm-15/bin:/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/bin
    • libraries: =/usr/lib/llvm-15/lib/clang/15.0.7:/usr/bin/../lib/gcc/x86_64-linux-gnu/13:/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../lib64:/lib/x86_64-linux-gnu:/lib/../lib64:/usr/lib/x86_64-linux-gnu:/usr/lib/../lib64:/lib:/usr/lib
  • resource dir:
    • programs: =/usr/bin:/usr/lib/llvm-15/bin:/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../x86_64-linux-gnu/bin
    • libraries: =/usr/lib/llvm-15/lib/clang/15.0.7:/usr/bin/../lib/gcc/x86_64-linux-gnu/13:/usr/bin/../lib/gcc/x86_64-linux-gnu/13/../../../../lib64:/lib/x86_64-linux-gnu:/lib/../lib64:/usr/lib/x86_64-linux-gnu:/usr/lib/../lib64:/lib:/usr/lib

@eeeebbbbrrrr
Copy link
Contributor

How does PGXS handle the include paths? Do C extensions suffer this problem too?

@workingjubilee
Copy link
Member Author

I have no idea and no idea where I'd even start looking, and I don't think it matters, because this is about system configuration, clang's search paths, and whether those aspects are controlled.

@workingjubilee
Copy link
Member Author

Hell yeah, all tests cleared.

@workingjubilee
Copy link
Member Author

Now to make it an actually modular solution instead of hardcoded pile of mess. ⚰️

@thomcc
Copy link
Contributor

thomcc commented Nov 11, 2023

It looks like https://github.com/KyleMayes/clang-sys/blob/master/src/support.rs#L60 (used by bindgen) is finding the wrong clang, calling it to determine the include paths. For system header paths this is fine, but for builtin headers (like *intrin.h or stdarg.h) this is not fine, since those must precisely match the version of clang they're used with. This ends up with bindgen using clang14 headers against clang15 clang.

I don't know the solution here, but having mismatches like this could potentially expand beyond failing to find this header, and could cause us to generate bindings that are subtly wrong, depending on what PG does with #ifdefs and such

@thomcc thomcc self-requested a review November 11, 2023 00:59
@workingjubilee
Copy link
Member Author

Where in bindgen actually hits that codepath? I've been tracing, looking for that.

@workingjubilee
Copy link
Member Author

workingjubilee commented Nov 11, 2023

@workingjubilee
Copy link
Member Author

This PR has been reduced to the minimal viable solution: Avoid using detect_include_paths and set it unambiguously and permanently false.

@workingjubilee
Copy link
Member Author

@workingjubilee
Copy link
Member Author

This minimal fix does not make this work on certain Linux distros we might be reasonably expected to support. I am not just talking about CentOS 7. If it was just CentOS 7, I'd feel okay telling everyone who wants that support to go to... more rapidly update to an in-support distro.

@workingjubilee
Copy link
Member Author

I win.

@workingjubilee workingjubilee changed the title Fix the "wrong clang" problem Sniff for clang-version-correct headers Nov 15, 2023
@workingjubilee
Copy link
Member Author

Feel free to tell me how awful and untenable my logic is on macOS or whatever.

@workingjubilee workingjubilee changed the title Sniff for clang-version-correct headers Sniff for libclang-version-correct headers Nov 15, 2023
@workingjubilee
Copy link
Member Author

also even if it's somewhat bogus on another OS, I really do intend to send in the patch to Postgres, so that Postgres 16.2 or whatever doesn't have this problem, I just want to unblock pgrx dev.

Copy link
Contributor

@eeeebbbbrrrr eeeebbbbrrrr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This LGTM? No way I can prove there's no bugs, but I assume CI would have caught them for at least the cases where things already worked prior to this.

Also, I guess it's very helpful to now know where system headers are coming from, so that's good.

@thomcc
Copy link
Contributor

thomcc commented Nov 16, 2023

I think this will be wrong for macOS if it does anything, but need to look more closely (I'll do it before EOD)

@workingjubilee
Copy link
Member Author

Mmkay! I'm happy to basically stub this out for macOS.

@workingjubilee
Copy link
Member Author

Also I submitted https://www.postgresql.org/message-id/CAPNHn3oKJJxMsYq%2BqLYzVJOFrUcOr4OF1EC-KtFT-qh8nOOOtQ%40mail.gmail.com so hopefully this will simply stop being a problem for Postgres 16.$WHATEVER, giving us some breathing room to fix this the "right way" for Postgres 17 (I do not pretend this is anything but another miserable hack).

Comment on lines +16 to +47
pub(crate) fn detect_include_paths_for(
preferred_clang: Option<&std::path::Path>,
) -> (bool, Vec<PathBuf>) {
if target_env_tracked("PGRX_BINDGEN_NO_DETECT_INCLUDES").is_some() {
return (false, vec![]);
}

// By asking bindgen for the version, we force it to pull an appropriate libclang,
// allowing users to override it however they would usually override bindgen.
let clang_major = match bindgen::clang_version() {
ClangVersion { parsed: Some((major, _)), full } => {
eprintln!("Bindgen found {full}");
major
}
ClangVersion { full, .. } => {
// If bindgen doesn't know what version it has, bail and hope for the best.
eprintln!("Bindgen failed to parse clang version: {full}");
return (true, vec![]);
}
};

// If Postgres is configured --with-llvm, then it may have recorded a CLANG to use
// Ask if there's a clang at the path that Postgres would use for JIT purposes.
// Unfortunately, the responses from clang-sys include clangs from far-off paths,
// so we can only use clangs that match bindgen's libclang major version.
if let Some(ClangSys { path, version: Some(v), c_search_paths, .. }) =
ClangSys::find(preferred_clang, &[])
{
if Some(&*path) == preferred_clang && v.Major as u32 == clang_major {
return (false, c_search_paths.unwrap_or_default());
}
}
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the part that I feel deeply confident is basically guaranteed-correct for macOS, but I must admit I might inadvertantly be counting on "clang vs. appleclang doesn't matter for the headers we need".

Comment on lines +49 to +67
// Oh no, still here?
// Let's go behind bindgen's back to get libclang's path
let libclang_path =
clang_sys::get_library().expect("libclang should have been loaded?").path().to_owned();
eprintln!("found libclang at {}", libclang_path.display());
// libclang will probably be in a dynamic library directory,
// which means it will probably be adjacent to its headers, e.g.
// - "/usr/lib/libclang-${CLANG_MAJOR}.so.${CLANG_MAJOR}.${CLANG_MINOR}"
// - "/usr/lib/clang/${CLANG_MAJOR}/include"
let clang_major_fmt = clang_major.to_string();
let mut paths = vec![];
// by adjacent, that does not mean it is always immediately so, e.g.
// - "/usr/lib/x86_64-linux-gnu/libclang-${CLANG_MAJOR}.so.${CLANG_MAJOR}.${CLANG_MINOR}.${CLANG_SUBMINOR}"
// - "/usr/lib/clang/${CLANG_MAJOR}/include"
// or
// - "/usr/lib64/libclang-${CLANG_MAJOR}.so.${CLANG_MAJOR}.${CLANG_MINOR}.${CLANG_SUBMINOR}"
// - "/usr/lib/clang/${CLANG_MAJOR}/include"
// so, crawl back up the ancestral tree
for ancestor in libclang_path.ancestors() {
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the part where the secret ingredient is Crime. The idea is that this crime starts its journey relative to the libclang.so dir so that we ideally find the right headers to pull even if we're starting from an unusual place.

Comment on lines +73 to +91
// On Unix-y systems this will be like "/usr/lib/clang/$CLANG_MAJOR/include"
// so don't even descend if the directory doesn't have one of those parts
.filter_entry(|entry| {
!is_hidden(entry) && {
entry_contains(entry, "clang")
|| entry_contains(entry, "include")
|| entry_contains(entry, &*clang_major_fmt)
// we always want to descend from a lib dir, but only one step
// as we don't really want to search all of /usr/lib's subdirs
|| os_str_contains(entry.file_name(), "lib")
}
})
.filter_map(|e| e.ok()) // be discreet
// We now need something that looks like it actually satisfies all our constraints
.filter(|entry| {
entry_contains(entry, &*clang_major_fmt)
&& entry_contains(entry, "clang")
&& entry_contains(entry, "include")
})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The fast-and-loose way this may seem to be written is to account for possible differences like

  • /usr/lib/clang-15/include
  • /usr/lib/clang/15/include

It may seem unnecessary, but we don't necessarily want to have a hard dependency on there being a clang executable. This is because it is possible for libclang to be packaged without its executable and this is a configuration that is actually shipped by real distros.

You may think that seems... bad... but it's less goofy than the configurations that package libclang separately from its headers!

Comment on lines +92 to +104
// we need to pull the actual directories that include the SIMD headers
.filter(|entry| {
os_str_contains(entry.file_name(), "emmintrin.h")
|| os_str_contains(entry.file_name(), "arm_neon.h")
})
.filter_map(|entry| {
let mut pbuf = entry.into_path();
if pbuf.pop() && pbuf.is_dir() && os_str_contains(&*pbuf.file_name()?, "include") {
Some(pbuf)
} else {
None
}
})
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is where I'm hoping this is basically enough validation that we eliminate any real risk of pulling the wrong headers. This also prevents pulling entries like:

  • /usr/lib/clang/17/include/ppc_wrappers/emmintrin.h

pgrx-pg-config/src/lib.rs Show resolved Hide resolved
pgrx-pg-config/src/lib.rs Show resolved Hide resolved
pgrx-pg-sys/build/clang.rs Show resolved Hide resolved
pgrx-pg-sys/build/clang.rs Show resolved Hide resolved
@workingjubilee
Copy link
Member Author

This LGTM? No way I can prove there's no bugs, but I assume CI would have caught them for at least the cases where things already worked prior to this.

fwiw I did run the nightly "all distros" workflow on this, but as the dispatch workflow currently works I can't prove that's due to anything, really.

Copy link
Contributor

@thomcc thomcc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expect this to cause issues for macOS (the fix is likely wrong for it), but I also don't think macOS is immune to this problem, so I suppose we can address them when they come up.

@workingjubilee workingjubilee merged commit 8828f87 into pgcentralfoundation:develop Nov 17, 2023
8 checks passed
@workingjubilee workingjubilee deleted the fix-pg16-clang-problems branch November 17, 2023 01:20
workingjubilee added a commit that referenced this pull request Nov 27, 2023
Bindgen's strategy of autodetecting headers attempts to use a hacky
route used by clang-sys, however, it doesn't take into account that the
strategy of clang-sys uses `$CLANG_PATH` instead of `$LIBCLANG_PATH`,
and then falls back to searching the entire directory structure. This
means it's fairly easy for it to pull the headers for a different
version, trying to compile them with the wrong clang!

This replaces their series of unfortunate hacks with our own, using
the collected information from pg_config, clang-sys, and rust-bindgen
to try to locate the correct compiler headers. If it can't find anything,
it falls back to doing what currently happens.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants