Home My Page Projects MPTK: The Matching Pursuit ToolKit
Summary Activity Forums Tracker Lists Docs News SCM Files

Forum: help

Monitor Forum | Start New Thread Start New Thread
RE: Mex compiler [ Reply ]
By: chris layman on 2008-09-03 00:22
[forum:98394]
Hi Remi, Boris et al

just wanted to close this thread. I do believe I have everything working at the moment. Thanks for all your help, hopefully ..finally.. I can start doing some actual DSP'ng with MP.

-chris

RE: Mex compiler [ Reply ]
By: chris layman on 2008-08-20 00:45
[forum:98336]
Hey

So I did have everything working in Matlab, for a moment. Unfortunately, I some other problems and had to re-install (archive and install) OS X, now having problems getting back to where i was.

when I run make i am getting:

/usr/bin/libtool: object: /Applications/MATLAB_R2008a/bin/maci/libmex.dylib malformed object (unknown load command 16)
/usr/bin/libtool: object: /Applications/MATLAB_R2008a/bin/maci/libmx.dylib malformed object (unknown load command 16)
/usr/bin/libtool: object: /Applications/MATLAB_R2008a/bin/maci/libeng.dylib malformed object (unknown load command 13)
/usr/bin/libtool: object: /Applications/MATLAB_R2008a/bin/maci/libmex.dylib malformed object (unknown load command 16)
make[2]: *** [lib/libmptk4matlab.dylib] Error 1
make[1]: *** [src/matlab/CMakeFiles/mptk4matlab.dir/all] Error 2
make: *** [all] Error 2




it WAS running before, so i know my matlab is ok. argh!


-chris

RE: Mex compiler [ Reply ]
By: chris layman on 2008-08-18 03:02
[forum:98312]
Hi Guys,

So i can run successfully the SettingStarted script in matlab. Does that mean that MAT2MPTK is installed properly (I don't need to run InstallMat2MPTK)?

Nevertheless, the Mat2MPTKdemo still produces:
>> Mat2MPTKdemo
/bin/bash: line 1: setenv: command not found
/bin/bash: line 1: /Users/clayman/mpbuild/bin/: is a directory
mptk ERROR -- MP_Book_c::load(fName) - Could not open file tempbook.bin to scan for a book.
Failed to load atoms from file [tempbook.bin].
??? Error using ==> bookread
Aborting

Error in ==> mpd at 35
varargout{1} = bookread('tempbook.bin');

Error in ==> Mat2MPTKdemo at 2
[B, res, dec]=mpd(y, Fs, 'n', 1000, 'R', 100);%will run mpd with the 'default.xml' dictionary file.




thanks

-chris

RE: Mex compiler [ Reply ]
By: chris layman on 2008-08-16 00:34
[forum:98311]
Remi

here is the results of printenv

kriti:~ clayman$ printenv
MANPATH=/sw/share/man:/usr/share/man:/usr/local/share/man:/usr/local/teTeX/man:/usr/X11R6/man:/sw/lib/perl5/5.8.6/man
TERM_PROGRAM=Apple_Terminal
TERM=xterm-color
SHELL=/bin/bash
PERL5LIB=/sw/lib/perl5:/sw/lib/perl5/darwin
TERM_PROGRAM_VERSION=133-1
USER=clayman
__CF_USER_TEXT_ENCODING=0x1F5:0:0
PATH=/sw/bin:/sw/sbin:/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/teTeX/bin/i386-apple-darwin-current:/usr/X11R6/bin
PWD=/Users/clayman
SHLVL=1
HOME=/Users/clayman
LOGNAME=clayman
INFOPATH=/sw/share/info:/sw/info:/usr/share/info
_GOOGLE_GILD_RUNTIME_FRAMEWORK_ABSOLUTE_PATH_=/Library/Google/Frameworks/Gild.framework
SECURITYSESSIONID=9afb70
_=/usr/bin/printenv


-chris

RE: Mex compiler [ Reply ]
By: Rémi Gribonval on 2008-08-15 21:59
[forum:98309]
Dear Chris,

Don't worry about the reported 81%, we have just understood what it means and does not indicate relevant problems. It will be corrected in the next release, as well as some other bugs which, once corrected, will hopefully replace the crash

terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_S_construct NULL not valid
Abort trap

with a more graceful informative message.

Your reporting of the different behaviour in different directories gives us much indications of further fixes to the install procedure that we have to integrate before the next release.
So it may take a few more days within next week before we can provide with a tentative solution.

Meanwhile, you should ideally refresh your mptk installation by
1) removing all MPTK shared libraries
/usr/local/lib/libmptk.dylib
/usr/local/lib/libmptk4matlab.dylib
/usr/local/lib/GABOR_ATOM.dylib
/usr/local/lib/GABOR_BLOCK.dylib
/usr/local/lib/CONSTANT_ATOM.dylib
/usr/local/lib/CONSTANT_BLOCK.dylib
/usr/local/lib/DIRAC_ATOM.dylib
/usr/local/lib/DIRAC_BLOCK.dylib
/usr/local/lib/NYQUIST_ATOM.dylib
/usr/local/lib/NYQUIST_BLOCK.dylib
/usr/local/lib/ANYWAVE_ATOM.dylib
/usr/local/lib/ANYWAVE_BLOCK.dylib
/usr/local/lib/MCLT_ATOM.dylib
/usr/local/lib/MCLT_BLOCK.dylib
/usr/local/lib/MDCT_ATOM.dylib
/usr/local/lib/MDCT_BLOCK.dylib
/usr/local/lib/MDST_ATOM.dylib
/usr/local/lib/MDST_BLOCK.dylib
/usr/local/lib/libtinyxml.a
/usr/local/lib/libdsp_windows.a

