lua---mattorch
lua---mattorch copied to clipboard
OS X build failed, seems Makefile not correct
I made attempt building and installing mattorch on OS X, by:
sudo luarocks install mattorch
Installing https://raw.githubusercontent.com/torch/rocks/master/mattorch-1.0-0.rockspec...
Using https://raw.githubusercontent.com/torch/rocks/master/mattorch-1.0-0.rockspec... switching to 'build' mode
Cloning into 'lua---mattorch'...
remote: Counting objects: 19, done.
remote: Compressing objects: 100% (16/16), done.
remote: Total 19 (delta 0), reused 8 (delta 0)
Receiving objects: 100% (19/19), 11.32 KiB | 0 bytes/s, done.
Checking connectivity... done.
Note: checking out 'c3640f86dc23c9cac836752576f6a3594d9fc4e3'.
You are in 'detached HEAD' state. You can look around, make experimental
changes and commit them, and you can discard any commits you make in this
state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may
do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
cmake -E make_directory build;
cd build;
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/usr/local/bin/.." -DCMAKE_INSTALL_PREFIX="/usr/local/lib/luarocks/rocks/mattorch/1.0-0";
make
-- The C compiler identification is AppleClang 5.1.0.5030040
-- The CXX compiler identification is AppleClang 5.1.0.5030040
-- 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
-- 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 Torch7 in /usr/local
-- ** WARNING no MATLAB_ROOT setting to /opt/matlab
-- ** you can set the correct MATLAB_ROOT in your environment
-- ** eg. bash: export MATLAB_ROOT=/home/john/matlab
-- Using Matlab in: /opt/matlab
CMake Error at /usr/local/Cellar/cmake/3.0.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:136 (message):
MATLAB_INCLUDE_DIR (missing: MATLAB_MEX_LIBRARY MATLAB_MAT_LIBRARY
MATLAB_ENG_LIBRARY MATLAB_MX_LIBRARY)
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.0.1/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:343 (_FPHSA_FAILURE_MESSAGE)
FindMatlab.cmake:123 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:11 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred!
See also "/tmp/luarocks_mattorch-1.0-0-5516/lua---mattorch/build/CMakeFiles/CMakeOutput.log".
make: *** No targets specified and no makefile found. Stop.
Error: Build error: Failed building.
you can install it manually:
git clone https://github.com/clementfarabet/lua---mattorch.git
cd lua---mattorch
mkdir build
cd build
cmake -DMATLAB_ROOT=/Applications/MATLAB_R2014a.app/ ..
cd ..
luarocks make
Tested, it works! thx @szagoruyko
Yeah same here! Thanks
Not me: Linking C shared library libmattorchlive.dylib Undefined symbols for architecture x86_64:
Me neither on mac OSX:-
ld: symbol(s) not found for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make[2]: *** [libmattorchlive.dylib] Error 1 make[1]: *** [CMakeFiles/mattorchlive.dir/all] Error 2 make: *** [all] Error 2
Anybody found way around this problem?
Linking C shared library libmattorchlive.dylib ld: symbol(s) not found for architecture x86_64
I am on Ubuntu 14 and I encountered the same problem with luarocks install mattorch
. After I set the correct MATLAB_ROOT path in my bashrc, the error persisted:
-- Using Matlab in: /usr/local/MATLAB/R2015a:
CMake Error at /usr/share/cmake-3.2/Modules/FindPackageHandleStandardArgs.cmake:138 (message):
MATLAB_INCLUDE_DIR (missing: MATLAB_MEX_LIBRARY MATLAB_MAT_LIBRARY
MATLAB_ENG_LIBRARY MATLAB_MX_LIBRARY)
Call Stack (most recent call first):
/usr/share/cmake-3.2/Modules/FindPackageHandleStandardArgs.cmake:374 (_FPHSA_FAILURE_MESSAGE)
FindMatlab.cmake:123 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:11 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred!
See also "/tmp/luarocks_mattorch-1.0-0-7695/lua---mattorch/build/CMakeFiles/CMakeOutput.log".
make: *** No targets specified and no makefile found. Stop.
Then I somehow managed to fix the problem by using MATLAB_ROOT=/usr/local/MATLAB/R2015a luarocks install mattorch
instead!
@qizhuli
Hey, there is no need to install mattorch
to perform data transferation between .mat
and .t7
, matio
in the torch wiki is your better choice!
Good luck~
Regards, rus
I have the same issue. I am using OSX version 10.11.4. I have very large .mat files and I have to save it with "-v7.3" flag in MATLAB, and matio does not read 'v7.3' files, so I think I have to use mattorch, but it does not compile...
I've used both methods, both times it gives me the same error:
- I tried using the manual compiling suggested above.
- ) I've also tried using
MATLAB_ROOT=/Applications/MATLAB_R2014b.app luarocks install mattorch
.
both times I got the following error:
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [libmattorchlive.dylib] Error 1
make[1]: *** [CMakeFiles/mattorchlive.dir/all] Error 2
make: *** [all] Error 2
Error: Build error: Failed building.
does anyone know a solution to the compiling issues? Thanks in advance!
I have fixed the same problem using MATLAB_ROOT=/Applications/MATLAB_R2014b.app luarocks install mattorch
I took the following steps for UBUNTU 14.04
git clone https://github.com/clementfarabet/lua---mattorch.git cd lua---mattorch mkdir build cd build cmake -DMATLAB_ROOT=/usr/local/MATLAB/R2017a
after this command this error raised.
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: MATLAB_ENG_LIBRARY (ADVANCED) linked by target "mattorch" in directory /home/codehead/lua---mattorch/build linked by target "mattorchlive" in directory /home/codehead/lua---mattorch/build MATLAB_INCLUDE_DIR (ADVANCED) used as include directory in directory /home/codehead/lua---mattorch/build used as include directory in directory /home/codehead/lua---mattorch/build MATLAB_MEX_LIBRARY (ADVANCED) linked by target "mattorch" in directory /home/codehead/lua---mattorch/build linked by target "mattorchlive" in directory /home/codehead/lua---mattorch/build MATLAB_MX_LIBRARY (ADVANCED) linked by target "mattorch" in directory /home/codehead/lua---mattorch/build linked by target "mattorchlive" in directory /home/codehead/lua---mattorch/build
-- Configuring incomplete, errors occurred! See also "/home/codehead/lua---mattorch/build/CMakeFiles/CMakeOutput.log".
@codeheadshopon Hi, your CMake variables of Matlab is NOT FOUND, you need to set them in your CMakeList.txt, good luck~
I was having the same errors as the original poster on macOS 10.12.4, so tried a manual install:
git clone https://github.com/clementfarabet/lua---mattorch.git
cd lua---mattorch
mkdir build
cd build
cmake -DMATLAB_ROOT=/Applications/MATLAB_R2014a.app/ ..
cd ..
luarocks make
However, I still got the following output:
cmake -E make_directory build;
cd build;
cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/Users/nicholasarner/torch/install/bin/.." -DCMAKE_INSTALL_PREFIX="/Users/nicholasarner/torch/install/lib/luarocks/rocks/mattorch/1.0-0";
make
-- Found Torch7 in /Users/nicholasarner/torch/install
-- Using Matlab in: /Applications/MATLAB_R2014a.app/
CMake Error at /usr/local/Cellar/cmake/3.8.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:137 (message):
MATLAB_INCLUDE_DIR (missing: MATLAB_MEX_LIBRARY MATLAB_MAT_LIBRARY
MATLAB_ENG_LIBRARY MATLAB_MX_LIBRARY)
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.8.0/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:377 (_FPHSA_FAILURE_MESSAGE)
FindMatlab.cmake:123 (FIND_PACKAGE_HANDLE_STANDARD_ARGS)
CMakeLists.txt:11 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred!
See also "/Users/nicholasarner/lua---mattorch/build/CMakeFiles/CMakeOutput.log".
make: *** No targets specified and no makefile found. Stop.
Error: Build error: Failed building.
@narner you may not have used correct MATLAB_ROOT path.
This solved the problem of
ld: symbol(s) not found for architecture x86_64
Based on git commit by szagoruyko I got the idea to add SET(CMAKE_C_FLAGS "-undefined dynamic_lookup")
to CMakeLists.txt.
Thanks szagoruyko!
This is how my CMakeList.txt looks after the edit:
SET(CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR})
CMAKE_MINIMUM_REQUIRED(VERSION 2.6 FATAL_ERROR)
CMAKE_POLICY(VERSION 2.6)
IF(LUAROCKS_PREFIX)
MESSAGE(STATUS "Installing Torch through Luarocks")
STRING(REGEX REPLACE "(.*)lib/luarocks/rocks.*" "\\1" CMAKE_INSTALL_PREFIX "${LUAROCKS_PREFIX}")
MESSAGE(STATUS "Prefix inferred from Luarocks: ${CMAKE_INSTALL_PREFIX}")
ENDIF()
FIND_PACKAGE(Torch REQUIRED)
FIND_PACKAGE(Matlab REQUIRED)
INCLUDE_DIRECTORIES(${MATLAB_INCLUDE_DIR} ${TORCH_INCLUDE_DIR})
ADD_LIBRARY(mattorchlive SHARED mattorchlive.c)
SET(CMAKE_C_FLAGS "-undefined dynamic_lookup")
LINK_DIRECTORIES(${TORCH_LIBRARY_DIR})
TARGET_LINK_LIBRARIES(mattorchlive TH luaT ${MATLAB_LIBRARIES})
SET(src mattorch.c)
SET(luasrc init.lua)
ADD_TORCH_PACKAGE(mattorch "${src}" "${luasrc}" "Compatibility Tools")
TARGET_LINK_LIBRARIES(mattorch luaT TH ${MATLAB_LIBRARIES})
I have the same error and I try the method :
git clone https://github.com/clementfarabet/lua---mattorch.git cd lua---mattorch mkdir build cd build cmake -DMATLAB_ROOT=/Applications/MATLAB_R2014a.app/ .. cd .. luarocks make
It will stili be wrong!
xuekun@xuekun-Inspiron-5420:~$ luarocks install mattorch Installing https://raw.githubusercontent.com/torch/rocks/master/mattorch-1.0-0.rockspec... Using https://raw.githubusercontent.com/torch/rocks/master/mattorch-1.0-0.rockspec... switching to 'build' mode Cloning into 'lua---mattorch'... remote: Counting objects: 19, done. remote: Compressing objects: 100% (16/16), done. remote: Total 19 (delta 0), reused 8 (delta 0), pack-reused 0 Receiving objects: 100% (19/19), 11.32 KiB | 0 bytes/s, done. Checking connectivity... done. Note: checking out 'c3640f86dc23c9cac836752576f6a3594d9fc4e3'.
You are in 'detached HEAD' state. You can look around, make experimental changes and commit them, and you can discard any commits you make in this state without impacting any branches by performing another checkout.
If you want to create a new branch to retain commits you create, you may do so (now or later) by using -b with the checkout command again. Example:
git checkout -b new_branch_name
cmake -E make_directory build; cd build; cmake .. -DCMAKE_BUILD_TYPE=Release -DCMAKE_PREFIX_PATH="/home/xuekun/torch/install/bin/.." -DCMAKE_INSTALL_PREFIX="/home/xuekun/torch/install/lib/luarocks/rocks/mattorch/1.0-0"; make
-- The C compiler identification is GNU 4.8.4 -- The CXX compiler identification is GNU 4.8.4 -- 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 Torch7 in /home/xuekun/torch/install -- ** WARNING no MATLAB_ROOT setting to /opt/matlab -- ** you can set the correct MATLAB_ROOT in your environment -- ** eg. bash: export MATLAB_ROOT=/home/john/matlab -- Using Matlab in: /opt/matlab CMake Error at /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:148 (message): MATLAB_INCLUDE_DIR (missing: MATLAB_MEX_LIBRARY MATLAB_MAT_LIBRARY MATLAB_ENG_LIBRARY MATLAB_MX_LIBRARY) Call Stack (most recent call first): /usr/share/cmake-3.5/Modules/FindPackageHandleStandardArgs.cmake:388 (_FPHSA_FAILURE_MESSAGE) FindMatlab.cmake:123 (FIND_PACKAGE_HANDLE_STANDARD_ARGS) CMakeLists.txt:11 (FIND_PACKAGE)
-- Configuring incomplete, errors occurred! See also "/tmp/luarocks_mattorch-1.0-0-117/lua---mattorch/build/CMakeFiles/CMakeOutput.log". make: *** No targets specified and no makefile found. Stop.
Error: Build error: Failed building.
xuekun@xuekun-Inspiron-5420:~$ git clone https://github.com/clementfarabet/lua---mattorch.git fatal: destination path 'lua---mattorch' already exists and is not an empty directory. xuekun@xuekun-Inspiron-5420:~$ cd lua---mattorch xuekun@xuekun-Inspiron-5420:~/lua---mattorch$ mkdir build mkdir: cannot create directory ‘build’: File exists xuekun@xuekun-Inspiron-5420:~/lua---mattorch$ cd build xuekun@xuekun-Inspiron-5420:~/lua---mattorch/build$ cmake -DMATLAB_ROOT=/usr/local/MATLAB/R2015b CMake Error: The source directory "/home/xuekun/lua---mattorch/build" does not appear to contain CMakeLists.txt. Specify --help for usage, or press the help button on the CMake GUI.
I looked up a lot of solutions, none of them worked. Is there any other solution? Thanks!