Setting runtime path

我怕爱的太早我们不能终老 提交于 2019-12-24 13:33:26

问题


I am trying to install a package usingluarocks. This is the output I get:

[100%] Linking CXX shared module libcustn.so
[100%] Built target custn
Install the project...
-- Install configuration: "Release"
-- Installing: /home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lib/libstn.so
-- Set runtime path of "/home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lib/libstn.so" to "$ORIGIN/../lib:/home/tex/torch/install/lib"
-- Installing: /home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lua/stn/test.lua
-- Installing: /home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lua/stn/AffineGridGeneratorBHWD.lua
-- Installing: /home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lua/stn/AffineTransformMatrixGenerator.lua
-- Installing: /home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lua/stn/init.lua
-- Installing: /home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lua/stn/BilinearSamplerBHWD.lua
-- Installing: /home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lib/libcustn.so
-- Set runtime path of "/home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lib/libcustn.so" to "$ORIGIN/../lib:/home/tex/torch/install/lib"
Warning: /home/tex/torch/install/lib/lua/5.1/stnbhwd_scm_1-libstn.so is not tracked by this installation of LuaRocks. Moving it to /home/tex/torch/install/lib/lua/5.1/stnbhwd_scm_1-libstn.so~~~~~~~~~
Warning: /home/tex/torch/install/lib/lua/5.1/stnbhwd_scm_1-libcustn.so is not tracked by this installation of LuaRocks. Moving it to /home/tex/torch/install/lib/lua/5.1/stnbhwd_scm_1-libcustn.so~~~~~~~~
stnbhwd scm-1 is now installed in /home/tex/torch/install/ (license: MIT)

For reference, this is the CMakeLists.txt file:

CMAKE_MINIMUM_REQUIRED(VERSION 2.8 FATAL_ERROR)
CMAKE_POLICY(VERSION 2.8)

