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 error: Undefined MPI References During Ipopt Build with MUMPS and OpenMPI #791

Open
ruturajsambhusvt opened this issue Sep 16, 2024 · 1 comment

Comments

@ruturajsambhusvt
Copy link

ruturajsambhusvt commented Sep 16, 2024

Description

While building Ipopt with MUMPS and OpenMPI on Ubuntu 22.04, I'm encountering undefined references to various MPI functions during the make test phase. Despite ensuring that the correct MPI libraries and headers are installed and linked, the build fails with linker errors. Here's a detailed breakdown of the steps taken and the issues encountered.


Environment

  • OS: Ubuntu 22.04 (x86_64)

  • Compiler: GCC 8.4.0

  • MPI Version: OpenMPI 4.0.3 mpi_present.txt

  • MUMPS Version: 5.7.3 (Built from source)

  • Ipopt Version: 3.14.17

  • BLAS/LAPACK: System installed libblas, liblapack


Problem

During the make test phase of building Ipopt, the linker fails with the following errors:

/usr/bin/ld: ../src/.libs/libipopt.so: undefined reference to `MPI_Type_get_envelope'
/usr/bin/ld: ../src/.libs/libipopt.so: undefined reference to `ompi_mpi_comm_null'
/usr/bin/ld: ../src/.libs/libipopt.so: undefined reference to `MPI_Abort'
/usr/bin/ld: ../src/.libs/libipopt.so: undefined reference to `MPI_Topo_test'
/usr/bin/ld: ../src/.libs/libipopt.so: undefined reference to `MPI_Group_excl'
...
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:515: hs071_cpp] Error 1
make: *** [Makefile:849: test] Error 2

Steps to Reproduce

  1. Installed MUMPS from source:

    • Configured MUMPS as follows:
      FC=gfortran CFLAGS=-fPIC FCFLAGS=-fPIC ./configure --prefix=/home/trec/WorkRaj/raisim_legged/MUMPS_5.7.3
    • Successfully built and installed MUMPS.
  2. Built and installed Ipopt:

    • Ran the following configuration command for Ipopt:

      ../configure --with-mumps \
      --with-mumps-libs="-L/home/trec/WorkRaj/raisim_legged/MUMPS_5.7.3/lib -ldmumps -lmumps_common -lpord -lscalapack-openmpi -llapack -lblas -lpthread -L/usr/lib/x86_64-linux-gnu/openmpi/lib -lmpi_cxx -lmpi" \
      --with-mumps-cflags="-I/home/trec/WorkRaj/raisim_legged/MUMPS_5.7.3/include -I/usr/lib/x86_64-linux-gnu/openmpi/include" \
      --with-blas="-lblas" \
      --with-lapack="-llapack"
    • The build process completed without errors.

  3. Ran make test:

    • The build process failed during the test phase, with the linker throwing undefined references to various MPI symbols (e.g., MPI_Abort, MPI_Comm_dup, etc.).

Troubleshooting Steps Taken

  1. Verified MPI Installation:

    • Checked that the MPI headers exist at /usr/lib/x86_64-linux-gnu/openmpi/include, particularly mpi.h.
    • Verified that libmpi and libmpi_cxx are present via ldconfig.
  2. Tried Linking MPI Libraries Manually:

    • Attempted to add LIBS="-lmpi" to the make test command:
      make test LIBS="-lmpi"
    • The error persisted.
  3. Reconfigured Ipopt:

    • Adjusted the original configure command to explicitly point to OpenMPI libraries and headers:
      ../configure --with-mumps \
      --with-mumps-libs="-L/home/trec/WorkRaj/raisim_legged/MUMPS_5.7.3/lib -ldmumps -lmumps_common -lpord -lscalapack-openmpi -llapack -lblas -lpthread -L/usr/lib/x86_64-linux-gnu/openmpi/lib -lmpi_cxx -lmpi" \
      --with-mumps-cflags="-I/home/trec/WorkRaj/raisim_legged/MUMPS_5.7.3/include -I/usr/lib/x86_64-linux-gnu/openmpi/include" \
      --with-blas="-lblas" \
      --with-lapack="-llapack"
    • The issue remained.

Logs

Output of ldconfig -p | grep mpi:

libmpi.so.40 (libc6,x86-64) => /lib/x86_64-linux-gnu/libmpi.so.40
libmpi.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libmpi.so
libmpi_cxx.so.40 (libc6,x86-64) => /lib/x86_64-linux-gnu/libmpi_cxx.so.40
libmpi_cxx.so (libc6,x86-64) => /lib/x86_64-linux-gnu/libmpi_cxx.so
...

Full Error Log During make test:

/usr/bin/ld: ../src/.libs/libipopt.so: undefined reference to `MPI_Type_get_envelope'
/usr/bin/ld: ../src/.libs/libipopt.so: undefined reference to `ompi_mpi_comm_null'
/usr/bin/ld: ../src/.libs/libipopt.so: undefined reference to `MPI_Abort'
...
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:515: hs071_cpp] Error 1
make: *** [Makefile:849: test] Error 2

Please find the terminal outputs of the respective commands.

make_test_output.txt
make_output.txt
configure_output.txt

@svigerske
Copy link
Member

It should be --with-mumps-lflags.
If that doesn't help, include the output of make and make test with argument V=1 to see compiler and linker calls.

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

2 participants