nomad
nomad copied to clipboard
Java wrapper build error
OS: Debian "bullseye" Nomad version: 4.2
When building the Java wrapper, following the instructions in interfaces/jNomad/Readme, I get the following error:
[ 93%] Built target jNomad
[ 93%] Linking CXX executable NMOpt.exe
Scanning dependencies of target jNomad_jar
gmake[2]: *** No rule to make target 'interfaces/jNomad/SWIGTYPE_p_NOMAD_4_1__EvalParameters.java', needed by 'interfaces/jNomad/CMakeFiles/jNomad_jar.dir/java_compiled_jNomad_jar'. Stop.
gmake[1]: *** [CMakeFiles/Makefile2:1366: interfaces/jNomad/CMakeFiles/jNomad_jar.dir/all] Error 2
gmake[1]: *** Waiting for unfinished jobs....
and cmake exits with error code 2.
Here is the complete Dockerfile I'm using:
FROM openjdk:8u332-bullseye
ENV DEBIAN_FRONTEND=noninteractive
# Install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
build-essential \
m4 \
cmake \
nano \
curl
WORKDIR /
# First install SWIG
# Install dependencies
RUN apt-get update && apt-get install -y --no-install-recommends \
git \
autotools-dev \
automake \
byacc \
libpcre2-dev
RUN git clone https://github.com/swig/swig.git
WORKDIR swig
RUN ./autogen.sh
RUN ./configure --prefix=/swig
RUN make
RUN make install
RUN ln -s /swig/bin/swig /usr/local/bin/swig
# Compile and install NOMAD
WORKDIR /
RUN curl https://codeload.github.com/bbopt/nomad/tar.gz/refs/tags/v.4.2.0 --output NOMAD42.tar.gz
RUN tar -xf NOMAD42.tar.gz && mv nomad-v.4.2.0 NOMAD42 && rm -r NOMAD42.tar.gz
ENV NOMAD_HOME="/NOMAD42"
WORKDIR /NOMAD42
RUN cmake -DTEST_OPENMP=OFF -DBUILD_INTERFACE_C=ON -DBUILD_INTERFACE_JAVA=ON -S . -B build/release && \
cmake --build build/release --parallel 16 && \
cmake --install build/release
ENV LD_LIBRARY_PATH="/NOMAD42/build/release/lib"
WORKDIR /
CMD /bin/bash
I was able to build the C and Python interfaces without a problem.
Any help would be greatly appreciated!
I will look into that soon. Thanks for reporting this issue.
I have made a few changes to prevent this bug. These changes are available in the master and develop branches. Right now it is NOT available in the Nomad tar.gz.
Mostly, I added a directive to build EvalParameters.java and define a class for EvalParameters in jNomad.i. (in directory interfaces/jNomad). I also replaced a hardcoded template name used in jNomad CMakeLists.txt. I have added a CMake variable NOMAD_SRC_TEMPLATE in the root CMakeLists.txt.
I just tried building the master branch with the Java interface and I got the exact same error as before. I even tried to modify the interfaces/jNomad/CMakeFiles.txt file and use the new variable you created, but I still get the same "no rule to make..." error.
I'm using the same Dockerfile as before, I just replaced the .tar.gz download with the git clone.
I will look into that as soon as possible.
This target 'interfaces/jNomad/SWIGTYPE_p_NOMAD_4_1__EvalParameters.java' is not really needed (and NOMAD_4_1 is the wrong version).
I have fixed this in Develop and Master branches. It will available in next tagged version 4.3.