cpmech / russell

Rust Scientific Libary. ODE and DAE (Runge-Kutta) solvers. Special functions (Bessel, Elliptic, Beta, Gamma, Erf). Linear algebra. Sparse solvers (MUMPS, UMFPACK). Probability distributions. Tensor calculus.
MIT License
114 stars 8 forks source link

Build error on Rocky 9 #104

Closed supernova4869 closed 6 months ago

supernova4869 commented 6 months ago

System: Rocky 9 Version: 1.2.0 and 1.2.1

I tried the examples/pde_laplace_equation.rs but failed at building. The rust-analyzer sayed that I missed zmumps_c.h, but I have this file at /usr/include/MUMPS/. The full information is like below:

error: failed to run custom build command for `russell_sparse v1.2.0`
...
  cargo:warning=c_code/interface_complex_mumps.c:6:10: 致命错误:zmumps_c.h:没有那个文件或目录
  cargo:warning=    6 | #include "zmumps_c.h"
  cargo:warning=      |          ^~~~~~~~~~~~
  cargo:warning=编译中断。
...
error occurred: Command "/usr/bin/gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-o" "/run/media/ML/MD/Supernova/test/russel/target/debug/build/russell_sparse-8877400e9f10e264/out/be5a010cd526d178-interface_complex_mumps.o" "-c" "c_code/interface_complex_mumps.c" with args gcc did not execute successfully (status code exit status: 1).

Does the program have a search to /usr/include/MUMPS? I found a similar issue #75 focusing the build.rs file, but I did not find the MUMPS option inside.

I also built a symbolic link to /usr/local/include/MUMPS but still the same error.

cpmech commented 6 months ago

Hi, can you try adding the line:

 .include("/usr/include/MUMPS")

to the build.rs file in russell_sparse

as shown below?

Selection_036

supernova4869 commented 6 months ago

Sorry, I tried and still got the same error, and also made russel_ode built failed.

= note: /usr/bin/ld: cannot find -ldmumps_seq
          /usr/bin/ld: cannot find -lzmumps_seq
          collect2: error: ld returned 1 exit status

error: could not compile `russell_ode` (bin "brusselator_pde") due to 1 previous error
cpmech commented 6 months ago

Oh, I see.

I'm not familiar with Rocky 9, but you may be able to find the sequential version of MUMPS; something like mumps-seq.

Otherwise, you may have to compile the required dependencies in your system. You may look at this file as guidance and then look at this file for information on how to compile MUMPS.

supernova4869 commented 6 months ago

Oh, my mistake. I forgot to say that when installing libs, I did not find the MUMPS-seq lib, so I installed MUMPS instead. Maybe this is the reason. I will read your instructions and try again.

cpmech commented 6 months ago

Hi, I've changed how MUMPS is used by Russell (now the MPI version is considered).

So, Rocky Linux 9 works just fine with its standard MUMPS.

You may update Russel in your system and use the 1.3 version.

The steps to install the requirements on Rocky 9 are listed below (you may have done those already!)

# initialize
dnf update -y
dnf check-update 
dnf install epel-release -y
crb enable

# required by rust
dnf install cmake gcc make curl clang -y

# dependencies
dnf install -y \
  gcc-toolset-13 \
  lapack-devel \
  MUMPS-devel \
  openblas-devel \
  openmpi-devel \
  suitesparse-devel

Let me know if you have further problems!

cpmech commented 6 months ago

Oh, I forgot: the following environment variables must be set too:

export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:/usr/lib64/openmpi/lib"
export PSM3_DEVICES='self,shm'
supernova4869 commented 6 months ago

I have tried it on my Ubuntu Virtual Machine. It really works and is pretty. Thank you! pde_laplace_equation

cpmech commented 6 months ago

Excellent!

If you are still using Rocky Linux, can you please it on Rocky?

supernova4869 commented 6 months ago

I tried it on Rocky, and here is the updated message:

2024-04-29T14:41:43.939354Z ERROR rust_analyzer::main_loop: FetchBuildDataError:
The following warnings were emitted during compilation:

