postgresml / postgresml

Postgres with GPUs for ML/AI apps.
https://postgresml.org
MIT License
6.01k stars 301 forks source link

Compile problem on MACOS #1258

Open psimondk opened 10 months ago

psimondk commented 10 months ago

Hi,

Happy new year 👍

After having installed per the instructions (https://postgresml.org/docs/resources/developer-docs/installation) I ran into this:

Error

error[E0412]: cannot find type _Tp in this scope

/postgresml/pgml-extension/target/debug/build/xgboost-sys-fa51aa703434d75f/out/bindings.rs:452:27 Offending lines (line 452 mentioned in the error is 'pub static std_value: _Tp;'): ``` pub type std_integral_constant_value_type<_Tp> = _Tp; pub type std_integral_constant_type = u8; extern "C" { #[link_name = "\u{1}value"] pub static std_value: _Tp; } ``` ## Amendments I had to amend the installation instructions as follows: change 'cargo-pgrx --version 0.9.8' to ' cargo install cargo-pgrx --version 0.11.2' (toml mentions 0.11.2 not 0.9.8) git submodule update --init --recursive (to get linfa dependencies) I'm a bit 'rusty' on 'Rust' so I have no idea on how to proceed ...
montanalow commented 10 months ago

This works on my macbook with rust 1.72.0. Do you happen to have an older version of the rust toolchain installed that is also rusty? Another thing to check is that you installed the developer dependencies on mac with brew bundle install.

levkk commented 10 months ago

My guess is you don't have llvm installed from brew (https://users.rust-lang.org/t/bindgen-seems-using-wrong-infrastructure/85122)

Use our brew bundle to install everything you need to compile from source on Mac.

psimondk commented 10 months ago

Hi again,

Sorry the bundle is installed and rust is 1.74, the issue still persist as nothing changed.

image

Please let me know if there is more I can do? More info you'll need? Brgds, Palle

psimondk commented 10 months ago

Hi,

My Rust is 1.74 and I believe I did the brew bundle install ...I checked, reran the rustc and the issue still persists unfortunately. I was too late in commenting before it got closed :) So had to open a new #1268.

Regards, Palle

On Wed, Jan 3, 2024 at 6:25 AM Lev Kokotov @.***> wrote:

My guess is you don't have llvm installed from brew ( https://users.rust-lang.org/t/bindgen-seems-using-wrong-infrastructure/85122 )

Use our brew bundle to install everything you need to compile from source on Mac.

— Reply to this email directly, view it on GitHub https://github.com/postgresml/postgresml/issues/1258#issuecomment-1874833032, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAP6EPMVPKCQM6DAYM426RLYMTMT5AVCNFSM6AAAAABBJEZLLCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMYTQNZUHAZTGMBTGI . You are receiving this because you authored the thread.Message ID: @.***>

psimondk commented 10 months ago

Hi ,

So I perused https://github.com/Homebrew/homebrew-core/blob/master/Formula/r/rust.rb and saw that 1.75.0 had been poured two days ago and tried again after 'brew upgrade rust' ... alas it re-compiled everything until it ran into the same problem the same place.

I'll have to call it a day - being some timezones ahead of gmt - but will try a completely fresh install in the morning.

Best Regards, Palle

levkk commented 10 months ago

Never tried the brew Rust version, I always get mine from rust-lang.org. Doubtful there is a difference, but worth a shot.

psimondk commented 10 months ago

Hi,

Thanks for the tip @levkk I switched to rustup and tried with the default (1.75.0) - same result. Downgraded to 1.72.0 - same result

Could it be that the change from 'cargo install cargo-pgrx --version 0.9.8' to 'cargo install cargo-pgrx --version 0.11.2' discussed earlier in this thread is the culprit?

Anyway that must be a task for tomorrow to give that one a go :)

montanalow commented 10 months ago

I just updated my macbook to rust 1.75.0 as well as all our dependencies in #1270 and everything still compiled cleanly for me.

The error you're getting is from rust bindgen, which builds xgboost-sys in the rust-xgboost project.

Can you build this rust project: https://github.com/postgresml/rust-xgboost

psimondk commented 10 months ago

I tried - here is an excerpt:

Lozenets-6:rust-xgboost psi$ cargo build
    Updating crates.io index
  Downloaded clang-sys v1.7.0
  Downloaded proc-macro2 v1.0.75
  Downloaded syn v2.0.47

...

   Compiling derive_builder v0.12.0
   Compiling xgboost-sys v0.2.0 (/Users/psi/Projects/PostgresML/rust-xgboost/xgboost-sys)
error: failed to run custom build command for `xgboost-sys v0.2.0 (/Users/psi/Projects/PostgresML/rust-xgboost/xgboost-sys)`