2) removing all MPTK binaries
/usr/local/bin/mpd
/usr/local/bin/mpd_demix
/usr/local/bin/mpr
/usr/local/bin/mpf
/usr/local/bin/mpcat
/usr/local/bin/mpview
/usr/local/bin/readme.txt

3) remove reference files and matlab files
/usr/local/bin/reference
/usr/local/matlab
/usr/local/bin/path.xml

4) remove the current source and build folder for MPTK.

This way, when you download and install the next release you should have a clean install which will be easier to debug, if needed.

To provide you with the right steps to follow, I would need the result of the 'printenv' command, typed right after opening a new terminal, to know what are your default environment variables, your shell, etc. This will help us determine how you can set the MPTK_CONFIG_FILENAME variable once for all, without having to type it each time you open a new terminal.

Best regards,

Remi.

RE: Mex compiler [ Reply ]
By: chris layman on 2008-08-15 21:06
[forum:98308]
ok..some progress.

If I can, let me go over again my installation procedure, to make sure all my steps are correct.

so from within /Users/clayman/mpbuild i run;

sudo ccmake /Users/clayman/Desktop/MPTK-Source-0.5.6
sudo make
sudo make install

the print outs for these are:
http://www.uvm.edu/~clayman/mp/ccmake.png
http://www.uvm.edu/~clayman/mp/make.txt
http://www.uvm.edu/~clayman/mp/make_install.txt

one question, if you look at the bottom of the print out for make, it has stopped at 81%, can that be right?

now for the env variables, every time I open a new terminal window I have to export those values for some reason, the echo will be empty otherwise.

so I
export LD_LIBRARY_PATH="/Users/clayman/mpbuild/lib"
export MPTK_CONFIG_FILENAME="/Users/clayman/mpbuild/bin/path.xml"

so after doing this, if i run the test (from within /Users/clayman/mpbuild)

mpd -D /Users/clayman/mpbuild/bin/reference/dictionary/dic_gabor_two_scales.xml -n 10 -R 5 -v /Users/clayman/mpbuild/bin/reference/signal/glockenspiel.wav test.bin


I get that error:
terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_S_construct NULL not valid
Abort trap

but if i run the test from /Users/clayman/mpbuild/lib, I get this
http://www.uvm.edu/~clayman/mp/lib_test.txt
much better, just one small error with opening the book.

now, if i change the variable (still in lib folder):

export MPTK_CONFIG_FILENAME="/usr/local/bin/path.xml"

then i get that weird error again, but if i run it from my home directory /Users/clayman

i get:
http://www.uvm.edu/~clayman/mp/lib_usr.txt

it seems to make a difference on where i am executing the test. Is that right?