SET(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake" "${CMAKE_MODULE_PATH}")

FIND_PACKAGE(Torch REQUIRED)

# Flags
# When using MSVC
IF(MSVC)
  # we want to respect the standard, and we are bored of those **** .
  ADD_DEFINITIONS(-D_CRT_SECURE_NO_DEPRECATE=1)
ENDIF(MSVC)

# OpenMP support?
SET(WITH_OPENMP ON CACHE BOOL "OpenMP support if available?")
IF (APPLE AND CMAKE_COMPILER_IS_GNUCC)
  EXEC_PROGRAM (uname ARGS -v  OUTPUT_VARIABLE DARWIN_VERSION)
  STRING (REGEX MATCH "[0-9]+" DARWIN_VERSION ${DARWIN_VERSION})
  MESSAGE (STATUS "MAC OS Darwin Version: ${DARWIN_VERSION}")
  IF (DARWIN_VERSION GREATER 9)
    SET(APPLE_OPENMP_SUCKS 1)
  ENDIF (DARWIN_VERSION GREATER 9)
  EXECUTE_PROCESS (COMMAND ${CMAKE_C_COMPILER} -dumpversion
    OUTPUT_VARIABLE GCC_VERSION)
  IF (APPLE_OPENMP_SUCKS AND GCC_VERSION VERSION_LESS 4.6.2)
    MESSAGE(STATUS "Warning: Disabling OpenMP (unstable with this version of GCC)")
    MESSAGE(STATUS " Install GCC >= 4.6.2 or change your OS to enable OpenMP")
    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-unknown-pragmas")
    SET(WITH_OPENMP OFF CACHE BOOL "OpenMP support if available?" FORCE)
  ENDIF ()
ENDIF ()

IF (WITH_OPENMP)
  FIND_PACKAGE(OpenMP)
  IF(OPENMP_FOUND)
    MESSAGE(STATUS "Compiling with OpenMP support")
    SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
    SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
    SET(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} ${OpenMP_EXE_LINKER_FLAGS}")
  ENDIF(OPENMP_FOUND)
ENDIF (WITH_OPENMP)

LINK_DIRECTORIES("${Torch_INSTALL_LIB}")

SET(src init.c)
FILE(GLOB luasrc *.lua)
ADD_TORCH_PACKAGE(stn "${src}" "${luasrc}")
TARGET_LINK_LIBRARIES(stn luaT TH)


FIND_PACKAGE(CUDA 5.5)

IF (CUDA_FOUND)
  LIST(APPEND CUDA_NVCC_FLAGS "-arch=sm_30")

  INCLUDE_DIRECTORIES("${Torch_INSTALL_INCLUDE}/THC")
  SET(src-cuda init.cu)
  CUDA_ADD_LIBRARY(custn MODULE ${src-cuda})
  TARGET_LINK_LIBRARIES(custn luaT THC TH)
  IF(APPLE)
    SET_TARGET_PROPERTIES(custn PROPERTIES
      LINK_FLAGS "-undefined dynamic_lookup")
  ENDIF()
  ### Torch packages supposes libraries prefix is "lib"
  SET_TARGET_PROPERTIES(custn PROPERTIES
    PREFIX "lib"
    IMPORT_PREFIX "lib")

  INSTALL(TARGETS custn
    RUNTIME DESTINATION "${Torch_INSTALL_LUA_CPATH_SUBDIR}"
    LIBRARY DESTINATION "${Torch_INSTALL_LUA_CPATH_SUBDIR}")
ENDIF(CUDA_FOUND)

When I try to load the package in lua, it says it cannot find the package:

Failed loading module stn in LuaRocks rock stnbhwd scm-1
    no field package.preload['stn']
    no file '/home/tex/.luarocks/share/lua/5.1/stn.lua'
    no file '/home/tex/.luarocks/share/lua/5.1/stn/init.lua'
    no file '/home/tex/torch/install/share/lua/5.1/stn.lua'
    no file '/home/tex/torch/install/share/lua/5.1/stn/init.lua'
    no file './stn.lua'
    no file '/home/tex/torch/install/share/luajit-2.1.0-beta1/stn.lua'
    no file '/usr/local/share/lua/5.1/stn.lua'
    no file '/usr/local/share/lua/5.1/stn/init.lua'
    no file '/home/tex/.luarocks/lib/lua/5.1/stn.so'
    no file '/home/tex/torch/install/lib/lua/5.1/stn.so'
    no file '/home/tex/torch/install/lib/stn.so'
    no file './stn.so'
    no file '/usr/local/lib/lua/5.1/stn.so'
    no file '/usr/local/lib/lua/5.1/loadall.so'
stack traceback:
    [C]: in function 'error'
    /home/tex/torch/install/share/lua/5.1/trepl/init.lua:389: in function 'require'
    run_model.lua:6: in main chunk
    [C]: in function 'dofile'
    .../tex/torch/install/lib/luarocks/rocks/trepl/scm-1/bin/th:150: in main chunk
    [C]: at 0x00405d50

In the installation message, these lines stand out:

Set runtime path of "/home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lib/libstn.so" to "$ORIGIN/../lib:/home/tex/torch/install/lib"
-- Installing: /home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lua/stn/test.lua
-- Installing: /home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lua/stn/AffineGridGeneratorBHWD.lua
-- Installing: /home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lua/stn/AffineTransformMatrixGenerator.lua
-- Installing: /home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lua/stn/init.lua
-- Installing: /home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lua/stn/BilinearSamplerBHWD.lua
-- Installing: /home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lib/libcustn.so
-- Set runtime path of "/home/tex/torch/install/lib/luarocks/rocks/stnbhwd/scm-1/lib/libcustn.so" to "$ORIGIN/../lib:/home/tex/torch/install/lib"
Warning: /home/tex/torch/install/lib/lua/5.1/stnbhwd_scm_1-libstn.so is not tracked by this installation of LuaRocks. Moving it to /home/tex/torch/install/lib/lua/5.1/stnbhwd_scm_1-libstn.so~~~~~~~~~
Warning: /home/tex/torch/install/lib/lua/5.1/stnbhwd_scm_1-libcustn.so is not tracked by this installation of LuaRocks. Moving it to /home/tex/torch/install/lib/lua/5.1/stnbhwd_scm_1-libcustn.so~~~~~~~~
stnbhwd scm-1 is now installed in /home/tex/torch/install/ (license: MIT)

What does this tell you? I have no idea what's going on.

来源:https://stackoverflow.com/questions/47667498/setting-runtime-path

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!