Caused by:
  process didn't exit successfully: `/Users/psi/Projects/PostgresML/rust-xgboost/target/debug/build/xgboost-sys-b302f3dbd7a226bf/build-script-build` (exit status: 101)
  --- stdout
  CMAKE_TOOLCHAIN_FILE_aarch64-apple-darwin = None
  CMAKE_TOOLCHAIN_FILE_aarch64_apple_darwin = None
  HOST_CMAKE_TOOLCHAIN_FILE = None
  CMAKE_TOOLCHAIN_FILE = None
  CMAKE_GENERATOR_aarch64-apple-darwin = None
  CMAKE_GENERATOR_aarch64_apple_darwin = None
  HOST_CMAKE_GENERATOR = None
  CMAKE_GENERATOR = None
  CMAKE_PREFIX_PATH_aarch64-apple-darwin = None
  CMAKE_PREFIX_PATH_aarch64_apple_darwin = None
  HOST_CMAKE_PREFIX_PATH = None
  CMAKE_PREFIX_PATH = None
  CMAKE_aarch64-apple-darwin = None
  CMAKE_aarch64_apple_darwin = None
  HOST_CMAKE = None
  CMAKE = None
  running: cd "/Users/psi/Projects/PostgresML/rust-xgboost/target/debug/build/xgboost-sys-9b1359d30ae3c17c/out/build" && CMAKE_PREFIX_PATH="" "cmake" "/Users/psi/Projects/PostgresML/rust-xgboost/target/debug/build/xgboost-sys-9b1359d30ae3c17c/out/xgboost" "-DCMAKE_OSX_ARCHITECTURES=arm64" "-DBUILD_STATIC_LIB=ON" "-DCMAKE_C_COMPILER=/opt/homebrew/opt/llvm/bin/clang" "-DCMAKE_CXX_COMPILER=/opt/homebrew/opt/llvm/bin/clang++" "-DOPENMP_LIBRARIES=/opt/homebrew/opt/llvm/lib" "-DOPENMP_INCLUDES=/opt/homebrew/opt/llvm/include" "-DCMAKE_SYSTEM_NAME=Darwin" "-DCMAKE_SYSTEM_PROCESSOR=arm64" "-DCMAKE_INSTALL_PREFIX=/Users/psi/Projects/PostgresML/rust-xgboost/target/debug/build/xgboost-sys-9b1359d30ae3c17c/out" "-DCMAKE_C_FLAGS= -ffunction-sections -fdata-sections -fPIC -arch arm64" "-DCMAKE_CXX_FLAGS= -ffunction-sections -fdata-sections -fPIC -arch arm64" "-DCMAKE_ASM_FLAGS= -ffunction-sections -fdata-sections -fPIC -arch arm64" "-DCMAKE_ASM_COMPILER=/usr/bin/cc" "-DCMAKE_BUILD_TYPE=Debug"

  --- stderr
  CMake Warning:
    Ignoring extra path from command line:

     "/Users/psi/Projects/PostgresML/rust-xgboost/target/debug/build/xgboost-sys-9b1359d30ae3c17c/out/xgboost"

  CMake Error: The source directory "/Users/psi/Projects/PostgresML/rust-xgboost/target/debug/build/xgboost-sys-9b1359d30ae3c17c/out/xgboost" does not appear to contain CMakeLists.txt.
  Specify --help for usage, or press the help button on the CMake GUI.
  thread 'main' panicked at '
  command did not execute successfully, got: exit status: 1

  build script failed, must exit now', /Users/psi/.cargo/registry/src/index.crates.io-6f17d22bba15001f/cmake-0.1.50/src/lib.rs:1098:5
  note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

My workstation is a 16G M1 Pro running Sonoma 14.2.1 w Xcode 14. Will update Xcode

psimondk commented 9 months ago

Didn't help with updated Xcode ... and cmake is present

cmake version 3.28.1

CMake suite maintained and supported by Kitware (kitware.com/cmake).

Did of course try to see if I could build something - and it did say 'Hello, world!' :)

cargo new hello_cargo

montanalow commented 9 months ago

I think something is broken with your buildchain. What is the output of brew doctor and brew list cmake

Warning: Treating cmake as a formula. For the cask, use homebrew/cask/cmake
/opt/homebrew/Cellar/cmake/3.28.0/bin/ccmake
/opt/homebrew/Cellar/cmake/3.28.0/bin/cmake
/opt/homebrew/Cellar/cmake/3.28.0/bin/cpack
/opt/homebrew/Cellar/cmake/3.28.0/bin/ctest
/opt/homebrew/Cellar/cmake/3.28.0/etc/bash_completion.d/ (3 files)
/opt/homebrew/Cellar/cmake/3.28.0/share/aclocal/cmake.m4
/opt/homebrew/Cellar/cmake/3.28.0/share/cmake/ (3306 files)
/opt/homebrew/Cellar/cmake/3.28.0/share/doc/ (8 files)
/opt/homebrew/Cellar/cmake/3.28.0/share/emacs/site-lisp/cmake/cmake-mode.el
/opt/homebrew/Cellar/cmake/3.28.0/share/vim/ (2 files)
psimondk commented 9 months ago

I do have unlinked Python kegs:

Warning: You have unlinked kegs in your Cellar.
Leaving kegs unlinked can lead to build-trouble and cause formulae that depend on
those kegs to fail to run properly once built. Run `brew link` on these:
  python-jinja
  python-idna
  python-click
  python-dateutil
  python-requests
  ipython
  python-urllib3
  python-attrs
  python-platformdirs
  python-filelock
  jupyterlab
  python-charset-normalizer
  python-markupsafe

cmake looks like yours:

Warning: Treating cmake as a formula. For the cask, use homebrew/cask/cmake
/opt/homebrew/Cellar/cmake/3.28.1/bin/ccmake
/opt/homebrew/Cellar/cmake/3.28.1/bin/cmake
/opt/homebrew/Cellar/cmake/3.28.1/bin/cpack
/opt/homebrew/Cellar/cmake/3.28.1/bin/ctest
/opt/homebrew/Cellar/cmake/3.28.1/etc/bash_completion.d/ (3 files)
/opt/homebrew/Cellar/cmake/3.28.1/share/aclocal/cmake.m4
/opt/homebrew/Cellar/cmake/3.28.1/share/cmake/ (3306 files)
/opt/homebrew/Cellar/cmake/3.28.1/share/doc/ (8 files)
/opt/homebrew/Cellar/cmake/3.28.1/share/emacs/site-lisp/cmake/cmake-mode.el
/opt/homebrew/Cellar/cmake/3.28.1/share/vim/ (2 files)

I'll link 'em and see what gives :)

vinerz commented 6 months ago

@psimondk Did you ever figure it out?