problem with large arrays

2005-07-06 Thread apaz


Could you please tell me how can I work with large arrays in C/Objective-C. My
compiler (gcc) can not handle, for example, the following array
a[15][150][9][197], which is not too big. If I reduce the size to
a[15][150][9][19], for example, it works ok. I had prepared a small example to
show the problem and it's in the attachment. Finally, I have the problem with
both Linux and cygwin.

Thank you very much,

Alex
#include 

int main()
{
  int matrixab[15][150][9][197];

  matrixab[1][1][9][1]=5;

  printf("%i \n", matrixab[1][1][9][1]); 

  return 0;
}


problem with "libobjects" and gcc-4.0.0

2005-07-06 Thread apaz

I'm getting the following message when I try to install "libobjects":

The GCC 'nested functions' feature does not seem to be working on
this machine. 

I'm working under Linux(i686) on an AMD athlon and with gcc-3.4.3. 


Also, I'm having problems installing gcc-4.0.0. I'm getting the following
message after "make":

./config.status: line 910: ./../../config-ml.in: No such file or directory
make: *** [configure-zlib] Error 1


Please let me know what can I do to address these problems,

Thank you very much once again,

Alex


Re: problem with "libobjects" and gcc-4.0.0

2005-07-06 Thread apaz

No really, I'm just trying to compile Objective C code. But when I use -libobjc,
I get:

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

I thought that "libobjc" was included in gcc. So, I found the following link
that says that -libobjc is the Objective C class library . . .

http://www.cs.rochester.edu/u/mccallum/libobjects/

SO, what should I do to compile Objective C code? I have being trying to use
"-lm" and "-libobjc" or "-libobjects".

Thanks a lot,

Alex




Quoting Andrew Pinski <[EMAIL PROTECTED]>:

> 
> On Jul 7, 2005, at 12:13 AM, [EMAIL PROTECTED] wrote:
> 
> > I'm getting the following message when I try to install "libobjects":
> 
> Is there a reason why you are trying to install libobjects when it was
> renamed to be "GNUstep Base Library" and therefore is now maintained
> part of the GNUstep project?
> 
> Thanks,
> Andrew Pinski
> a libobjc maintainer
> 
> 





Re: problem with "libobjects" and gcc-4.0.0

2005-07-06 Thread apaz
Quoting Andrew Pinski <[EMAIL PROTECTED]>:

> 
> On Jul 7, 2005, at 12:57 AM, [EMAIL PROTECTED] wrote:
> 
> >
> > No really, I'm just trying to compile Objective C code. But when I use 
> > -libobjc,
> > I get:
> >
> > /usr/bin/ld: cannot find -libobjc
> > collect2: ld returned 1 exit status
> >
> > I thought that "libobjc" was included in gcc. So, I found the 
> > following link
> > that says that -libobjc is the Objective C class library . . .
> >
> > http://www.cs.rochester.edu/u/mccallum/libobjects/
> >
> > SO, what should I do to compile Objective C code? I have being trying 
> > to use
> > "-lm" and "-libobjc" or "-libobjects".
> 
> -lobjc
> 
> 
> -- Pinski
> 
> 


Thanks, but then I get:

[EMAIL PROTECTED] read_input]# gcc main.m read_input.m -lobjc -lm
/usr/bin/ld: warning: type and size of dynamic symbol `__objc_class_name_Object'
are not defined
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libobjc.so: undefined
reference to `xmalloc'
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libobjc.so: undefined
reference to `xfree'
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libobjc.so: undefined
reference to `xmalloc_atomic'
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libobjc.so: undefined
reference to `xcalloc'
/usr/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libobjc.so: undefined
reference to `xrealloc'
collect2: ld returned 1 exit status

Alex



Re: problem with "libobjects" and gcc-4.0.0

2005-07-07 Thread apaz
Quoting Andrew Pinski <[EMAIL PROTECTED]>:

