build errors for Mattorch

929 views
Skip to first unread message

Tlacael Esparza

unread,
Feb 9, 2014, 3:17:13 PM2/9/14
to tor...@googlegroups.com
Hi Everyone, 
I'm having trouble installing mattorch on osx Mavericks and I haven't been able to find a solution. 

Any help is appreciated.


This is my call: 

MATLAB_ROOT=/Applications/MATLAB_R2012a_Student.app luarocks install mattorch

It seems to be finding my Matlab installation fine:

-- The C compiler identification is Clang 5.0.0
-- The CXX compiler identification is Clang 5.0.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
-- 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
-- Using Matlab in: /Applications/MATLAB_R2012a_Student.app
-- Found Matlab: /Applications/MATLAB_R2012a_Student.app/bin/maci64/libmex.dylib
-- Configuring done
-- Generating done
-- Build files have been written to: /tmp/luarocks_mattorch-1.0-0-7693/lua---mattorch/build

But then there are a bunch of deprecation warnings:

13 warnings generated.
Linking C shared module libmattorch.so
[ 50%] Built target mattorch
Scanning dependencies of target mattorchlive
[100%] Building C object CMakeFiles/mattorchlive.dir/mattorchlive.c.o
/tmp/luarocks_mattorch-1.0-0-7693/lua---mattorch/mattorchlive.c:74:3: warning: implicit declaration of function 'lua_executable_dir' is
invalid in C99 [-Wimplicit-function-declaration]
lua_executable_dir("./lua");
^
/tmp/luarocks_mattorch-1.0-0-7693/lua---mattorch/mattorchlive.c:158:33: warning: 'luaT_checktypename2id' is deprecated
[-Wdeprecated-declarations]
luaT_pushudata(L, tensor, luaT_checktypename2id(L, "torch.DoubleTensor"));
^
/usr/local/include/luaT.h:106:38: note: 'luaT_checktypename2id' declared here
LUAT_API LUAT_DEPRECATED const char* luaT_checktypename2id(lua_State *L, const char *tname); /* same as luaT_typenameid */
^
...

And then the build fails:
Linking C shared library libmattorchlive.dylib
Undefined symbols for architecture x86_64:
  "_luaL_error", referenced from:
      _lstop in mattorchlive.c.o
  "_luaL_loadbuffer", referenced from:
      _mattorch_dostring in mattorchlive.c.o
  "_luaL_loadfile", referenced from:
      _mattorch_dofile in mattorchlive.c.o
  "_luaL_newstate", referenced from:
      _mattorch_init in mattorchlive.c.o
  "_luaL_openlibs", referenced from:
      _mattorch_init in mattorchlive.c.o
  "_lua_call", referenced from:
      _mattorch_callfunc in mattorchlive.c.o
      _traceback in mattorchlive.c.o
  "_lua_close", referenced from:
      _mattorch_close in mattorchlive.c.o
  "_lua_executable_dir", referenced from:
      _mattorch_init in mattorchlive.c.o
  "_lua_gc", referenced from:
      _mattorch_init in mattorchlive.c.o
      _docall in mattorchlive.c.o
  "_lua_getfield", referenced from:
      _mattorch_dorequire in mattorchlive.c.o
      _mattorch_callfunc in mattorchlive.c.o
      _traceback in mattorchlive.c.o
  "_lua_gettop", referenced from:
      _docall in mattorchlive.c.o
  "_lua_insert", referenced from:
      _docall in mattorchlive.c.o
  "_lua_isstring", referenced from:
      _traceback in mattorchlive.c.o
  "_lua_pcall", referenced from:
      _docall in mattorchlive.c.o
  "_lua_pushcclosure", referenced from:
      _docall in mattorchlive.c.o
  "_lua_pushinteger", referenced from:
      _traceback in mattorchlive.c.o
  "_lua_pushstring", referenced from:
      _mattorch_dorequire in mattorchlive.c.o
  "_lua_pushvalue", referenced from:
      _traceback in mattorchlive.c.o
  "_lua_remove", referenced from:
      _docall in mattorchlive.c.o
  "_lua_sethook", referenced from:
      _laction in mattorchlive.c.o
      _lstop in mattorchlive.c.o
  "_lua_settop", referenced from:
      _report in mattorchlive.c.o
      _mattorch_callfunc in mattorchlive.c.o
      _traceback in mattorchlive.c.o
  "_lua_tolstring", referenced from:
      _report in mattorchlive.c.o
  "_lua_type", referenced from:
      _report in mattorchlive.c.o
      _traceback in mattorchlive.c.o
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.

