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

Compile problem on MACOS #1258

Open
psimondk opened this issue Jan 1, 2024 · 13 comments
Open

Compile problem on MACOS #1258

psimondk opened this issue Jan 1, 2024 · 13 comments

Comments

@psimondk
Copy link

psimondk commented Jan 1, 2024

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
<full_path>/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
Copy link
Contributor

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
Copy link
Contributor

levkk commented Jan 3, 2024

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
Copy link
Author

psimondk commented Jan 3, 2024

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
Copy link
Author

psimondk commented Jan 3, 2024 via email

@montanalow montanalow reopened this Jan 3, 2024
@psimondk
Copy link
Author

psimondk commented Jan 3, 2024

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

@psimondk psimondk closed this as completed Jan 3, 2024
@psimondk psimondk reopened this Jan 3, 2024
@levkk
Copy link
Contributor

levkk commented Jan 3, 2024

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

@psimondk
Copy link
Author

psimondk commented Jan 3, 2024

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
Copy link
Contributor

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
Copy link
Author

psimondk commented Jan 4, 2024

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
Copy link
Author

psimondk commented Jan 4, 2024

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
Copy link
Contributor

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
Copy link
Author

psimondk commented Jan 5, 2024

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
Copy link

vinerz commented Apr 26, 2024

@psimondk Did you ever figure it out?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants