scipopt / JSCIPOpt

Java interface for the SCIP Optimization Suite
MIT License
62 stars 35 forks source link

installing the JSCIPopt #9

Closed soukaina18 closed 7 years ago

soukaina18 commented 7 years ago

PLz I need help!

I have an issue at 3a) step of the Install.md file . To my mind the principals errors are:

  1. CMake Error at CMakeLists.txt:18 (include): include could not find load file: UseJava

  2. found SCIP library: SCIPOPT_LIBRARIES-NOTFOUND CMake Error at CMakeLists.txt:96 (add_jar): Unknown CMake command "add_jar".

here is the full output:

~$ cd JSCIPOpt-master ~/JSCIPOpt-master$ rm -rf build ~/JSCIPOpt-master$ mkdir build ~/JSCIPOpt-master$ cd build ~/JSCIPOpt-master/build$ cmake .. -- The C compiler identification is GNU -- The CXX compiler identification is GNU -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Found JNI: /usr/lib/jvm/default-java/jre/lib/amd64/libjawt.so -- Java version 1.7.0.85 configured successfully! -- Found Java: /usr/bin/java (found version "1.7.0.85") CMake Error at CMakeLists.txt:18 (include): include could not find load file: UseJava

-- Found SWIG: /usr/local/bin/swig (found version "3.0.12") found SCIP library: SCIPOPT_LIBRARIES-NOTFOUND CMake Error at CMakeLists.txt:96 (add_jar): Unknown CMake command "add_jar".

CMake Error: The following variables are used in this project, but they are set to NOTFOUND. Please set them or make sure they are set and tested correctly in the CMake files: SCIPOPT_LIBRARIES linked by target "jscip" in directory /home/soukaina/JSCIPOpt-master

