timescale/promscale_extension

fatal error: 'libintl.h' file not found

vonCorax opened this issue · 5 comments

I'm attempting to compile promscale_extension for PostgreSQL 14.5 on FreeBSD 13.1, but the build fails with the message fatal error: 'libintl.h' file not found. This problem occurs on promscale_extension both 0.6.0 and 0.7.0. I've verified that the file /usr/local/include/libintl.h is in place. The complete error is as follows:

…
Compiling pgx-pg-sys v0.4.5 (https://github.com/timescale/pgx?rev=96ece243#96ece243)
error: failed to run custom build command for `pgx-pg-sys v0.4.5 (https://github.com/timescale/pgx?rev=96ece243#96ece243)`

Caused by:
  process didn't exit successfully: `/usr/home/dave/Repos/promscale/promscale_extension/target/release/build/pgx-pg-sys-23463da5d8c5cde1/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=PGX_PG_SYS_GENERATE_BINDINGS_FOR_RELEASE
  cargo:rerun-if-changed=/home/dave/.pgx/config.toml
  cargo:rerun-if-changed=include/pg10.h
  cargo:rerun-if-changed=include/pg11.h
  cargo:rerun-if-changed=include/pg12.h
  cargo:rerun-if-changed=include/pg13.h
  cargo:rerun-if-changed=include/pg14.h
  cargo:rerun-if-changed=cshim/pgx-cshim.c
  cargo:rerun-if-changed=cshim/Makefile

  --- stderr
  manifest_dir=/home/dave/.cargo/git/checkouts/pgx-86cb45baab31d1a6/96ece24/pgx-pg-sys
  shim_src=/home/dave/.cargo/git/checkouts/pgx-86cb45baab31d1a6/96ece24/pgx-pg-sys/cshim
  shim_dst=/usr/home/dave/Repos/promscale/promscale_extension/target/release/build/pgx-pg-sys-938b3b40f8fb0d27/out/cshim
  Generating bindings for pg14
  /usr/local/include/postgresql/server/c.h:75:10: fatal error: 'libintl.h' file not found
  /usr/local/include/postgresql/server/c.h:75:10: fatal error: 'libintl.h' file not found, err: true
  thread 'main' panicked at 'Unable to generate bindings for pg14: ()', /home/dave/.cargo/git/checkouts/pgx-86cb45baab31d1a6/96ece24/pgx-pg-sys/build.rs:530:13
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
gmake: *** [Makefile:99: package] Error 1

So libintl.h should already be installed on your system before you try to build the Promscale extension.

Usually it is provided by the gettext package. Apparently there are some issues with this on FreeBSD, but I'm not familiar enough to give you more specific advice than "install whatever package is supposed to provide libintl.h on FreeBSD".

On another note: please don't build version 0.7.0 yet, we don't have a compatible version of the Promscale connector out yet. Version 0.6.0 is compatible with the connecter at version 0.14.0.

Actually, libintl.h is installed at the path I mentioned above; it's just that the build process can't seem to find it.

If it helps at all, I ran the build again with backtracing turned on:

[~/Repos/promscale/promscale_extension]$ RUST_BACKTRACE=1 gmake package
cargo pgx schema pg14 --force-create-or-replace --release >/dev/null
    Building for SQL generation with features ``
   Compiling pgx-pg-sys v0.4.5 (https://github.com/timescale/pgx?rev=96ece243#96ece243)
   Compiling promscale v0.6.0 (/usr/home/dave/Repos/promscale/promscale_extension)
error: failed to run custom build command for `pgx-pg-sys v0.4.5 (https://github.com/timescale/pgx?rev=96ece243#96ece243)`

Caused by:
  process didn't exit successfully: `/usr/home/dave/Repos/promscale/promscale_extension/target/release/build/pgx-pg-sys-23463da5d8c5cde1/build-script-build` (exit status: 101)
  --- stdout
  cargo:rerun-if-env-changed=PGX_PG_SYS_GENERATE_BINDINGS_FOR_RELEASE
  cargo:rerun-if-changed=/home/dave/.pgx/config.toml
  cargo:rerun-if-changed=include/pg10.h
  cargo:rerun-if-changed=include/pg11.h
  cargo:rerun-if-changed=include/pg12.h
  cargo:rerun-if-changed=include/pg13.h
  cargo:rerun-if-changed=include/pg14.h
  cargo:rerun-if-changed=cshim/pgx-cshim.c
  cargo:rerun-if-changed=cshim/Makefile

  --- stderr
  manifest_dir=/home/dave/.cargo/git/checkouts/pgx-86cb45baab31d1a6/96ece24/pgx-pg-sys
  shim_src=/home/dave/.cargo/git/checkouts/pgx-86cb45baab31d1a6/96ece24/pgx-pg-sys/cshim
  shim_dst=/usr/home/dave/Repos/promscale/promscale_extension/target/release/build/pgx-pg-sys-938b3b40f8fb0d27/out/cshim
  Generating bindings for pg14
  /usr/local/include/postgresql/server/c.h:75:10: fatal error: 'libintl.h' file not found
  /usr/local/include/postgresql/server/c.h:75:10: fatal error: 'libintl.h' file not found, err: true
  thread 'main' panicked at 'Unable to generate bindings for pg14: ()', /home/dave/.cargo/git/checkouts/pgx-86cb45baab31d1a6/96ece24/pgx-pg-sys/build.rs:530:13
  stack backtrace:
     0: rust_begin_unwind
     1: core::panicking::panic_fmt
     2: build_script_build::run_bindgen::{{closure}}
               at /home/dave/.cargo/git/checkouts/pgx-86cb45baab31d1a6/96ece24/pgx-pg-sys/build.rs:530:13
     3: core::result::Result<T,E>::unwrap_or_else
               at /usr/ports/lang/rust/work/rustc-1.63.0-src/library/core/src/result.rs:1484:23
     4: build_script_build::run_bindgen
               at /home/dave/.cargo/git/checkouts/pgx-86cb45baab31d1a6/96ece24/pgx-pg-sys/build.rs:507:20
     5: build_script_build::main::{{closure}}
               at /home/dave/.cargo/git/checkouts/pgx-86cb45baab31d1a6/96ece24/pgx-pg-sys/build.rs:136:34
     6: core::ops::function::impls::<impl core::ops::function::FnMut<A> for &F>::call_mut
               at /usr/ports/lang/rust/work/rustc-1.63.0-src/library/core/src/ops/function.rs:268:13
     7: core::ops::function::impls::<impl core::ops::function::FnOnce<A> for &mut F>::call_once
               at /usr/ports/lang/rust/work/rustc-1.63.0-src/library/core/src/ops/function.rs:301:13
     8: core::option::Option<T>::map
               at /usr/ports/lang/rust/work/rustc-1.63.0-src/library/core/src/option.rs:929:29
     9: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
               at /usr/ports/lang/rust/work/rustc-1.63.0-src/library/core/src/iter/adapters/map.rs:103:9
    10: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
               at /usr/ports/lang/rust/work/rustc-1.63.0-src/library/core/src/iter/adapters/map.rs:103:9
    11: <core::iter::adapters::take_while::TakeWhile<I,P> as core::iter::traits::iterator::Iterator>::next
               at /usr/ports/lang/rust/work/rustc-1.63.0-src/library/core/src/iter/adapters/take_while.rs:46:21
    12: <core::iter::adapters::map::Map<I,F> as core::iter::traits::iterator::Iterator>::next
               at /usr/ports/lang/rust/work/rustc-1.63.0-src/library/core/src/iter/adapters/map.rs:103:9
    13: alloc::vec::Vec<T,A>::extend_desugared
               at /usr/ports/lang/rust/work/rustc-1.63.0-src/library/alloc/src/vec/mod.rs:2745:35
    14: <alloc::vec::Vec<T,A> as alloc::vec::spec_extend::SpecExtend<T,I>>::spec_extend
               at /usr/ports/lang/rust/work/rustc-1.63.0-src/library/alloc/src/vec/spec_extend.rs:18:9
    15: <alloc::vec::Vec<T,A> as core::iter::traits::collect::Extend<T>>::extend
               at /usr/ports/lang/rust/work/rustc-1.63.0-src/library/alloc/src/vec/mod.rs:2719:9
    16: <rayon::iter::extend::ListVecFolder<T> as rayon::iter::plumbing::Folder<T>>::consume_iter
               at /home/dave/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.5.3/src/iter/extend.rs:73:9
    17: <rayon::iter::while_some::WhileSomeFolder<C> as rayon::iter::plumbing::Folder<core::option::Option<T>>>::consume_iter
               at /home/dave/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.5.3/src/iter/while_some.rs:139:21
    18: <rayon::iter::map::MapFolder<C,F> as rayon::iter::plumbing::Folder<T>>::consume_iter
               at /home/dave/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.5.3/src/iter/map.rs:248:21
    19: <rayon::iter::map::MapFolder<C,F> as rayon::iter::plumbing::Folder<T>>::consume_iter
               at /home/dave/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.5.3/src/iter/map.rs:248:21
    20: rayon::iter::plumbing::Producer::fold_with
               at /home/dave/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.5.3/src/iter/plumbing/mod.rs:110:9
    21: rayon::iter::plumbing::bridge_producer_consumer::helper
               at /home/dave/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.5.3/src/iter/plumbing/mod.rs:438:13
    22: rayon::iter::plumbing::bridge_producer_consumer
               at /home/dave/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.5.3/src/iter/plumbing/mod.rs:397:12
    23: <rayon::iter::plumbing::bridge::Callback<C> as rayon::iter::plumbing::ProducerCallback<I>>::callback
               at /home/dave/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.5.3/src/iter/plumbing/mod.rs:373:13
    24: <rayon::slice::Iter<T> as rayon::iter::IndexedParallelIterator>::with_producer
               at /home/dave/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.5.3/src/slice/mod.rs:724:9
    25: rayon::iter::plumbing::bridge
               at /home/dave/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.5.3/src/iter/plumbing/mod.rs:357:12
    26: <rayon::slice::Iter<T> as rayon::iter::ParallelIterator>::drive_unindexed
               at /home/dave/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.5.3/src/slice/mod.rs:700:9
    27: <rayon::iter::map::Map<I,F> as rayon::iter::ParallelIterator>::drive_unindexed
               at /home/dave/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.5.3/src/iter/map.rs:49:9
    28: <rayon::iter::map::Map<I,F> as rayon::iter::ParallelIterator>::drive_unindexed
               at /home/dave/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.5.3/src/iter/map.rs:49:9
    29: <rayon::iter::while_some::WhileSome<I> as rayon::iter::ParallelIterator>::drive_unindexed
               at /home/dave/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.5.3/src/iter/while_some.rs:44:9
    30: rayon::iter::extend::<impl rayon::iter::ParallelExtend<T> for alloc::vec::Vec<T>>::par_extend
               at /home/dave/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.5.3/src/iter/extend.rs:576:28
    31: rayon::iter::from_par_iter::collect_extended
               at /home/dave/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.5.3/src/iter/from_par_iter.rs:17:5
    32: rayon::iter::from_par_iter::<impl rayon::iter::FromParallelIterator<T> for alloc::vec::Vec<T>>::from_par_iter
               at /home/dave/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.5.3/src/iter/from_par_iter.rs:30:9
    33: rayon::iter::ParallelIterator::collect
               at /home/dave/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.5.3/src/iter/mod.rs:2046:9
    34: rayon::result::<impl rayon::iter::FromParallelIterator<core::result::Result<T,E>> for core::result::Result<C,E>>::from_par_iter
               at /home/dave/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.5.3/src/result.rs:121:26
    35: rayon::iter::ParallelIterator::collect
               at /home/dave/.cargo/registry/src/github.com-1ecc6299db9ec823/rayon-1.5.3/src/iter/mod.rs:2046:9
    36: build_script_build::main
               at /home/dave/.cargo/git/checkouts/pgx-86cb45baab31d1a6/96ece24/pgx-pg-sys/build.rs:126:5
    37: core::ops::function::FnOnce::call_once
               at /usr/ports/lang/rust/work/rustc-1.63.0-src/library/core/src/ops/function.rs:248:5
  note: Some details are omitted, run with `RUST_BACKTRACE=full` for a verbose backtrace.
gmake: *** [Makefile:99: package] Error 1

Unfortunately I don't speak Rust, so I've no idea what your code is doing, but if there's anything else I can do to help please ask.

Just dropping a link to https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=267550 in case it's of use to anyone.

A heads-up that I've put a patch that I think does the trick on the above freebsd bug. I've also left a comment here pgcentralfoundation/pgrx#470 (comment) as I think this is probably an upstream pgx issue.