[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: MEX compilation problem---error: `xyz' undefined
From: |
David Bateman |
Subject: |
Re: MEX compilation problem---error: `xyz' undefined |
Date: |
Fri, 30 Mar 2007 10:23:33 +0200 |
User-agent: |
Thunderbird 1.5.0.7 (X11/20060921) |
Steve C. Thompson wrote:
> Dear Group,
>
> First, thanks for your help with
> http://www.cae.wisc.edu/pipermail/help-octave/2007-March/003476.html
>
> I now have 2.9.10 installed on my Ubuntu system.
>
> With David Bateman's help
> (http://www.cae.wisc.edu/pipermail/help-octave/2007-March/003475.html),
> I've compiled the MEX files from
> http://www.iterativesolutions.com/Matlab.htm . After running
>
> mkoctfile-2.9.10 -o Capacity.oct --mex Capacity.c
>
> and seeing Capacity.oct on the other end, with no apparent
> errors, a almost teared up.
>
> Unfortunately, the jubilation has transitioned to frustration, as
> is often the case.
>
> This is probably trivial (hopefully): issuing
>
> a = CreateUmtsInterleaver (100)
>
> I get
>
> error: `CreateUmtsInterleaver' undefined near line 1 column 5
>
> `CreateUmtsInterleaver' is a oct-file generated, like Capacity
> above, with:
>
> mkoctfile-2.9.10 -o CreateUmtsInterleaver.oct --mex
> CreateUmtsInterleaver.c
>
> (I've commented out `matrix.h' in CreateUmtsInterleaver.c .)
> Running that command seems to work fine, no errors or warnings
> stated. I fire up Octave in the directory where mkoctfile-2.9.10
> was ran, where the oct-file is, and:
>
> octave-2.9.10:1> CreateUmtsInterleaver (100)
> error: `CreateUmtsInterleaver' undefined near line 1 column 1
>
> I've tried chmod, 755 and 777. Since the oct-file is in the
> working directory, I wouldn't think the path is an issue. I use
> addpath anyways, to no avail.
>
> Either:
>
> 1) I'm missing something trivial (hopefully), or
> 2) something is wrong with my compilation process of the MEX
> file.
>
> Please note, I've read through
> http://www.nabble.com/Help-on-error:-can't-perform-indexing-t3227971.html
> , and don't think that has anything to do with my problem. In
> case 2) is at issue, I've pasted CreateUmtsInterleaver.c below.
> Also note, I'm getting this same problem with the oct-files I
> compiled!
>
Yeah, there is a bug in cml 1.6.3 is source/include/interleaver.h and I
have no idea how this compiled with Matlab either. I suspect probably no
one even tried as cml 1.6.3 supplies the windows versions of the mex
files pre built.. I attach a patch that fixes cml 1.6.3 and together
with the script
<quote>
#! /bin/sh -f
files=`find . -name "*.c"`
for _file in $files; do
_newfile=`echo ${_file} | sed -e "s/\.c$/_new.c/"`
_outfile=`echo ${_file} | sed -e "s/\.c$/.oct/"`
echo "Build $_file"
cat $_file | sed -e 's/#include <matrix.h>//' > $_newfile
mkoctfile -o $_outfile --mex $_newfile
rm $_newfile
done
rm *.o
</quote>
Allows compilation of all of the mex code under Octave 2.9.10.. Running
your example under octave 2.9.10 then gives
octave:1> a = CreateUmtsInterleaver (100)
r[0] = 17
r[1] = 13
r[2] = 11
r[3] = 7
r[4] = 1
a =
Columns 1 through 16:
99 61 41 21 1 82 74 55 23 10 84 66 56
29 5 88
Columns 17 through 32:
68 52 28 12 96 77 49 25 6 93 70 42 35 3
87 67
<snip>
It seems there is some spurious output as the "r[0]" values are printed
independent of the presence of absence of a ";". I've cc'ed this to the
cml maintainer, and hopefully the fix might be included in version 1.6.4 :-)
Cheers
David
--
David Bateman address@hidden
Motorola Labs - Paris +33 1 69 35 48 04 (Ph)
Parc Les Algorithmes, Commune de St Aubin +33 6 72 01 06 33 (Mob)
91193 Gif-Sur-Yvette FRANCE +33 1 69 35 77 01 (Fax)
The information contained in this communication has been classified as:
[x] General Business Information
[ ] Motorola Internal Use Only
[ ] Motorola Confidential Proprietary
--- source/include/interleaver.h~ 2007-01-28 20:27:50.000000000 +0100
+++ source/include/interleaver.h 2007-03-30 10:14:44.451458946 +0200
@@ -285,7 +285,7 @@
IntraMatrix[(RR-1)+RR*pValue]=itemp;
}
} else {
- for (j=0;j<=pValue-2;j++) {*/
+ for (j=0;j<=pValue-2;j++) {
index = s[ (j*r[i])%(pValue-1) ] - 1;
IntraMatrix[ i+j*RR ] = Matrix[ i+index*RR ];
}
@@ -332,4 +332,4 @@
free( r );
}
-
\ No newline at end of file
+