-- Configuring incomplete, errors occurred! :~/JSCIPOpt-master/build$ `

mueldgog commented 7 years ago

You need to execute the following commands:

cd TheDirectoryOfJSCIPOpt
mkdir lib; cd lib
ln -s /home/soukaina/scipoptsuite-4.0.0/scip-4.0.0/src scipinc
ln -s /home/soukaina/scipoptsuite-4.0.0/lib/libscipopt.so libscipopt.so
cd ..
mkdir build; cd build
cmake ..
make
soukaina18 commented 7 years ago

Thank you sooo much!

I executed the commands and I got the message bellow... I think( Just thinking) that now it's a Java JDK problem, I tried to install it as you mentioned before following this Tutoriel https://stackoverflow.com/questions/14788345/how-to-install-jdk-on-ubuntu-linux

but the 8 version refused to be installed I managed to install the 7 version, a lot of packages have been installed but I think since a old version is already there something went wrong nothing really happened, I was afraid to uninstall the old one and not be able to install the new version since I not a developer and so new to Linux environment.

:~$ cd JSCIPOpt-master :~/JSCIPOpt-master$ rm -rf build :~/JSCIPOpt-master$ rm -rf lib :~/JSCIPOpt-master$ mkdir lib :~/JSCIPOpt-master$ cd lib :~/JSCIPOpt-master/lib$ ln -s /home/soukaina/scipoptsuite-4.0.0/scip-4.0.0/src scipinc :~/JSCIPOpt-master/lib$ ln -s /home/soukaina/scipoptsuite-4.0.0/lib/libscipopt.so libscipopt.so :~/JSCIPOpt-master/lib$ cd .. :~/JSCIPOpt-master$ mkdir build :~/JSCIPOpt-master$ cd build :~/JSCIPOpt-master/build$ cmake .. -- The C compiler identification is GNU -- The CXX compiler identification is GNU -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done CMake Error at /usr/local/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:91 (MESSAGE): Could NOT find JNI (missing: JAVA_AWT_LIBRARY JAVA_JVM_LIBRARY JAVA_INCLUDE_PATH JAVA_INCLUDE_PATH2 JAVA_AWT_INCLUDE_PATH) Call Stack (most recent call first): /usr/local/share/cmake-2.8/Modules/FindPackageHandleStandardArgs.cmake:252 (_FPHSA_FAILURE_MESSAGE) /usr/local/share/cmake-2.8/Modules/FindJNI.cmake:236 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:16 (find_package)

-- Configuring incomplete, errors occurred!

2017-08-02 19:02 GMT+01:00 Benjamin Mueller notifications@github.com:

You need to execute the following commands:

cd TheDirectoryOfJSCIPOpt mkdir lib; cd lib ln -s /home/soukaina/scipoptsuite-4.0.0/scip-4.0.0/src scipinc ln -s /home/soukaina/scipoptsuite-4.0.0/lib/libscipopt.so libscipopt.so cd .. mkdir build; cd build cmake .. make

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SCIP-Interfaces/JSCIPOpt/issues/9#issuecomment-319751050, or mute the thread https://github.com/notifications/unsubscribe-auth/AdPjB-mLCdvOEF_dN2_HA_46liXWzUgQks5sULm6gaJpZM4OrWm8 .

mueldgog commented 7 years ago

Could you call locate jni.h and see whether the output looks like

/usr/lib/jvm/java-7-openjdk-amd64/include/jni.h

? If this is not the case, please check (manually) whether the file exists in the directory or not.

soukaina18 commented 7 years ago

First of all, sorry for repeating this issue. I don't have too much experience with compilers, so sorry again.

Manuall,y I found the jni.h here: /usr/lib/jvm/java-8-openjdk-amd64/include

I just installed the Java-8-openjdk and got :

:~$ java -version openjdk version "1.8.0_131" OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11) OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)

And then , I tried the cmake .. augain in the JSCIPOpt file and this time I got this:

$ rm -rf build soukaina@soukaina-Aspire-5250:~/JSCIPOpt-master$ mkdir build soukaina@soukaina-Aspire-5250:~/JSCIPOpt-master$ cd build soukaina@soukaina-Aspire-5250:~/JSCIPOpt-master/build$ cmake .. -- The C compiler identification is GNU -- The CXX compiler identification is GNU -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Found JNI: /usr/lib/jvm/default-java/jre/lib/amd64/libjawt.so CMake Warning at /usr/local/share/cmake-2.8/Modules/FindJava.cmake:118 (message): regex not supported: openjdk version "1.8.0_131"

OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)

OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode). Please report Call Stack (most recent call first): CMakeLists.txt:17 (find_package)

-- Java version .. configured successfully! -- Found Java: /usr/bin/java (found version "..") CMake Error at CMakeLists.txt:18 (include): include could not find load file:

UseJava

-- Found SWIG: /usr/local/bin/swig (found version "3.0.12") found SCIP library: /home/soukaina/JSCIPOpt-master/lib/libscipopt.so CMake Error at CMakeLists.txt:96 (add_jar): Unknown CMake command "add_jar".

-- Configuring incomplete, errors occurred! soukaina@soukaina-Aspire-5250:~/JSCIPOpt-master/build$ cd .. soukaina@soukaina-Aspire-5250:~/JSCIPOpt-master$ cd .. soukaina@soukaina-Aspire-5250:~$ locate jni.h

2017-08-03 11:33 GMT+01:00 Benjamin Mueller notifications@github.com:

Could you call locate jni.h and see whether the output looks like

/usr/lib/jvm/java-7-openjdk-amd64/include/jni.h

? If no, please check (manually) whether the file exists in the directory or not.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SCIP-Interfaces/JSCIPOpt/issues/9#issuecomment-319932457, or mute the thread https://github.com/notifications/unsubscribe-auth/AdPjB6fztNCcI1ocpY82ajoPRMkzDDjPks5sUaHsgaJpZM4OrWm8 .

soukaina18 commented 7 years ago

I may be mistaken, but I think that the cmake installation is missing the UseJava module for some reason, manually, I found the UseJava installed in: /usr/share/cmake-2.8/Modules/UseJava.cmake. But why the path is not recognized .....what I need to do PL ?

I found in internet that a need to set the JAVA_HOme =/usr/lib/jvm/jdk1.8 or to do this command :

export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 cmake -DBUILD_SHARED_LIBS=OFF ..

but I'm not sure

2017-08-03 11:47 GMT+01:00 Soukaina Sema soukaina.sema@gmail.com:

First of all, sorry for repeating this issue. I don't have too much experience with compilers, so sorry again.

Manuall,y I found the jni.h here: /usr/lib/jvm/java-8-openjdk- amd64/include

I just installed the Java-8-openjdk and got :

:~$ java -version openjdk version "1.8.0_131" OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1. 16.04.3-b11) OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode)

And then , I tried the cmake .. augain in the JSCIPOpt file and this time I got this:

$ rm -rf build soukaina@soukaina-Aspire-5250:~/JSCIPOpt-master$ mkdir build soukaina@soukaina-Aspire-5250:~/JSCIPOpt-master$ cd build soukaina@soukaina-Aspire-5250:~/JSCIPOpt-master/build$ cmake .. -- The C compiler identification is GNU -- The CXX compiler identification is GNU -- Check for working C compiler: /usr/bin/gcc -- Check for working C compiler: /usr/bin/gcc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Found JNI: /usr/lib/jvm/default-java/jre/lib/amd64/libjawt.so CMake Warning at /usr/local/share/cmake-2.8/Modules/FindJava.cmake:118 (message): regex not supported: openjdk version "1.8.0_131"

OpenJDK Runtime Environment (build 1.8.0_131-8u131-b11-2ubuntu1.16.04.3-b11)

OpenJDK 64-Bit Server VM (build 25.131-b11, mixed mode). Please report Call Stack (most recent call first): CMakeLists.txt:17 (find_package)

-- Java version .. configured successfully! -- Found Java: /usr/bin/java (found version "..") CMake Error at CMakeLists.txt:18 (include): include could not find load file:

UseJava

-- Found SWIG: /usr/local/bin/swig (found version "3.0.12") found SCIP library: /home/soukaina/JSCIPOpt-master/lib/libscipopt.so CMake Error at CMakeLists.txt:96 (add_jar): Unknown CMake command "add_jar".

-- Configuring incomplete, errors occurred! soukaina@soukaina-Aspire-5250:~/JSCIPOpt-master/build$ cd .. soukaina@soukaina-Aspire-5250:~/JSCIPOpt-master$ cd .. soukaina@soukaina-Aspire-5250:~$ locate jni.h

2017-08-03 11:33 GMT+01:00 Benjamin Mueller notifications@github.com:

Could you call locate jni.h and see whether the output looks like

/usr/lib/jvm/java-7-openjdk-amd64/include/jni.h

? If no, please check (manually) whether the file exists in the directory or not.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SCIP-Interfaces/JSCIPOpt/issues/9#issuecomment-319932457, or mute the thread https://github.com/notifications/unsubscribe-auth/AdPjB6fztNCcI1ocpY82ajoPRMkzDDjPks5sUaHsgaJpZM4OrWm8 .

mueldgog commented 7 years ago

CMake 2.8 is quite old and probably this issue has been fixed with a newer version. Could you upgrade your CMake and test this again?

soukaina18 commented 7 years ago

Thank you so much Benjamin, words can not describe how thankful I'am right now!!!! Thanks

I upgrade the Cmake version to the lastest one cmake-3.9.0 and everything went fine as follow:

$ cmake .. -- The C compiler identification is GNU 5.4.0 -- The CXX compiler identification is GNU 5.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found JNI: /usr/lib/jvm/default-java/jre/lib/amd64/libjawt.so -- Found Java: /usr/bin/java (found version "1.8.0.131") -- Found SWIG: /usr/local/bin/swig (found version "3.0.12") found SCIP library: /home/soukaina/JSCIPOpt-master/lib/libscipopt.so -- Configuring done -- Generating done -- Build files have been written to: /home/soukaina/JSCIPOpt-master/build soukaina@soukaina-Aspire-5250:~/JSCIPOpt-master/build$ make Scanning dependencies of target jscip [ 10%] Building C object CMakeFiles/jscip.dir/src/scipjni_wrap.c.o [ 20%] Linking C shared library libjscip.so [ 30%] Built target jscip Scanning dependencies of target scipjar [ 40%] Building Java objects for scipjar.jar [ 50%] Generating CMakeFiles/scipjar.dir/java_class_filelist [ 60%] Creating Java archive scip.jar [ 70%] Built target scipjar Scanning dependencies of target examples [ 80%] Building Java objects for examples.jar [ 90%] Generating CMakeFiles/examples.dir/java_class_filelist [100%] Creating Java archive examples.jar [100%] Built target examples soukaina@soukaina-Aspire-5250:~/JSCIPOpt-master/build$

2017-08-03 12:49 GMT+01:00 Benjamin Mueller notifications@github.com:

CMake 2.8 is quite old and probably this issue has been fixed with a newer version. Could you upgrade your CMake and test this again?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SCIP-Interfaces/JSCIPOpt/issues/9#issuecomment-319946835, or mute the thread https://github.com/notifications/unsubscribe-auth/AdPjB87zaIskg0WaoXpE133fiiWOJBlIks5sUbOygaJpZM4OrWm8 .

soukaina18 commented 7 years ago

One more thing plz, how can I use this ....

Execute the examples via

Last question plz (really the Last), now that the " sciplib.so" and "scip.jar" are genereated, Can I use them through Eclips or Netbeans in JavaApplication project as library,,Or I'm mistaken!

Best regards !

2017-08-03 16:48 GMT+01:00 Soukaina Sema soukaina.sema@gmail.com:

Thank you so much Benjamin, words can not describe how thankful I'am right now!!!! Thanks

I upgrade the Cmake version to the lastest one cmake-3.9.0 and everything went fine as follow:

$ cmake .. -- The C compiler identification is GNU 5.4.0 -- The CXX compiler identification is GNU 5.4.0 -- Check for working C compiler: /usr/bin/cc -- Check for working C compiler: /usr/bin/cc -- works -- Detecting C compiler ABI info -- Detecting C compiler ABI info - done -- Detecting C compile features -- Detecting C compile features - done -- Check for working CXX compiler: /usr/bin/c++ -- Check for working CXX compiler: /usr/bin/c++ -- works -- Detecting CXX compiler ABI info -- Detecting CXX compiler ABI info - done -- Detecting CXX compile features -- Detecting CXX compile features - done -- Found JNI: /usr/lib/jvm/default-java/jre/lib/amd64/libjawt.so -- Found Java: /usr/bin/java (found version "1.8.0.131") -- Found SWIG: /usr/local/bin/swig (found version "3.0.12") found SCIP library: /home/soukaina/JSCIPOpt-master/lib/libscipopt.so -- Configuring done -- Generating done -- Build files have been written to: /home/soukaina/JSCIPOpt-master/build soukaina@soukaina-Aspire-5250:~/JSCIPOpt-master/build$ make Scanning dependencies of target jscip [ 10%] Building C object CMakeFiles/jscip.dir/src/scipjni_wrap.c.o [ 20%] Linking C shared library libjscip.so [ 30%] Built target jscip Scanning dependencies of target scipjar [ 40%] Building Java objects for scipjar.jar [ 50%] Generating CMakeFiles/scipjar.dir/java_class_filelist [ 60%] Creating Java archive scip.jar [ 70%] Built target scipjar Scanning dependencies of target examples [ 80%] Building Java objects for examples.jar [ 90%] Generating CMakeFiles/examples.dir/java_class_filelist [100%] Creating Java archive examples.jar [100%] Built target examples soukaina@soukaina-Aspire-5250:~/JSCIPOpt-master/build$

2017-08-03 12:49 GMT+01:00 Benjamin Mueller notifications@github.com:

CMake 2.8 is quite old and probably this issue has been fixed with a newer version. Could you upgrade your CMake and test this again?

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SCIP-Interfaces/JSCIPOpt/issues/9#issuecomment-319946835, or mute the thread https://github.com/notifications/unsubscribe-auth/AdPjB87zaIskg0WaoXpE133fiiWOJBlIks5sUbOygaJpZM4OrWm8 .

mueldgog commented 7 years ago

Yes, this should be possible. You need to include the jar to your project and add the path to the JSCIPOpt build to your LD_LIBRARY_PATH variable, e.g., into your ~/.bashrc. The libscipopt.so might be copied somewhere into your java project that contains the compiled java files (or the directory above?).

First, please try do it on your own and if you don't succeed then I will have a look, but right now I am too busy in order to dig into it. Of course, let me know if you accomplished something and I will update of JSCIPOpt accordingly.

Cheers, Benjamin

soukaina18 commented 7 years ago

I will try my best and I will keep you posted!

Again Thank a billion for your precious help, time, and patience ! You are the best ^_^

Much respect!

Kind regards

Le 3 août 2017 17:22, "Benjamin Mueller" notifications@github.com a écrit :

Yes, this should be possible. You need to include the jar to your project and add the path to the JSCIPOpt build to your LD_LIBRARY_PATH variable, e.g., into your ~/.bashrc. The libscipopt.so might be copied somewhere into your java project that contains the compiled java files (or the directory above?).

First, please try do it on your own and if you don't succeed then I will have a look, but right now I am too busy in order to dig into it. Of course, let me know if you accomplished something and I will update of JSCIPOpt accordingly.

Cheers, Benjamin

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/SCIP-Interfaces/JSCIPOpt/issues/9#issuecomment-320019404, or mute the thread https://github.com/notifications/unsubscribe-auth/AdPjB36AuPehZtmPj-mZWbNbtimNJY-hks5sUfO5gaJpZM4OrWm8 .