thanks!
-chris





RE: Mex compiler [ Reply ]
By: Rémi Gribonval on 2008-08-15 08:06
[forum:98307]
Hi Chris,

I was able to reproduce this crash. It seems to be caused by MPTK_CONFIG_FILENAME pointing to a bad path.xml file.

We need to investigate this further but in the meantime could you send the result of the following commands
cd /Users/clayman/mpbuild
which mpd
printenv MPTK_CONFIG_FILENAME

Since you performed a make install and you can run mpd I believe the value of MPTK_CONFIG_FILENAME should be
/usr/local/bin/path.xml
and not
/User/clayman/mpbuild/bin/path.xml
Please let me know if changing this setting solves your problem.

Best regards,

Remi.

RE: Mex compiler [ Reply ]
By: chris layman on 2008-08-14 21:19
[forum:98306]
I re-installed using cmake (not ccmake) and then it works, at the command line, not matlab.

The i use ccmake and i the only things i turn on are :
BUILD_EXECUTABLE
BUILD_MATLAB_MEX_FILES
BUILD_SHARED_LIBS
BUILD_VERBOSE


then make and make install, set path variables and
i am getting

kriti:~ clayman$ mpd -D /Users/clayman/mpbuild/bin/reference/dictionary/dic_gabor_two_scales.xml -n 100 -R 50 -v /Users/clayman/mpbuild/bin/reference/signal/glockenspiel.wav test.bin


terminate called after throwing an instance of 'std::logic_error'
what(): basic_string::_S_construct NULL not valid
Abort trap


lol, this is a nightmare.
thanks

-chris

RE: Mex compiler [ Reply ]
By: chris layman on 2008-08-14 20:47
[forum:98305]
Hi Boris,

Ok, so i installed a new version of matlab. then after running

ccmake
make
make install

i don't see any errors (some warnings but no errors). but it's not working at the command line, because i think my environment variables are not set right.


here's what i am getting when i run,


kriti:~ clayman$ mpd -D /Users/clayman/mpbuild/bin/reference/dictionary/dic_gabor_two_scales.xml -n 100 -R 50 -v /Users/clayman/mpbuild/bin/reference/signal/glockenspiel.wav test.bin


---




mptk ERROR -- MPTK_Env_c::get_configuration_file() - Could not find MPTK Env variable with path to config file.
mptk ERROR -- MPTK_Env_c::load_environment() - couldn't load the MPTK environment




when i echo $LD_LIBRARY_PATH and $MPTK_CONFIG_FILENAME they are empty.

so, from within /Users/clayman/mpbuild

i should run (?)

export LD_LIBRARY_PATH="/Users/clayman/mpbuild/lib"

and

export MPTK_CONFIG_FILENAME="/Users/clayman/mpbuild/bin/path.xml"


thanks

-chris



RE: Mex compiler [ Reply ]
By: Boris Mailhe on 2008-08-13 20:31
[forum:98304]
This library is not part of the MPTK distribution, but it should come with Matlab.

You should check your Matlab installation. This might be useful to you:
http://www.mathworks.com/access/helpdesk/help/techdoc/matlab_external/f39903.html#f39610

Regards,

Boris

RE: Mex compiler [ Reply ]
By: chris layman on 2008-08-13 19:50
[forum:98303]
Hi Boris

I turned off the BUILD_DEBUG, but am still getting this error after running 'make'

make[2]: *** No rule to make target `/Applications/mtlb/maci/libeng.dylib', needed by `lib/libmptk4matlab.dylib'. Stop.
make[1]: *** [src/matlab/CMakeFiles/mptk4matlab.dir/all] Error 2
make: *** [all] Error 2


thanks again
-chris

RE: Mex compiler [ Reply ]
By: Boris Mailhe on 2008-08-13 09:56
[forum:98301]
Hi Chris,

This is a known bug with the debug message functions. It has been corrected but the patch has not been included to the release yet. For now, the build in debug mode will not work. In ccmake, just leave the BUILD_DEBUG to OFF.

Regards,

Boris

RE: Mex compiler [ Reply ]
By: chris layman on 2008-08-12 21:39
[forum:98299]
Boris / Remi,