> 
> On Jul 7, 2005, at 1:04 AM, [EMAIL PROTECTED] wrote:
> 
> > [EMAIL PROTECTED] read_input]# gcc main.m read_input.m -lobjc -lm
> > /usr/bin/ld: warning: type and size of dynamic symbol 
> > `__objc_class_name_Object'
> > are not defined
> > /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libobjc.so: 
> > undefined
> > reference to `xmalloc'
> > /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libobjc.so: 
> > undefined
> > reference to `xfree'
> > /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libobjc.so: 
> > undefined
> > reference to `xmalloc_atomic'
> > /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libobjc.so: 
> > undefined
> > reference to `xcalloc'
> > /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libobjc.so: 
> > undefined
> > reference to `xrealloc'
> > collect2: ld returned 1 exit status
> 
> Huh? xmalloc is not in libobjc in any version of GCC I could find.
> This looks like a bug in your installation of GCC.
> 
> -- Pinski
> 
> 


Well, now I'm trying to install gcc-4.0.0 but after following the instalation
instructions I'm getting:

make[2]: *** No rule to make target `doc/gfortran.1', needed by `f95.man'.  
Stop.
make[2]: Leaving directory `/home/gcc/gcc'
make[1]: *** [stage1_build] Error 2
make[1]: Leaving directory `/home/gcc/gcc'
make: *** [bootstrap] Error 2

I searched for 'gfortran.1' in my system, but I didn't find this file . . . What
can I do?

Thank you!

Alex



Re: problem with "libobjects" and gcc-4.0.0

2005-07-07 Thread apaz
Quoting Andrew Pinski <[EMAIL PROTECTED]>:

> 
> On Jul 7, 2005, at 1:04 AM, [EMAIL PROTECTED] wrote:
> 
> > [EMAIL PROTECTED] read_input]# gcc main.m read_input.m -lobjc -lm
> > /usr/bin/ld: warning: type and size of dynamic symbol 
> > `__objc_class_name_Object'
> > are not defined
> > /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libobjc.so: 
> > undefined
> > reference to `xmalloc'
> > /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libobjc.so: 
> > undefined
> > reference to `xfree'
> > /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libobjc.so: 
> > undefined
> > reference to `xmalloc_atomic'
> > /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libobjc.so: 
> > undefined
> > reference to `xcalloc'
> > /usr/local/lib/gcc/i686-pc-linux-gnu/3.4.3/../../../libobjc.so: 
> > undefined
> > reference to `xrealloc'
> > collect2: ld returned 1 exit status
> 
> Huh? xmalloc is not in libobjc in any version of GCC I could find.
> This looks like a bug in your installation of GCC.
> 
> -- Pinski
> 
> 


I solved my privious problem but now I have another one:

When I try to run my code (after compilation with gcc), I'm getting:

./a.out: error while loading shared libraries: libobjc.so.1: cannot open shared
object file: No such file or directory

And this is the last part of the output after Testing the instalation on gcc:

Finalized 6609/6609 objects - finalization is probably ok
Total number of bytes allocated is 306393376
Final heap size is 9592832 bytes
Collector appears to work
Completed 531 collections
PASS: gctest
==
All 1 tests passed
==
make[3]: Leaving directory `/home/gcc/i686-pc-linux-gnu/boehm-gc'
make[2]: Leaving directory `/home/gcc/i686-pc-linux-gnu/boehm-gc'
make[1]: Leaving directory `/home/gcc/i686-pc-linux-gnu/boehm-gc'
make: Target `check' not remade because of errors.

I'll appreciate your help??

Thank you,

Alex



Re: problem with large arrays

2005-07-10 Thread apaz
Quoting Peter Teuben <[EMAIL PROTECTED]>:

> On Thu, 7 Jul 2005 [EMAIL PROTECTED] wrote:
> 
> > 
> > Well, I need to work with large arrays that must be share by several
> classes. I
> > new into C/Objective-C. I'm a Fortran programmer. THere, I used to work
> with
> > dynamic allocation of memory. What's the best way to work whith large
> arrays in
> > Objective-C ?
> 
> i would probably write a function to allocate dynamic arrays, that way you'd
> have something like (e.g.)
>   double a = array4d(10,20,4,50);
> which i once did using a "recursive" (array4d would call array3d etc.)
> technique. You can find that in the NEMO package under the the name
> mdarray:
>   http://bima.astro.umd.edu/nemo/man_html/mdarray.3.html
>  Or, more elegantly, use classes for this.
> 
> peter
> 


I have being trying this, but the program is taking too much memory (more than 3
G) when building an array of the following dimensions (197, 9, 15, 150), which I
don't consider too large. My code needs several of this arrays and I'm able to
run it without any problem in the same machine using Fortran.

Any help will be great!!

Thank you,

Alex