From: Ben Abbott on
Nicholas Kinar <n.kinar(a)usask.ca> wrote in message <4BBFD892.7070106(a)usask.ca>...
>
> So how do I reconcile these two versions? Should I link with the GMP
> library in /Applications/MATLAB_R2010aSV.app/bin/maci/libgmp.dylib, or
> should I download, build and install GMP 3.4.1 in my own /usr/local/lib?
>

I avoid placing non-standard libraries in my /usr/lib/ so I don't have any experience with this particular problem.

However, I recommend you drop all the other modifications to the mex process you added except for adding "-m32" to CFLAGS, CPPFLAGS, CXXFLAGS, and LDFLAGS. (i.e. no "-arch i386" an d no "-I/usr/local/include").

Ben
From: Nicholas Kinar on

>>
>> So how do I reconcile these two versions? Should I link with the GMP
>> library in /Applications/MATLAB_R2010aSV.app/bin/maci/libgmp.dylib, or
>> should I download, build and install GMP 3.4.1 in my own /usr/local/lib?
>>
>
> I avoid placing non-standard libraries in my /usr/lib/ so I don't have
> any experience with this particular problem.
>
> However, I recommend you drop all the other modifications to the mex
> process you added except for adding "-m32" to CFLAGS, CPPFLAGS,
> CXXFLAGS, and LDFLAGS. (i.e. no "-arch i386" an d no
> "-I/usr/local/include").
>
> Ben

Thanks again, Ben. This makes plenty of sense.

So perhaps a way to proceed would be one of the following?

(1) Download and build GMP 3.4.1 and MPFR 1.1.2. (These are the
versions of the libraries which are used in Matlab.) Install the
libraries into a directory other than /usr/lib. As you suggest, when
running ./configure for GMP and MPFR, add "-m32" to CFLAGS, CPPFLAGS,
CXXFLAGS, and LDFLAGS. When invoking MEX, link with the GMP 3.4.1 and
MPFR 1.1.2 libraries that I have downloaded, built and installed.

OR

(2) Somehow statically link the newer version libraries with my MEX
code. Is there a way to statically link the libraries using MEX? Or do
I have to use the shared GMP 3.4.1 and MPFR 1.1.2 libraries currently
shipping with Matlab?

OR

(3) If I use the shared library files shipping with Matlab, how do I let
MEX know the location of the header files?
From: Ben Abbott on
Nicholas Kinar <n.kinar(a)usask.ca> wrote in message

> (3) If I use the shared library files shipping with Matlab, how do I let
> MEX know the location of the header files?

I recommend you link to the Matlab versions. Do you see the include file you need in ...

/Applications/MATLAB_R2010aSV.app/extern/include

If not, what it the name of the include file you need?

Ben
From: Nicholas Kinar on
>> (3) If I use the shared library files shipping with Matlab, how do I
>> let MEX know the location of the header files?
>
> I recommend you link to the Matlab versions. Do you see the include file
> you need in ...
>
> /Applications/MATLAB_R2010aSV.app/extern/include
>
> If not, what it the name of the include file you need?
>
> Ben

Thanks again, Ben.

I would need to include the header files "mpfr.h" and "gmp.h" to be able
to link to these libraries.

Yikes, apparently I would need to include mpfr.h and gmp.h, and I don't
see these two files in the
/Applications/MATLAB_R2010aSV.app/extern/include directory. Where might
I find or download these files?

Here is a list of the files in that particular directory:

/Applications/MATLAB_R2010aSV.app/extern/include/blas.h
/Applications/MATLAB_R2010aSV.app/extern/include/blascompat32.h
/Applications/MATLAB_R2010aSV.app/extern/include/emlrt.h
/Applications/MATLAB_R2010aSV.app/extern/include/engine.h
/Applications/MATLAB_R2010aSV.app/extern/include/fintrf.h
/Applications/MATLAB_R2010aSV.app/extern/include/io64.h
/Applications/MATLAB_R2010aSV.app/extern/include/lapack.h
/Applications/MATLAB_R2010aSV.app/extern/include/mat.h
/Applications/MATLAB_R2010aSV.app/extern/include/matrix.h
/Applications/MATLAB_R2010aSV.app/extern/include/mex.h
/Applications/MATLAB_R2010aSV.app/extern/include/mwdebug.h
/Applications/MATLAB_R2010aSV.app/extern/include/mwutil.h
/Applications/MATLAB_R2010aSV.app/extern/include/tmwtypes.h

Attempting to link to the libraries in the /bin/maci Matlab directory
using the more recent header files in /usr/local/include leads to the
following error:

>> mex -I/usr/local/include T_Zeta.cpp mpreal.cpp
/Applications/MATLAB_R2010aSV.app/bin/maci/libmpfr.dylib
/Applications/MATLAB_R2010aSV.app/bin/maci/libgmp.dylib

Undefined symbols:
"_mpfr_mul_d", referenced from:
bei(mpfr::mpreal, int) in T_Zeta.o
ber(mpfr::mpreal, int) in T_Zeta.o
"_mpfr_div_d", referenced from:
integrate_aux(mpfr::mpreal (*)(mpfr::mpreal, int, mpfr::mpreal),
mpfr::mpreal, int, mpfr::mpreal, mpfr::mpreal, mpfr::mpreal,
mpfr::mpreal, mpfr::mpreal, mpfr::mpreal, mpfr::mpreal, int)in T_Zeta.o
integrate_aux(mpfr::mpreal (*)(mpfr::mpreal, int, mpfr::mpreal),
mpfr::mpreal, int, mpfr::mpreal, mpfr::mpreal, mpfr::mpreal,
mpfr::mpreal, mpfr::mpreal, mpfr::mpreal, mpfr::mpreal, int)in T_Zeta.o
integrate_aux(mpfr::mpreal (*)(mpfr::mpreal, int, mpfr::mpreal),
mpfr::mpreal, int, mpfr::mpreal, mpfr::mpreal, mpfr::mpreal,
mpfr::mpreal, mpfr::mpreal, mpfr::mpreal, mpfr::mpreal, int)in T_Zeta.o
integrate(mpfr::mpreal (*)(mpfr::mpreal, int, mpfr::mpreal),
mpfr::mpreal, int, mpfr::mpreal, mpfr::mpreal, mpfr::mpreal, int)in T_Zeta.o
integrate(mpfr::mpreal (*)(mpfr::mpreal, int, mpfr::mpreal),
mpfr::mpreal, int, mpfr::mpreal, mpfr::mpreal, mpfr::mpreal, int)in T_Zeta.o
ld: symbol(s) not found
collect2: ld returned 1 exit status


I am guessing that the older version of the library shipping with Matlab
may not have these symbols.
From: Ben Abbott on
Nicholas Kinar <n.kinar(a)usask.ca> wrote in message <4BBFF873.2030707(a)usask.ca>...
>
> I would need to include the header files "mpfr.h" and "gmp.h" to be able
> to link to these libraries.
>
> Yikes, apparently I would need to include mpfr.h and gmp.h, and I don't
> see these two files in the

Ok. Then I'd try to locate the include files you need and place them where you can link to them. If you try to link to a dylib other than the ones with Matlab, I expect you'll continue to have problems.

BTW, my understanding is that Matlab uses the MKL version of gmp. So you may still have some problem.
First  |  Prev  |  Next  |  Last
Pages: 1 2 3 4
Prev: please help me with the math
Next: Unusual GUNZIP.m error