install problem w 32-bit matlab 64-bit *nix OS

This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location where you will have to reset your password.
Forum rules
This forum is closed. You can read the posts but cannot write. We have migrated the forum to a new location (https://forum.dynare.org) where you will have to reset your password.

install problem w 32-bit matlab 64-bit *nix OS

Postby jseabold » Mon Feb 08, 2010 5:23 am

Hello all,

I am new to Matlab and Dynare but am fairly comfortable with other languages and numerical libraries. I have two problems installing Dynare. I am using the student version of matlab v. 7.8. The student version (unfortunately) only comes in 32-bit, and I am running 64-bit *ubuntu 9.10. I have successfully run the following

./configure --with-matlab=~/matlab MATLAB_VER=7.8
make

But when I run

make check

I receive the following error:

<snip>
Starting MATLAB/Octave computing.

error: DYNARE: Can't find bytecode DLL. Please compile it or remove the 'bytecode' option.
error: called from:
error: /home/skipper/downloads/dynare-4.1.0/tests/block_bytecode/fs2000_bytecode.m at line 80, column 3
error: /home/skipper/downloads/dynare-4.1.0/matlab/dynare.m at line 132, column 1
error: run_test_octave.m at line 39, column 1

make[2]: *** [check-octave] Error 1
make[2]: Leaving directory `/home/skipper/downloads/dynare-4.1.0/tests'
make[1]: *** [check-am] Error 2
make[1]: Leaving directory `/home/skipper/downloads/dynare-4.1.0/tests'
make: *** [check-recursive] Error 1

I am on linux, so I wouldn't have any DLLs. Is this a problem with my octave build or dynare? If dynare, what flag should I use to disable bytecode?

Figuring this error might not be such a big deal, I then sudo

make install

I receive the following error:

<snip>
make[2]: Entering directory `/home/skipper/downloads/dynare-4.1.0/mex/build/matlab/mjdgges'
gcc -ansi -fexceptions -fPIC -pthread -g -O2 -fno-omit-frame-pointer -shared -Wl,--version-script,/home/skipper/matlab/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -Wl,-rpath-link,/home/skipper/matlab/bin/glnxa64 -L/home/skipper/matlab/bin/glnxa64 -o mjdgges.mexa64 mjdgges.o -lmx -lmex -lmat -lm -lstdc++ -lmwlapack -lmwblas
/usr/bin/ld: cannot open linker script file /home/skipper/matlab/extern/lib/glnxa64/mexFunction.map: No such file or directory
collect2: ld returned 1 exit status
make[2]: *** [mjdgges.mexa64] Error 1
make[2]: Leaving directory `/home/skipper/downloads/dynare-4.1.0/mex/build/matlab/mjdgges'
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory `/home/skipper/downloads/dynare-4.1.0/mex/build/matlab'
make: *** [install-recursive] Error 1

This directory doesn't exist, because I have the student 32-bit matlab, and the directory is ~/matlab/extern/lib/glnx86/. Possibly unrelated, but I tried to set MEXEXT=mexglx in the configure step, but I also got a complaint there. The matlab installer also had a similar problem with respect to its java runtime environment and I had to create a symbolic link to the glnx86 directory. Might something like that work in this situation?

Thanks for any help,
Skipper
jseabold
 
Posts: 12
Joined: Mon Feb 08, 2010 5:05 am

Re: install problem w 32-bit matlab 64-bit *nix OS

Postby jseabold » Mon Feb 08, 2010 8:48 pm

For the record, I am building from source because I have compiled my own lapack/atlas from source, Octave from source and the packaged binaries also fail probably because of the mismatch between matlab 32-bit and my architecture.

Gotten a little further. I went ahead and created the symbolic link, so I no longer get the directory does not exist error. However, I get a -lmx cannot be found error. This is I think occurring because I'm using 32-bit matlab...

So I deleted the source directory and started over. Unzip the source, run

./configure --with-matlab=/PATH/TO/MATLAB MATLAB_VERSION=7.8 MEXEXT=mexglx

make

Now I get the error
<snip>
gcc -ansi -fexceptions -fPIC -pthread -g -O2 -fno-omit-frame-pointer -shared -Wl,--version-script,/home/skipper/matlab/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -Wl,-rpath-link,/home/skipper/matlab/bin/glnxa64 -L/home/skipper/matlab/bin/glnxa64 -o mjdgges.mexa64 mjdgges.o -lmx -lmex -lmat -lm -lstdc++ -lmwlapack -lmwblas
/usr/bin/ld: cannot find -lmx
collect2: ld returned 1 exit status
make[2]: *** [mjdgges.mexa64] Error 1
make[2]: Leaving directory `/home/skipper/downloads/dynare-4.1.0/mex/build/matlab/mjdgges'
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory `/home/skipper/downloads/dynare-4.1.0/mex/build/matlab'
make: *** [all-recursive] Error 1

How can I tell the configure step that I am using a 32-bit matlab? Do I just need to set compiler and linker flags = m32?

Any help would be appreciated, I'm tearing my hair out.
jseabold
 
Posts: 12
Joined: Mon Feb 08, 2010 5:05 am

Re: install problem w 32-bit matlab 64-bit *nix OS

Postby SébastienVillemot » Mon Feb 15, 2010 4:32 pm

Hi,

Your problem seems complicated, for two reasons: you're using your own Octave build, and your MATLAB 32-bit doesn't match your 64-bit arch.

I suggest the following:
  • configure Dynare without specifying a PATH to matlab, or even with the "--disable-matlab" option. Then "make" and "make check". You should get a fully working version of Dynare for Octave. If that fails, it is a problem with your Octave setup. Note that there is no "make install": you run Dynare from the place where you unpacked the source archive
  • then, compile the MEX files from the MATLAB prompt by running the "build_matlab.m" script under "mex/sources"

Hope this can help

Best
Sébastien Villemot
Economist at OFCE – Sciences Po
SébastienVillemot
 
Posts: 706
Joined: Fri Dec 07, 2007 2:29 pm
Location: Paris, France

Re: install problem w 32-bit matlab 64-bit *nix OS

Postby jseabold » Fri Apr 16, 2010 9:26 pm

I am back, because my preprocessor is failing undoubtedly due to build issues.

SébastienVillemot wrote:Hi,

Your problem seems complicated, for two reasons: you're using your own Octave build, and your MATLAB 32-bit doesn't match your 64-bit arch.

I suggest the following:
  • configure Dynare without specifying a PATH to matlab, or even with the "--disable-matlab" option. Then "make" and "make check". You should get a fully working version of Dynare for Octave. If that fails, it is a problem with your Octave setup. Note that there is no "make install": you run Dynare from the place where you unpacked the source archive


Ok I did this.

./configure
make
make check

Everything seems to be ok, except a test error due to my ATLAS install handled here.

SébastienVillemot wrote:
  • then, compile the MEX files from the MATLAB prompt by running the "build_matlab.m" script under "mex/sources"


  • Ok so I go into mex/sources and after changing my matlab/bin/mexopts.sh to use gcc-4.2 and g++-4.2, I get the following errors

    $ matlab -nodesktop
    > build_matlab

    Delete old mex files.

    Compiling mjdgges...
    -> mexopts.sh sourced from directory (DIR = $MATLAB/bin)
    FILE = /home/skipper/matlab/bin/mexopts.sh
    ----------------------------------------------------------------
    -> MATLAB = /home/skipper/matlab
    -> CC = gcc-4.2
    -> CC flags:
    CFLAGS = -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread
    CDEBUGFLAGS =
    COPTIMFLAGS = -O3
    CLIBS = -Wl,-rpath-link,/home/skipper/matlab/bin/glnxa64 -L/home/skipper/matlab/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++
    arguments = -DMATLAB_MEX_FILE -DMATLAB_VERSION=0x0708 -DMX_COMPAT_32
    -> CXX = g++-4.2
    -> CXX flags:
    CXXFLAGS = -ansi -D_GNU_SOURCE -fPIC -fno-omit-frame-pointer -pthread
    CXXDEBUGFLAGS =
    CXXOPTIMFLAGS = -O3
    CXXLIBS = -Wl,-rpath-link,/home/skipper/matlab/bin/glnxa64 -L/home/skipper/matlab/bin/glnxa64 -lmx -lmex -lmat -lm
    arguments = -DMATLAB_MEX_FILE -DMATLAB_VERSION=0x0708 -DMX_COMPAT_32
    -> FC = g95
    -> FC flags:
    FFLAGS = -fexceptions -fPIC -fno-omit-frame-pointer
    FDEBUGFLAGS = -g
    FOPTIMFLAGS = -O
    FLIBS = -Wl,-rpath-link,/home/skipper/matlab/bin/glnxa64 -L/home/skipper/matlab/bin/glnxa64 -lmx -lmex -lmat -lm
    arguments = -DMATLAB_MEX_FILE -DMATLAB_VERSION=0x0708 -DMX_COMPAT_32
    -> LD = gcc-4.2
    -> Link flags:
    LDFLAGS = -pthread -shared -Wl,--version-script,/home/skipper/matlab/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined
    LDDEBUGFLAGS =
    LDOPTIMFLAGS = -O3
    LDEXTENSION = .mexa64
    arguments = -lmwlapack
    -> LDCXX =
    -> Link flags:
    LDCXXFLAGS =
    LDCXXDEBUGFLAGS =
    LDCXXOPTIMFLAGS =
    LDCXXEXTENSION =
    arguments = -lmwlapack
    ----------------------------------------------------------------

    -> gcc-4.2 -c -I. -I/home/skipper/matlab/extern/include -I/home/skipper/matlab/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread -DMATLAB_MEX_FILE -DMATLAB_VERSION=0x0708 -DMX_COMPAT_32 -O3 "mjdgges/mjdgges.c" -o ../matlab/mjdgges.o

    -> gcc-4.2 -O3 -pthread -shared -Wl,--version-script,/home/skipper/matlab/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -o "../matlab/mjdgges.mexa64" ../matlab/mjdgges.o -lmwlapack -Wl,-rpath-link,/home/skipper/matlab/bin/glnxa64 -L/home/skipper/matlab/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++

    /usr/bin/ld: cannot find -lmwlapack
    collect2: ld returned 1 exit status

    mex: link of ' "../matlab/mjdgges.mexa64"' failed.

    ??? Error using ==> mex at 218
    Unable to complete successfully.

    Error in ==> build_matlab at 94
    eval([ COMPILE_COMMAND ' -I. mjdgges/mjdgges.c ' LAPACK_PATH ]);

    Two things that I notice.

    One, I do not have a matlab/bin/glnxa64 but I am used to this with the 32-bit matlab so I make a symlink there from glnxa64 to glnx86 and it still is the same output.

    Two, I don't have this lmwlapack, lmwblas, but I do have a system-wide liblapack.so can I just use this? If so, how do I point to /usr/lib/liblapack.so etc.

    Thanks!

    Skipper
    jseabold
     
    Posts: 12
    Joined: Mon Feb 08, 2010 5:05 am

    Re: install problem w 32-bit matlab 64-bit *nix OS

    Postby jseabold » Fri Apr 16, 2010 9:40 pm

    Hmm, seems like I recall going through this with other packages before.

    I renamed lmwlapack, etc. to

    llapack, lblas, and ldl and now the output is

    <snip>

    -> gcc-4.2 -c -I. -I/home/skipper/matlab/extern/include -I/home/skipper/matlab/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fexceptions -fPIC -fno-omit-frame-pointer -pthread -DMATLAB_MEX_FILE -DMATLAB_VERSION=0x0708 -DMX_COMPAT_32 -O3 "mjdgges/mjdgges.c" -o ../matlab/mjdgges.o

    -> gcc-4.2 -O3 -pthread -shared -Wl,--version-script,/home/skipper/matlab/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -o "../matlab/mjdgges.mexa64" ../matlab/mjdgges.o -llapack -Wl,-rpath-link,/home/skipper/matlab/bin/glnxa64 -L/home/skipper/matlab/bin/glnxa64 -lmx -lmex -lmat -lm -lstdc++

    /usr/bin/ld: skipping incompatible /home/skipper/matlab/bin/glnxa64/libmx.so when searching for -lmx
    /usr/bin/ld: cannot find -lmx
    collect2: ld returned 1 exit status

    mex: link of ' "../matlab/mjdgges.mexa64"' failed.

    ??? Error using ==> mex at 218
    Unable to complete successfully.

    So basically, it still thinks I have 64 bit matlab even with the symlink set. Anyone know how I can specify my Arch manually? I don't see how to in mexopts.sh or in build_matlab.
    jseabold
     
    Posts: 12
    Joined: Mon Feb 08, 2010 5:05 am

    Re: install problem w 32-bit matlab 64-bit *nix OS

    Postby jseabold » Fri Apr 16, 2010 10:08 pm

    Sorry for all the noise. Now I am just posting for posterity. Ok if you add

    Arch="glnx86" right before the "case" switch in mexopts.sh then it will choose your right 32-bit install for 64-bit os, but now it tries to link against my system lapack, which is of course...64-bit!!

    New error,

    -> gcc-4.2 -c -I. -I/home/skipper/matlab/extern/include -I/home/skipper/matlab/simulink/include -DMATLAB_MEX_FILE -ansi -D_GNU_SOURCE -fPIC -pthread -m32 -fexceptions -D_FILE_OFFSET_BITS=64 -DMATLAB_MEX_FILE -DMATLAB_VERSION=0x0708 -DMX_COMPAT_32 -O3 "mjdgges/mjdgges.c" -o ../matlab/mjdgges.o

    -> gcc-4.2 -O3 -pthread -shared -m32 -Wl,--version-script,/home/skipper/matlab/extern/lib/glnx86/mexFunction.map -Wl,--no-undefined -o "../matlab/mjdgges.mexglx" ../matlab/mjdgges.o -llapack -Wl,-rpath-link,/home/skipper/matlab/bin/glnx86 -L/home/skipper/matlab/bin/glnx86 -lmx -lmex -lmat -lm -lstdc++

    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../liblapack.so when searching for -llapack
    /usr/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-linux-gnu/4.2.4/../../../liblapack.a when searching for -llapack
    /usr/bin/ld: skipping incompatible /usr/lib/liblapack.so when searching for -llapack
    /usr/bin/ld: skipping incompatible /usr/lib/liblapack.a when searching for -llapack
    /usr/bin/ld: cannot find -llapack
    collect2: ld returned 1 exit status

    mex: link of ' "../matlab/mjdgges.mexglx"' failed.

    ??? Error using ==> mex at 218
    Unable to complete successfully.

    Error in ==> build_matlab at 94
    eval([ COMPILE_COMMAND ' -I. mjdgges/mjdgges.c ' LAPACK_PATH ]);

    Am I going to have to build a 32-bit lapack to get this to install for 32-bit matlab or is there any other way to proceed?
    jseabold
     
    Posts: 12
    Joined: Mon Feb 08, 2010 5:05 am

    Re: install problem w 32-bit matlab 64-bit *nix OS

    Postby jseabold » Sat Apr 17, 2010 12:05 am

    Duh. Okay, matlab provides the needed lapack files. So switch this back to lmwlapack etc. Now, you need 32-bit compatible compilers, so sudo apt-get gcc-4.2-multilib I also created symlinks in /usr/lib32/ I'm not sure this step is completely necessary.

    sudo ln -s libstdc++.so.6 libstdc++.so
    sudo ln -s libgcc_s.so.1 libgcc_s.so

    At this point, I received an error about some of the Dynare source saying that the compiled sparse_kroneker wasn't for i386. I thought it was maybe from a previously failed build, so I deleted everything, got the 4.1.1 source. Now I want to build, but it looks like the problem is with Dynare now. I want to keep everything the same, compilers, 32-bit, so I try to do the following, but how do I

    ./configure CC='gcc-4.2' CFLAGS='-m32' CXXFLAGS='-m32' CXX='g++-4.2' FFLAGS='-m32' --with-matlab=/home/skipper/matlab/ MATLAB_VERSION=7.8 mexext=mexglx

    However it still thinks I want to use glnxa64 when I want glnx86. How can I tell Dynare this in the configure step? I am at the end of my capabilities here. After doing the above, I get

    make
    <snip>
    gcc-4.2 -ansi -fexceptions -fPIC -pthread -g -O2 -fno-omit-frame-pointer -shared -Wl,--version-script,/home/skipper/matlab/extern/lib/glnxa64/mexFunction.map -Wl,--no-undefined -Wl,-rpath-link,/home/skipper/matlab/bin/glnxa64 -L/home/skipper/matlab/bin/glnxa64 -o mjdgges.mexa64 mjdgges.o -lmx -lmex -lmat -lm -lstdc++ -lmwlapack -lmwblas
    /usr/bin/ld: skipping incompatible /home/skipper/matlab/bin/glnxa64/libmx.so when searching for -lmx
    /usr/bin/ld: cannot find -lmx
    collect2: ld returned 1 exit status
    make[2]: *** [mjdgges.mexa64] Error 1
    make[2]: Leaving directory `/home/skipper/downloads/dynare-4.1.1/mex/build/matlab/mjdgges'
    make[1]: *** [all-recursive] Error 1
    make[1]: Leaving directory `/home/skipper/downloads/dynare-4.1.1/mex/build/matlab'
    make: *** [all-recursive] Error 1
    jseabold
     
    Posts: 12
    Joined: Mon Feb 08, 2010 5:05 am

    Re: install problem w 32-bit matlab 64-bit *nix OS [Solved]

    Postby jseabold » Sat Apr 17, 2010 10:28 pm

    Whew. I think I got it working after some more fiddling, but I am not sure this is a correct installation, as I'm still seeing pre-processing failures. These are the steps that worked for me to build Dynare with 64 bit linux and a student version 32 bit matlab.

    Make sure you have compatible compilers for matlab. This means gcc <= 4.2. You also need 32-bit compilers so

    sudo apt-get install gcc-4.2 g++-4.2 gcc-4.2-multilib g++-4.2-multilib

    You need to go into $MATLAB/bin and edit your mexpots.sh. Around line 33 before the "case" switch line insert on its line Arch="glnx86";. In the glnx86 section, make sure that CC="gcc-4.2" and CXX="g++-4.2". For some reason the CXXFLAGS did not include "-m32" but all the others did. Add this flag to the CXXFLAGS line. I then made the symlinks mentioned above, but I don't know that this was necessary. I got the dynare-4.1.1 source, untar'd and did

    ./configure --disable-octave --disable-matlab CFLAGS='-m32' CXXFLAGS='-m32' LDFLAGS='-m32'

    I had to disable octave, because my octave build is 64-bit. The rest are flags to the compilers and linkers to make sure everything is 32-bit. Then

    make

    I skipped make check because it tries to use Octave (run_test_octave.m can't find the BYTECODE DLL) and fails. Then I cd'd to ./mex/sources

    matlab -nodesktop
    >>>build_matlab

    I didn't receive any errors, so I guess that's that.
    jseabold
     
    Posts: 12
    Joined: Mon Feb 08, 2010 5:05 am


    Return to Dynare help

    Who is online

    Users browsing this forum: No registered users and 8 guests

    cron