error compiling Octave 3.2.2 with Magick++ under CentOS 5.3

View: New views
3 Messages — Rating Filter:   Alert me  

error compiling Octave 3.2.2 with Magick++ under CentOS 5.3

by Les Klimczak :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

There seems to be some issue with how 'typedef' behaves in C++ namespaces. I was able to fix it, but don't have a satisfactory explanation for the problem.
Maybe someone has more insight here?

Les Klimczak, Ph.D.
Research Informatics Consultant
San Francisco, CA - Madison, WI - Gaithersburg, MD

Configuration:

CentOS 5.3
octave-3.2.2.tar.gz

ImageMagick-c++-devel-6.2.8.0-4.el5_1.1
ImageMagick-c++-6.2.8.0-4.el5_1.1
or
GraphicsMagick-1.3.5.tar.gz

./configure F77=gfortran


Problem:

g++ -c   -fPIC -I. -I.. -I../liboctave -I../src -I../libcruft/misc -DHAVE_CONFIG_H -mieee-fp -I/usr/include/freetype2 -Wall -W -Wshadow -Wold-style-cast -Wformat -g -O2 ./DLD-FUNCTIONS/__magick_read__.cc -o pic/__magick_read__.o

./DLD-FUNCTIONS/__magick_read__.cc: In function ?unsigned int scale_quantum_to_depth(const MagickLib::Quantum&, unsigned int)?:
./DLD-FUNCTIONS/__magick_read__.cc:45: error: ?Quantum? was not declared in this scope

Fix:

$ diff -cr octave-3.2.2/src/DLD-FUNCTIONS/__magick_read__.cc octave-3.2.2/src/DLD-FUNCTIONS/__magick_read__.cc.fix
*** octave-3.2.2/src/DLD-FUNCTIONS/__magick_read__.cc   2009-05-28 00:57:14.000000000 -0500
--- octave-3.2.2/src/DLD-FUNCTIONS/__magick_read__.cc.fix       2009-07-29 17:46:57.000000000 -0500
***************
*** 34,42 ****
  #ifdef HAVE_MAGICK
 
  #include <GraphicsMagick/Magick++.h>
 
  unsigned int
! scale_quantum_to_depth (const Magick::Quantum& quantum, unsigned int depth)
  {
    return (static_cast<unsigned int> (static_cast<double> (quantum)
                                       / MaxRGB * ((1 << depth) - 1)));
--- 34,43 ----
  #ifdef HAVE_MAGICK
 
  #include <GraphicsMagick/Magick++.h>
+ typedef Magick::Quantum Quantum;
 
  unsigned int
! scale_quantum_to_depth (const Quantum& quantum, unsigned int depth)
  {
    return (static_cast<unsigned int> (static_cast<double> (quantum)
                                       / MaxRGB * ((1 << depth) - 1)));




error compiling Octave 3.2.2 with Magick++ under CentOS 5.3

by John W. Eaton-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On  1-Aug-2009, Les Klimczak wrote:

| There seems to be some issue with how 'typedef' behaves in C++ namespaces. I
| was able to fix it, but don't have a satisfactory explanation for the
| problem.
| Maybe someone has more insight here?
|
| Les Klimczak, Ph.D.
| Research Informatics Consultant
| San Francisco, CA - Madison, WI - Gaithersburg, MD
|
| Configuration:
|
| CentOS 5.3
| octave-3.2.2.tar.gz
|
| ImageMagick-c++-devel-6.2.8.0-4.el5_1.1
| ImageMagick-c++-6.2.8.0-4.el5_1.1
| or
| GraphicsMagick-1.3.5.tar.gz
|
| ./configure F77=gfortran
|
|
| Problem:
|
| g++ -c   -fPIC -I. -I.. -I../liboctave -I../src -I../libcruft/misc
| -DHAVE_CONFIG_H -mieee-fp -I/usr/include/freetype2 -Wall -W -Wshadow
| -Wold-style-cast -Wformat -g -O2 ./DLD-FUNCTIONS/__magick_read__.cc -o
| pic/__magick_read__.o
|
| ./DLD-FUNCTIONS/__magick_read__.cc: In function ?unsigned int
| scale_quantum_to_depth(const MagickLib::Quantum&, unsigned int)?:
| ./DLD-FUNCTIONS/__magick_read__.cc:45: error: ?Quantum? was not declared in
| this scope
|
| Fix:
|
| $ diff -cr octave-3.2.2/src/DLD-FUNCTIONS/__magick_read__.cc
| octave-3.2.2/src/DLD-FUNCTIONS/__magick_read__.cc.fix
| *** octave-3.2.2/src/DLD-FUNCTIONS/__magick_read__.cc   2009-05-28
| 00:57:14.000000000 -0500
| --- octave-3.2.2/src/DLD-FUNCTIONS/__magick_read__.cc.fix       2009-07-29
| 17:46:57.000000000 -0500
| ***************
| *** 34,42 ****
|   #ifdef HAVE_MAGICK
|  
|   #include <GraphicsMagick/Magick++.h>
|  
|   unsigned int
| ! scale_quantum_to_depth (const Magick::Quantum& quantum, unsigned int
| depth)
|   {
|     return (static_cast<unsigned int> (static_cast<double> (quantum)
|                                        / MaxRGB * ((1 << depth) - 1)));
| --- 34,43 ----
|   #ifdef HAVE_MAGICK
|  
|   #include <GraphicsMagick/Magick++.h>
| + typedef Magick::Quantum Quantum;
|  
|   unsigned int
| ! scale_quantum_to_depth (const Quantum& quantum, unsigned int depth)
|   {
|     return (static_cast<unsigned int> (static_cast<double> (quantum)
|                                        / MaxRGB * ((1 << depth) - 1)));

What version of GCC do you have?

I don't see this error with GraphicsMagick 1.3.5 on a Debian system
when I'm compiling with GCC 4.3.3

jwe
_______________________________________________
Bug-octave mailing list
Bug-octave@...
https://www-old.cae.wisc.edu/mailman/listinfo/bug-octave

Re: error compiling Octave 3.2.2 with Magick++ under CentOS 5.3

by Les Klimczak :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

$ gcc -v
Using built-in specs.
Target: i386-redhat-linux
Configured with: ../configure --prefix=/usr --mandir=/usr/share/man --infodir=/usr/share/info --enable-shared --enable-threads=posix --enable-checking=release --with-system-zlib --enable-__cxa_atexit --disable-libunwind-exceptions --enable-libgcj-multifile --enable-languages=c,c++,objc,obj-c++,java,fortran,ada --enable-java-awt=gtk --disable-dssi --enable-plugin --with-java-home=/usr/lib/jvm/java-1.4.2-gcj-1.4.2.0/jre --with-cpu=generic --host=i386-redhat-linux
Thread model: posix
gcc version 4.1.2 20080704 (Red Hat 4.1.2-44)

John W. Eaton-3 wrote:
What version of GCC do you have?

I don't see this error with GraphicsMagick 1.3.5 on a Debian system
when I'm compiling with GCC 4.3.3

jwe