ok, so after running 'sudo make', (i need sudo otherwise it doesn't work), i am getting errors (down at the bottom of the page):

http://www.uvm.edu/~clayman/mp/make_2.txt

-chris

RE: Mex compiler [ Reply ]
By: Boris Mailhe on 2008-08-12 09:09
[forum:98291]
Dear Chris,

OK, there are two things that maybe going wrong.

First, ccmake should be performed *before* make because make compiles according to the build options enabled/disabled through ccmake.

Second, you are compiling everything within /usr/local/mp which is within the default install directory /usr/local. It might be better to build in a different directory such as /Users/clayman/mpbuild. I will assume it is the case in the following instructions

1) untar MPTK on desktop, create folder 'mpbuild' in /Users/clayman
2) open a terminal and cd to /Users/clayman/mpbuild
3) ccmake /Users/clayman/Desktop/MPTK-Source-0.5.6
[I think sudo is not required here]
[sudo is probably not required either]
press [c]
wait while cmake is running
press [e]
[set the cmake variables as in your screen copy, and press [c] then [g]]
5) make

Now you should be able to check that
a) no error is reported during compilation
b) the directory /Users/clayman/mpbuild/src/matlab
contains the compiled MEX files with extension .mexmaci

Apart from that, there seem to be some problems with your environment variable settings.

> export LD_LIBRARY_PATH="/usr/local/mp/lib" <

Be careful when doing this: this variable is commonly used by many applications which might not run properly after you've erased its old content.

You can check if it is empty with the command

echo $LD_LIBRARY_PATH

that will display the variable content. If it is not empty, then what you want to do is

export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/mp/lib

It will append the path to mptk library at the end of the variable


> export MPTK_FFTW_WISDOM=/udd/broy/local/fftw_wisdom_file <

This path is local to IRISA LAN's file system. You need your own wisdom file that will be built when you first run mptk as it depends on your hardware and system settings.

Regards,
Rémi and Boris

RE: Mex compiler [ Reply ]
By: chris layman on 2008-08-11 20:44
[forum:98288]
Remi,

I will try that. But can you just check to see if my installation procedure is correct and in the right order. Here is what i am doing from the very beginning:

untar MPTK on desktop, create folder 'mp' in /usr/local;

i then run from within /usr/local/mp:

sudo cmake /Users/clayman/Desktop/MPTK-Source-0.5.6
sudo make
sudo make install

the print outs for these 3 are here:
http://www.uvm.edu/~clayman/mp/cmake.txt
http://www.uvm.edu/~clayman/mp/make.txt
http://www.uvm.edu/~clayman/mp/make_intsall.txt

then:
export MPTK_CONFIG_FILENAME="/usr/local/mp/bin/path.xml"
export LD_LIBRARY_PATH="/usr/local/mp/lib"
export MPTK_FFTW_WISDOM=/udd/broy/local/fftw_wisdom_file

then:
kriti:/usr/local/mp clayman$ sudo ccmake /Users/clayman/Desktop/MPTK-Source-0.5.6

screen shot here of that.
http://www.uvm.edu/~clayman/mp/ccmake.png

does all this seem ok?
Thanks !!

-chris





RE: Mex compiler [ Reply ]
By: Rémi Gribonval on 2008-08-11 07:13
[forum:98284]
Hi Chris,

When the compilation of MEX files is successful, there is a binary executable MEX-file bookread.mexmaci (.mexmaci is for MacOSX Intel, .mexmaci for MacOS on PPC, and other .mex* for other platforms) in the same directory as the bookread.m file. The .m file is just a header while the .mexmaci file is the executable. If you do not see this file it means that there was a problem compiling the MEX files.

Please check with a computer person in your institution to solve this problem, since it is going to be very long and tedious to solve it through the forum, unless other users have met and solved this problem before.

Best regards,

Remi.

RE: Mex compiler [ Reply ]
By: chris layman on 2008-08-08 23:16
[forum:98283]
hi I just noticed something, I opened up the bookread.m file, it is basically empty, here is its contents:

