libtool
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Problem porting linux shared library to windows using cygwin and lib


From: Sander Niemeijer
Subject: Re: Problem porting linux shared library to windows using cygwin and libtool
Date: Tue, 16 Dec 2003 10:05:29 +0100

Hi Thomas,

For our project we also need to build matlab mex interfaces and we are currently also using the mex script provided by matlab (instead of libtool) to build the interfaces. If you have a lot of functions you might want to consider combining several functions into one mex-file and provide a set of .m files as wrappers. If you want to see an example of how we tackled this problem, you could have a look at our open source BEAT toolbox (downloadable from http://www.science-and-technology.nl/beat; pick the 2.0.0rc1 version).

Best regards,
Sander Niemeijer


On maandag, dec 15, 2003, at 22:25 Europe/Amsterdam, Thomas Leitner wrote:

if you wish to create Matlab MEX-Files using the GNU build
environment, check out

http://home.allgaeu.org/rschleic/rs/pub/mextool/mextool-2.0.tar.gz


The problem with that is that I have a varying number of C++ files which should be compiled as MEX-files. Currently, I let configure search the src directory and generate a list of all CPP files. This list is then compiled via a Makefile. To complicate the matter I need to compile these files not one time, but several times and link them against different libraries. If I used libtool support for this I would have to add for each CPP file to compile as MEX file lines similar to these (taken from your m-regex Makefile.am):

noinst_LTLIBRARIES = libreg.l
libreg_la_SOURCES = m-regex.h m-regex.c
libreg_la_CFLAGS = -DMATLAB_MEX_FILE -I$(MATLAB)/extern/include
libreg_la_LDFLAGS = -no-undefined
libreg_la_LIBADD = $(LTLIBOBJS)

Therefore I will stick to my current approach.

and

http://home.allgaeu.org/rschleic/rs/pub/m-config/m-config-4.0.tar.gz


I had a look at your m-config tools. I currently use the following script to determine the mex-extension:

-----------
echo "mexFunction() {}" > ac_mexext.c
$MEX ac_mexext.c -output ac_mexext_out 2>&1
gamatlab_cv_mex_extension=`find ac_mexext_out* | sed -e "s/.*\.\(.*\)/\1/"`
rm -f ac_mexext.c ac_mexext_out.${gamatlab_cv_mex_extension}
if test -z  "$gamatlab_cv_mex_extension"; then
  AC_MSG_ERROR([the extension of the mex files could not be detected])
fi
-----------

I noticed that this is a bit shorter than your code and its tested under Linux and Cygwin/Windows.

For getting the Matlab root directory I use the following script:

-----------
$MEX -v > test.mex 2>&1
MATLABDIR=`sed -n "s/.*MATLAB.*=\(.*\)/\1/p" test.mex`
rm -f test.mex
-----------

This works under Linux and Windows.

P.S. The code is not tested with Matlab 6.5, I've only access
to 6.1, and 5.x.  Any feedback would be appreciated.

I have tried to compile m-regex under Linux and Windows using Matlab 6.5r13. Under Linux I had the problem that I had a script called matlab in my path which confused your scripts finding the correct matlab root directory. After setting the Matlab root directory on the command line with the switch '--with-matlab' everything worked fine.

The problem was the same under Windows, but using the former mentioned switch everything worked fine.


However that does not solve my problem. I can compile mex files with my current approach under Windows (maybe I change this later and use your m-config and mextools package, but currently that is not possible). The problem is that I need to compile a library, not a mex file, that gets linked against the matlab import libraries. This works when compiled as static library but not when compiled as shared library.

To show why I would like to have a shared library: Under Windows the current files sum up to 45MB without stripping, 20MB with stripping. Under Linux with a shared library they are only 3.5MB without stripping, 2.6 with stripping.


Thomas Leitner


_______________________________________________
Libtool mailing list
address@hidden
http://mail.gnu.org/mailman/listinfo/libtool






reply via email to

[Prev in Thread] Current Thread [Next in Thread]