Full log attached. 

mattorch_fail.txt

Olivier Henaff

unread,
May 1, 2014, 10:15:25 PM5/1/14
to tor...@googlegroups.com
I am having the same problem. I'm installing mattorch on OSX with the following call

olivierhenaff$ MATLAB_ROOT=/Users/olivierhenaff/Applications/MATLAB.app/bin/ luarocks install mattorch

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'.

**stuff**

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 Clang 5.1.0
-- The CXX compiler identification is Clang 5.1.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
-- 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
-- Using Matlab in: /Users/olivierhenaff/Applications/MATLAB.app/bin/
CMake Error at /usr/local/Cellar/cmake/2.8.12.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:108 (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/2.8.12.2/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:315 (_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-3562/lua---mattorch/build/CMakeFiles/CMakeOutput.log".
make: *** No targets specified and no makefile found.  Stop.


Any ideas?

thanks!

Olivier 

soumith

unread,
May 2, 2014, 12:31:31 AM5/2/14
to torch7 on behalf of Olivier Henaff
Alternatively, you can try this package:

it will load variables from matlab .mat files as tensors.

It doesn't require matlab installed on your system, but you have to install libmatio (brew install libmatio)

I just created it, so haven't tested it extensively.
Seems to work for the matlab matrices I threw at it for my work.


--
You received this message because you are subscribed to the Google Groups "torch7" group.
To unsubscribe from this group and stop receiving emails from it, send an email to torch7+un...@googlegroups.com.
To post to this group, send email to tor...@googlegroups.com.
Visit this group at http://groups.google.com/group/torch7.
For more options, visit https://groups.google.com/d/optout.

Zhang Chenyang

unread,
Aug 19, 2014, 10:01:36 PM8/19/14
to tor...@googlegroups.com
Hi I use 'brew install libmatio' and 'luarocks install matio' and then I can load matio but cannot use it:

>>require 'matio'

{

  load : function: 0x0b30a1d0

  ffi : 

    {

      T_UINT32 : 6

      F_DONT_COPY_DATA : 1

      T_COMPRESSED : 15

      C_EMPTY : 0

      T_INT16 : 3

      logInit : cdata<int ()>: 0x0b321f4b

      varGetStructFieldByName : cdata<struct matvar_t *()>: 0x0b34346f

      C_UINT32 : 13

      calcSingleSubscript : cdata<int ()>: 0x0b34201d

      COMPRESSION_NONE : 0

      varWriteInfo : cdata<int ()>: 0x0b342be2

      varRead : cdata<struct matvar_t *()>: 0x0b342b6d

      BY_INDEX : 2

      varCreate : cdata<struct matvar_t *()>: 0x0b3414e0

      calcSubscripts : cdata<int *()>: 0x0b34207b

      help : cdata<void ()>: 0x0b321f08

      setVerbose : cdata<int ()>: 0x0b321af1

      logClose : cdata<int ()>: 0x0b321f35

      varWriteData : cdata<int ()>: 0x0b342c13

      varWrite : cdata<int ()>: 0x0b341bd7

      varSetStructFieldByName : cdata<struct matvar_t *()>: 0x0b343c62

      COMPRESSION_ZLIB : 1

      sizeOf : cdata<uint64_t ()>: 0x0b3221a4

      varSetStructFieldByIndex : cdata<struct matvar_t *()>: 0x0b343bb1

      varGetNumberOfFields : cdata<unsigned int ()>: 0x0b34339d

      C_CELL : 1

      varReadNextInfo : cdata<struct matvar_t *()>: 0x0b342a23

      C_CHAR : 4

      varGetStructsLinear : cdata<struct matvar_t *()>: 0x0b343a25

      T_UINT16 : 4

      varReadNext : cdata<struct matvar_t *()>: 0x0b341b5e

      T_INT8 : 1

      varReadInfo : cdata<struct matvar_t *()>: 0x0b342a4b

      message : cdata<int ()>: 0x0b321b13

      varReadDataLinear : cdata<int ()>: 0x0b3429de

      close : cdata<int ()>: 0x0b34113f

      varGetCell : cdata<struct matvar_t *()>: 0x0b342d80

      C_OBJECT : 3

      varDuplicate : cdata<struct matvar_t *()>: 0x0b341c05

      T_INT32 : 5

      C_INT64 : 14

      F_COMPLEX : 2048

      T_UNKNOWN : 0

      rewind : cdata<int ()>: 0x0b3410ef

      C_UINT16 : 11

      varPrint : cdata<void ()>: 0x0b3421e4

      varGetStructs : cdata<struct matvar_t *()>: 0x0b3435da

      C_SINGLE : 7

      F_GLOBAL : 1024

      getVersion : cdata<enum mat_ft ()>: 0x0b3413e1

      varGetStructFieldnames : cdata<char *const *()>: 0x0b3433bc

      T_MATRIX : 14

      varGetStructField : cdata<struct matvar_t *()>: 0x0b34355f

      T_INT64 : 12

      C : userdata: 0x0b2fdac0

      C_SPARSE : 5

      varSetCell : cdata<struct matvar_t *()>: 0x0b3430c8

      C_INT8 : 8

      T_UTF8 : 16

      FT_MAT5 : 256

      FT_MAT4 : 16

      varGetCells : cdata<struct matvar_t **()>: 0x0b342dc7

      setDebug : cdata<int ()>: 0x0b321b05

      varReadDataAll : cdata<int ()>: 0x0b342991

      varDelete : cdata<int ()>: 0x0b3419c0

      debugMessage : cdata<int ()>: 0x0b321c20

      varFree : cdata<void ()>: 0x0b341195

      warning : cdata<void ()>: 0x0b3220ed

      varCreateStruct : cdata<struct matvar_t *()>: 0x0b343110

      T_DOUBLE : 9

      T_UINT8 : 2

      varCalloc : cdata<struct matvar_t *()>: 0x0b341411

      T_FUNCTION : 24

      varAddStructField : cdata<int ()>: 0x0b343270

      BY_NAME : 1

      T_UTF32 : 18

      varGetCellsLinear : cdata<struct matvar_t **()>: 0x0b34305e

      sizeOfClass : cdata<uint64_t ()>: 0x0b3413f1

      getFilename : cdata<const char *()>: 0x0b3413d0

      createVer : cdata<struct _mat_t *()>: 0x0b340e03

      T_SINGLE : 7

      varGetSize : cdata<uint64_t ()>: 0x0b342119

      open : cdata<struct _mat_t *()>: 0x0b340e19

      error : cdata<void ()>: 0x0b321e51

      F_LOGICAL : 512

      C_INT16 : 10

      T_UTF16 : 17

      varReadData : cdata<int ()>: 0x0b34294c

      C_STRUCT : 2

      T_STRUCT : 22

      verbMessage : cdata<int ()>: 0x0b321cdd

      T_STRING : 20

      T_CELL : 21

      logInitFunc : cdata<int ()>: 0x0b3220c3

      FT_MAT73 : 512

      C_INT32 : 12

      C_FUNCTION : 16

      C_UINT8 : 9

      critical : cdata<void ()>: 0x0b321d9a

      ACC_RDONLY : 0

      T_UINT64 : 13

      varGetStructFieldByIndex : cdata<struct matvar_t *()>: 0x0b3433e0

      C_UINT64 : 15

      T_ARRAY : 23

      getLibraryVersion : cdata<void ()>: 0x0b340ddc

      C_DOUBLE : 6

      ACC_RDWR : 1

    }

}

>>type(matio)

nil

On Friday, May 2, 2014 12:31:31 AM UTC-4, smth chntla wrote:
Alternatively, you can try this package:

it will load variables from matlab .mat files as tensors.

It doesn't require matlab installed on your system, but you have to install libmatio (brew install libmatio)

I just created it, so haven't tested it extensively.
Seems to work for the matlab matrices I threw at it for my work.

soumith

unread,
Aug 19, 2014, 11:10:54 PM8/19/14
to torch7 on behalf of abes

Mario follows lua52 package convention. So do

matio = require 'matio';

Zhang Chenyang

unread,
Aug 25, 2014, 6:02:57 PM8/25/14
to tor...@googlegroups.com
Hi,

For Mac it works fine but under ubuntu, it cannot find 'libmatio.so'

and I checked /usr/local/share/lua/5.1/ and there is not a libmatio.so there, where it suppose to be?
Thanks


On Tuesday, August 19, 2014 11:10:54 PM UTC-4, smth chntla wrote:

Mario follows lua52 package convention. So do

matio = require 'matio';

soumith

unread,
Aug 26, 2014, 12:31:06 PM8/26/14
to torch7 on behalf of Zhang Chenyang
did you install libmatio before-hand? sudo apt-get install libmatio2
Message has been deleted

Zhang Chenyang

unread,
Aug 31, 2014, 4:20:27 PM8/31/14
to tor...@googlegroups.com
Hi,

Yes I have installed libmatio2:
~$ sudo apt-get install libmatio2
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  libhdf5-7
The following NEW packages will be installed:
  libhdf5-7 libmatio2
0 upgraded, 2 newly installed, 0 to remove and 146 not upgraded.
Need to get 1,282 kB of archives.
After this operation, 4,142 kB of additional disk space will be used.
Do you want to continue? [Y/n] 
Get:1 http://us.archive.ubuntu.com/ubuntu/ trusty/universe libhdf5-7 amd64 1.8.11-5ubuntu7 [1,205 kB]
Get:2 http://us.archive.ubuntu.com/ubuntu/ trusty/universe libmatio2 amd64 1.5.2-1ubuntu1 [76.8 kB]
Fetched 1,282 kB in 1s (896 kB/s)   
Selecting previously unselected package libhdf5-7:amd64.
(Reading database ... 179105 files and directories currently installed.)
Preparing to unpack .../libhdf5-7_1.8.11-5ubuntu7_amd64.deb ...
Unpacking libhdf5-7:amd64 (1.8.11-5ubuntu7) ...
Selecting previously unselected package libmatio2:amd64.
Preparing to unpack .../libmatio2_1.5.2-1ubuntu1_amd64.deb ...
Unpacking libmatio2:amd64 (1.5.2-1ubuntu1) ...
Setting up libhdf5-7:amd64 (1.8.11-5ubuntu7) ...
Setting up libmatio2:amd64 (1.5.2-1ubuntu1) ...
Processing triggers for libc-bin (2.19-0ubuntu6) ...
and then :
~$ sudo luarocks install matio
Installing https://raw.githubusercontent.com/torch/rocks/master/matio-scm-1.rockspec...
Using https://raw.githubusercontent.com/torch/rocks/master/matio-scm-1.rockspec... switching to 'build' mode
Cloning into 'matio-ffi.torch'...
remote: Counting objects: 14, done.
remote: Compressing objects: 100% (13/13), done.
remote: Total 14 (delta 0), reused 11 (delta 0)
Receiving objects: 100% (14/14), 7.41 KiB | 0 bytes/s, done.
Checking connectivity... done.
Warning: Directory 'doc' not found 
Updating manifest for /usr/local/lib/luarocks/rocks
matio scm-1 is now built and installed in /usr/local/ (license: BSD)
 
but in th, I use matio = require 'matio', it shows:
/usr/local/share/lua/5.1/matio/ffi.lua:5: libmatio.so: cannot open shared object file: No such file or directory
stack traceback:
[C]: in function 'load'
/usr/local/share/lua/5.1/matio/ffi.lua:5: in main chunk
[C]: in function 'require'
/usr/local/share/lua/5.1/matio/init.lua:3: in main chunk
[C]: in function 'require'
[string "local matio = require 'matio'..."]:1: in main chunk
[C]: in function 'xpcall'
/usr/local/share/lua/5.1/trepl/init.lua:588: in function </usr/local/share/lua/5.1/trepl/init.lua:489>
                                                                      [0.0011s]



On Tuesday, August 26, 2014 12:31:06 PM UTC-4, smth chntla wrote:
did you install libmatio before-hand? sudo apt-get install libmatio2

Sourabh Kulhare

unread,
Jul 1, 2015, 3:27:56 PM7/1/15
to tor...@googlegroups.com
Hey there,
I am having the same problem, has anyone solved the problem???

Julie Dequaire

unread,
Nov 24, 2015, 5:55:15 AM11/24/15
to torch7
I am getting the same linker errors - have you found a solution to this ?
Thanks
Julie
Reply all
Reply to author
Forward
0 new messages