error: failed to run custom build command for `russell_sparse v1.2.1`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `/run/media/ML/MD/Supernova/test/russel/target/debug/build/russell_sparse-8a52f1cced6f7f0e/build-script-build` (exit status: 1)
  --- stdout
  TARGET = Some("x86_64-unknown-linux-gnu")
  OPT_LEVEL = Some("0")
  HOST = Some("x86_64-unknown-linux-gnu")
  cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
  CC_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
  CC_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = Some("/usr/bin/gcc")
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
  CFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
  CFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:warning=c_code/interface_complex_mumps.c:6:10: 致命错误:zmumps_c.h:没有那个文件或目录
  cargo:warning=    6 | #include "zmumps_c.h"
  cargo:warning=      |          ^~~~~~~~~~~~
  cargo:warning=编译中断。

  --- stderr

  error occurred: Command "/usr/bin/gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-o" "/run/media/ML/MD/Supernova/test/russel/target/debug/build/russell_sparse-3c614725063162b5/out/be5a010cd526d178-interface_complex_mumps.o" "-c" "c_code/interface_complex_mumps.c" with args gcc did not execute successfully (status code exit status: 1).

2024-04-29T14:41:44.289525Z ERROR flycheck: Flycheck failed to run the following command: CommandHandle { program: "/home/supernova/.cargo/bin/cargo", arguments: ["check", "--workspace", "--message-format=json-diagnostic-rendered-ansi", "--manifest-path", "/run/media/ML/MD/Supernova/test/russel/Cargo.toml", "--all-targets"], current_dir: Some("/run/media/ML/MD/Supernova/test/russel") }, error=Cargo watcher failed, the command produced no valid metadata (exit code: ExitStatus(unix_wait_status(25856))):
   Compiling russell_sparse v1.2.1
The following warnings were emitted during compilation:

warning: russell_sparse@1.2.1: c_code/interface_complex_mumps.c:6:10: 致命错误:zmumps_c.h:没有那个文件或目录
warning: russell_sparse@1.2.1:     6 | #include "zmumps_c.h"
warning: russell_sparse@1.2.1:       |          ^~~~~~~~~~~~
warning: russell_sparse@1.2.1: 编译中断。

error: failed to run custom build command for `russell_sparse v1.2.1`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `/run/media/ML/MD/Supernova/test/russel/target/debug/build/russell_sparse-8a52f1cced6f7f0e/build-script-build` (exit status: 1)
  --- stdout
  TARGET = Some("x86_64-unknown-linux-gnu")
  OPT_LEVEL = Some("0")
  HOST = Some("x86_64-unknown-linux-gnu")
  cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
  CC_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
  CC_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = Some("/usr/bin/gcc")
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
  CFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
  CFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:warning=c_code/interface_complex_mumps.c:6:10: 致命错误:zmumps_c.h:没有那个文件或目录
  cargo:warning=    6 | #include "zmumps_c.h"
  cargo:warning=      |          ^~~~~~~~~~~~
  cargo:warning=编译中断。

  --- stderr

  error occurred: Command "/usr/bin/gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-Wall" "-Wextra" "-o" "/run/media/ML/MD/Supernova/test/russel/target/debug/build/russell_sparse-3c614725063162b5/out/be5a010cd526d178-interface_complex_mumps.o" "-c" "c_code/interface_complex_mumps.c" with args gcc did not execute successfully (status code exit status: 1).

2024-04-29T14:42:13.166762Z ERROR rust_analyzer::main_loop: FetchBuildDataError:
The following warnings were emitted during compilation:

error: failed to run custom build command for `russell_sparse v1.3.0`
note: To improve backtraces for build dependencies, set the CARGO_PROFILE_DEV_BUILD_OVERRIDE_DEBUG=true environment variable to enable debug information generation.