% MPTK - Matlab interface
% Imports a binary Matching Pursuit book file to Matlab, using MPTK
%
% Usage : book = bookread(filename)
%
% Input :
% filename : the filename where to read the book
%
% Output:
% book : a book structure with the following structure
% TODO : document
%
% Known limitations : only the following atom types are supported:
% gabor, harmonic, mdct, mclt, dirac.
%
% See also : bookwrite, bookedit
%
% Authors:
% Emmanuel Ravelli (LAM, Paris, France)
% Gilles Gonon, Remi Gribonval (IRISA, Rennes, France)
%
% Distributed under the General Public License.
%
%#mex

something not right here, other files like bookwrite.m, dictread.m, dictwrite.m, are the similar, no code in them just some comments.


RE: Mex compiler [ Reply ]
By: chris layman on 2008-08-08 21:56
[forum:98282]
ok very good...im making some progress. That seems to have worked. Now all the files seem to be in place.

So now I launch matlab, and 'run InstallMat2MPTK' then 'Mat2MPTKdemo' but am getting:

>> run InstallMat2MPTK
Enter MPTK Path ['/usr/local/mp/bin/']:
Enter Dictionaries Path ['/Applications/mtlb/Dict/']:
>> Mat2MPTKdemo
/bin/bash: line 1: setenv: command not found
/bin/bash: line 1: /usr/local/mp/bin/: is a directory
??? Attempt to execute SCRIPT bookread as a function:
/usr/local/mp/src/matlab/bookread.m

Error in ==> mpd at 35
varargout{1} = bookread('tempbook.bin');

Error in ==> Mat2MPTKdemo at 2
[B, res, dec]=mpd(y, Fs, 'n', 1000, 'R', 100);%will run mpd with the 'default.xml' dictionary file.



also when i run the 'GettingStarted'


>> GettingStarted
Welcome to MPTK within Matlab
(press enter to continue)
To begin with, we need to configure your system so that MPTK can locate its plugins.
All the necessary information is stored within a file that is typically located
where MPTK was compiled, at
/usr/local/mp/bin/path.xml
Let us now check if we can find this file (press enter to continue) ...
yes :)
Now, we need to set the system environment variable
MPTK_CONFIG_FILENAME
to keep this information
(press enter to continue)
From within Matlab, at any moment, you can simply type the
following command line to set this variable for the duration
of your Matlab session
setenv('MPTK_CONFIG_FILENAME',configFileName)
where configFileName is the desired value of the variable.
(press enter to continue)
Let us do it for the current session:
setenv('MPTK_CONFIG_FILENAME',/usr/local/mp/bin/path.xml)
(press enter to continue)
For further use, it is be more comfortable to set MPTK_CONFIG_FILENAME
at the system level.
You seem to be running a Unix type system (e.g., Linux or MacOSX).
To set an environment variable, some possibilities include:
-with the Bash shell: type e.g.
export MPTK_CONFIG_FILENAME="path_to_MPTK/bin/path.xml"
-with the C-shell: type e.g.
setenv MPTK_CONFIG_FILENAME "path_to_MPTK/bin/path.xml"
For example
setenv MPTK_CONFIG_FILENAME /Users/<your pseudo>/mptk/bin/path.xml
or
setenv MPTK_CONFIG_FILENAME /usr/local/bin/mptk/bin/path.xml
You can check if the environment variable is correctly set with:
echo $MPTK_CONFIG_FILENAME
You can add the line relevant to your shell to the .cshrc / .bashrc
file in your home directory, this will ensure that the variable is set
everytime you start a terminal
To determine which shell you are using, try
sh --version
On Mac OSX, an other solution is to edit ~/.MacOSX/environment.plist
to add a key-value pair MPTK_CONFIG_FILENAME="path_to_MPTK/bin/path.xml"
(press enter to continue)
??? Attempt to execute SCRIPT getmptkinfo as a function:
/usr/local/mp/src/matlab/getmptkinfo.m

Error in ==> GettingStarted at 110
mptkInfo = getmptkinfo;

>>



btw, thanks for all your help!! Hopefully, I will have this thing running soon. Can't wait to crunch some signals with this.

-chris



RE: Mex compiler [ Reply ]
By: Rémi Gribonval on 2008-08-08 10:16
[forum:98280]
Regarding the Qt error message: this is likely due to the fact that you asked the GUI to be compiled. Using CCmake, turn the BUILD_GUI flag to OFF, then configure and generate, it should work. If it does not, just redo the whole cmake + ccmake + make sequence in a brand new directory.

