【问题标题】:Building JSCIPOpt on Linux (Java interface for Scip)在 Linux 上构建 JSCIPOpt(Scip 的 Java 接口)
【发布时间】:2017-08-02 14:55:52
【问题描述】:

我正在尝试使用JSCIPOpt“SCIP 优化套件的 Java 接口”。按照 INSTALL.md 文件中的步骤,我被困在 3a) 这个命令行:

cmake .. [-DCMAKE_BUILD_TYPE=<"Debug" or "Release", default: "Release">]

我收到了这条消息:

cmake .. [-DCMAKE_BUILD_TYPE=<"Debug" or "Release", default: "Release">]
CMake Error: The source directory "/home/soukaina/JSCIPOpt-master/build/Release" does not exist.
Specify --help for usage, or press the help button on the CMake GUI.

然后我这样做了,这次我收到了这条消息:

soukaina@soukaina-Aspire-5250:~/JSCIPOpt-master$ 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 
-- 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    

-- Could NOT find SWIG (missing:  SWIG_EXECUTABLE SWIG_DIR) 
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!}

INSTALL.md 看起来像:

....to use/extend the Java interface, you need:

 - SCIP optimization suite
 - Java JDK
 - C compiler
 - CMake
 - SWIG (optional)

The following steps need to be done before compiling the Java interface.   
1) Create a shared library of the [SCIP optimization suite](http://scip.zib.de/#download) by executing     
    make SHARED=true scipoptlib     
in the SCIP optimization suite directory. Afterwards, you will find the library (*.so) in the ./lib directory of the
optimization suite.

2) Create a symbolic link in JSCIPOpt to the library compiled in 1) and to the source directory of SCIP (in the
optimization suite)

    mkdir -p lib;
    cd lib;
    ln -s <SCIP source directory> scipinc
    ln -s <SCIP opt suite directory>/lib/<scip opt library> libscipopt.so

3a) Building JSCIPOpt on Linux.

Compile the interface by executing the following commands:

 - mkdir build
 - cd build
 - cmake .. [-DCMAKE_BUILD_TYPE=<"Debug" or "Release", default: "Release">]
 - make

Execute the examples via

 - export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./
 - java -cp scip.jar:examples.jar <"Linear" or "Quadratic" or "Read">

【问题讨论】:

  • 好的,格式化输出后,我发现 cmake 在您的 JSCIPOpt/lib 目录中找不到 libscipopt.so。请确保您已遵循 JSCIPOpt 中 INSTALL.md 文件的 1. 和 2. 点。

标签: java linux cmake java-native-interface scip


【解决方案1】:

JSCIPOpt/lib 目录的内容如何?您是否有指向 SCIP 源目录的符号链接和指向 libscipopt.so 的其他符号链接?能否下载并安装最新版本的 Java JDK?

我也认为你误解了

cmake .. [-DCMAKE_BUILD_TYPE=<"Debug" or "Release", default: "Release">]

例如,在调试模式下编译 JSCIPOpt 需要执行以下命令:

cmake .. -DCMAKE_BUILD_TYPE=Debug

编辑:

您没有正确设置符号链接。基本上,你需要执行这些命令:

cd JSCIPOpt
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

【讨论】:

  • 首先,非常感谢您的回复! ..................................................... ..................然后,当我输入“make SHARED=true scipoptlib”时,我得到了 2 个文件:libscipopt.so & libscipopt-4.0.0.linux.x86_64.gnu .opt.so.......PLZ,当您说指向源目录时,这是否意味着此路径“scipoptsuite-4.0.0/scip-4.0.0/src”,,,,,,,, ,,,,,, libscipopt.so 的第二个符号链接我这样输入:“ln -s /home/soukaina/scipoptsuite-4.0.0/lib/libscipopt libscipopt.so”
  • 我在上面的答案中添加了您需要执行的命令。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2019-11-15
  • 2015-10-19
  • 1970-01-01
  • 1970-01-01
  • 2020-10-20
  • 1970-01-01
  • 2013-04-21
相关资源
最近更新 更多