Caused by:
  process didn't exit successfully: `/run/media/ML/MD/Supernova/test/russel/target/debug/build/russell_sparse-ee3d3ebc076c95e9/build-script-build` (exit status: 1)
  --- stdout
  TARGET = Some("x86_64-unknown-linux-gnu")
  OPT_LEVEL = Some("0")
  HOST = Some("x86_64-unknown-linux-gnu")
  cargo:rerun-if-env-changed=CC_x86_64-unknown-linux-gnu
  CC_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CC_x86_64_unknown_linux_gnu
  CC_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CC
  HOST_CC = None
  cargo:rerun-if-env-changed=CC
  CC = Some("/usr/bin/gcc")
  cargo:rerun-if-env-changed=CC_ENABLE_DEBUG_OUTPUT
  cargo:rerun-if-env-changed=CRATE_CC_NO_DEFAULTS
  CRATE_CC_NO_DEFAULTS = None
  DEBUG = Some("true")
  CARGO_CFG_TARGET_FEATURE = Some("fxsr,sse,sse2")
  cargo:rerun-if-env-changed=CFLAGS_x86_64-unknown-linux-gnu
  CFLAGS_x86_64-unknown-linux-gnu = None
  cargo:rerun-if-env-changed=CFLAGS_x86_64_unknown_linux_gnu
  CFLAGS_x86_64_unknown_linux_gnu = None
  cargo:rerun-if-env-changed=HOST_CFLAGS
  HOST_CFLAGS = None
  cargo:rerun-if-env-changed=CFLAGS
  CFLAGS = None
  cargo:warning=c_code/interface_complex_mumps.c: 在函数‘complex_solver_mumps_initialize’中:
  cargo:warning=c_code/interface_complex_mumps.c:118:5: 警告:implicit declaration of function ‘MPI_Initialized’; did you mean ‘MPI_Finalize’? [-Wimplicit-function-declaration]
  cargo:warning=  118 |     MPI_Initialized(&flag);
  cargo:warning=      |     ^~~~~~~~~~~~~~~
  cargo:warning=      |     MPI_Finalize
  cargo:warning=c_code/interface_complex_mumps.c:121:23: 错误:‘MPI_SUCCESS’ undeclared (first use in this function); did you mean ‘EXIT_SUCCESS’?
  cargo:warning=  121 |         if (status != MPI_SUCCESS) {
  cargo:warning=      |                       ^~~~~~~~~~~
  cargo:warning=      |                       EXIT_SUCCESS
  cargo:warning=c_code/interface_complex_mumps.c:121:23: 附注:每个未声明的标识符在其出现的函数内只报告一次
  cargo:warning=In file included from c_code/interface_complex_mumps.c:6:
  cargo:warning=在文件作用域:
  cargo:warning=/usr/include/MUMPS/mpi.h:51:17: 警告:‘MPI_COMM_WORLD’ defined but not used [-Wunused-variable]
  cargo:warning=   51 | static MPI_Comm MPI_COMM_WORLD=(MPI_Comm)0;
  cargo:warning=      |                 ^~~~~~~~~~~~~~

  --- stderr

  error occurred: Command "/usr/bin/gcc" "-O0" "-ffunction-sections" "-fdata-sections" "-fPIC" "-gdwarf-4" "-fno-omit-frame-pointer" "-m64" "-I" "/usr/lib/x86_64-linux-gnu/openmpi/include" "-I" "/usr/include/openmpi-x86_64" "-I" "/usr/include" "-I" "/usr/include/MUMPS" "-I" "/usr/include/suitesparse" "-Wall" "-Wextra" "-o" "/run/media/ML/MD/Supernova/test/russel/target/debug/build/russell_sparse-f2f192ddba1343b9/out/be5a010cd526d178-interface_complex_mumps.o" "-c" "c_code/interface_complex_mumps.c" with args gcc did not execute successfully (status code exit status: 1).
cpmech commented 6 months ago

It seems that the old version (1.2.1) is being used. Please update to 1.3. You also may need to run cargo clean

supernova4869 commented 6 months ago

Thank you! I have succeeded with Rocky 9 building the Poisson PDE project. The previous reason was that I have compiled a different version of openmpi by myself for another software, and I could only build the russel project if I set the LD_LIBRARY_PATH to the system openmpi (by dnf). Hahahahaha...

(Maybe it could be better if the russel project could be built based on the own openmpi)

cpmech commented 6 months ago

This is great news!

Yes, I'm thinking of improving the need for OpenMPI. Actually, I'm removing this dependency completely!

The next release of Russell will make its installation on Rocky (and others) even simpler.

I'll keep this issue open and close it when the new version is published.

Thanks for your assistance.

supernova4869 commented 6 months ago

Thanks for your kindly reply and the useful project. Wish it could be used in more academic works.

cpmech commented 6 months ago

Done: The 1.4.0 version no longer requires OpenMPI.

The only dependencies for For Rocky Linux are:

dnf install -y \
  lapack-devel \
  openblas-devel \
  suitesparse-devel

And there is no need to set up environment variables!

supernova4869 commented 6 months ago

Excellent! It is clear and easy to use.