Regarding the Matlab files installed, you needn't compile the experimental MEX files, it is better to switch the BUILD_MATLAB_MEX_FILES_EXPERIMENTAL to OFF.
Moreover, the compiled MEX files (*.mexmaci on OSX) are missing, which probably indicates that compilation of MEX files was unsuccessfull and might be due to an improperly set variables. On my machine the following variables are set as

MATLAB_ENG_LIBRARY /Applications/MATLAB_R2008a/bin/maci/libeng.dylib
MATLAB_INCLUDE_DIR /Applications/MATLAB_R2008a/extern/include
MATLAB_MEX_LIBRARY /Applications/MATLAB_R2008a/bin/maci/libmex.dylib
MATLAB_MX_LIBRARY /Applications/MATLAB_R2008a/bin/maci/libmx.dylib
MEX_COMPILER /Applications/MATLAB_R2008a/bin/mex

Please replace them with the paths adapted to your matlab configuration.

Best regards,

Remi.

RE: Mex compiler [ Reply ]
By: chris layman on 2008-08-07 21:15
[forum:98279]
Hi I did that, and it seems to have worked. But it is giving me this error


CMake was unable to find desired QT version: 4. Set advanced values QT_QMAKE_EXECUTABLE and QT4_QGLOBAL_FILE.

CMake Error: Qt qmake not found!


But when I look in
/usr/local/mp/src/matlab

it doesn't seem to have installed all the matlab files. it only has the following files:

CMakeFiles bookover.m dictcreate_gui.m mpdecomp.m
GettingStarted.m bookplot.m dictread.m mprecons.m
MPtoolbaricons.mat bookread.m dictwrite.m mpview.m
Makefile bookwrite.m for_install_only releaseenv_exp.m
README cmake_install.cmake getmptkinfo.m savetable.m
README_EXP create_synthetic_data.m loadenv_exp.m sigread.m
bookedit.m debugbook_exp.m mextest.m sigwrite.m


is that all there should be?
thanks
-chris



RE: Mex compiler [ Reply ]
By: Rémi Gribonval on 2008-08-07 08:16
[forum:98271]
Hi Chris,

-there is no need to install Qt for the Matlab interface
-I did not need to run mex -setup first before compiling the MEX files on a Mac. Why don't you just try the usual
cmake
ccmake [setting BUILD_MATLAB_MEX_FILES to ON and specifying the path to the Mex compiler and libraries if they are not automatically found]
make

Please let us know if this works

Best regards,

Remi.

RE: Mex compiler [ Reply ]
By: chris layman on 2008-08-06 23:16
[forum:98270]
hey thanks for getting back to me.

so i found the mex file in
/Applications/<MATLAB_R200X>/bin/mex

but im not sure i know what you mean when you say '...use the mex command..'.

the Install file says I need to 'first configure the mex compiler using: mex -setup',

do i have to modify this file somehow?


Another question, is there any reason why I would have to install Qt in order to properly run the MPTK+Matlab Module

again, thanks for all your help.

-chris












RE: Mex compiler [ Reply ]
By: Rémi Gribonval on 2008-08-04 13:28
[forum:98261]
As indicated by the line
> This is pdfeTeX, Version 3.141592-1.30.4-2.2 (Web2C 7.5.5)
the 'mex' command that you are using is part of a LaTeX distribution. Instead, you must use the mex command from your Matlab installation. On MacOS it is typically found at
/Applications/<MATLAB_R200X>/bin/mex
where <MATLAB_R200X> refers to where you installed Matlab.

Cheers,

Remi.

Mex compiler [ Reply ]
By: chris layman on 2008-08-01 02:21
[forum:98248]
Hi...Thanks for all your help...I'm almost there.


I am getting an error here

----------
kriti:~/Desktop/MPTK-Source-0.5.6 clayman$ mex -setup
mex: unrecognized option `-setup'
This is pdfeTeX, Version 3.141592-1.30.4-2.2 (Web2C 7.5.5)
**
--------------


i hit enter and it says
----------
Please type the name of your input file.
----------


not sure what this all means.

thanks, chris