ImageMagick-6.3.5-7 missing explicit reference to openmp

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
Gozer404

ImageMagick-6.3.5-7 missing explicit reference to openmp

Post by Gozer404 »

After configure/make for building a RPM file I discovered that (at least) on Fedora 7 openmp support is detected.
Then OPENMP_CFLAGS contains -fopenmp and LDFLAGS contains -fopenmp BUT the .pc files are not updated to reflect the mandatory reference to openmp.

Linking with Wand then fails:

Code: Select all

gcc -g -Wall -o matrixview driver.o matrixview.o matrixview_textures.o  -lbz2 -lWand -lMagick -lpthread -lGLU -lGL -lSM -lICE -lX11 -lm  
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libMagick.so: undefined reference to `GOMP_parallel_end'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libMagick.so: undefined reference to `omp_get_num_threads'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libMagick.so: undefined reference to `GOMP_parallel_start'
/usr/lib/gcc/i386-redhat-linux/4.1.2/../../../libMagick.so: undefined reference to `omp_get_thread_num'
collect2: ld returned 1 exit status
When explicitly adding -fopenmp it now links correctly.

I have no easy solution for this but it can certainly be fixed by updating the .pc files (?)
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: ImageMagick-6.3.5-7 missing explicit reference to openmp

Post by magick »

Try ImageMagick-6.3.5-8, the current release. It links libgomp if it finds it which should resolve the problem you posted.
Gozer404

Re: ImageMagick-6.3.5-7 missing explicit reference to openmp

Post by Gozer404 »

ImageMagick-6.3.5-7 was already linked with openmp BUT as this is not indicated in the .pc files linking something else with libwand or libmagick (when using the autotools) can not know that -fopenmp (detected and used during the ImageMagick compilation step) is mandatory.

Internal utilities use the -fopenmp flags (as in is set in main Makefile) and have no problems:

Code: Select all

/bin/sh ./libtool --silent --tag=CC   --mode=link gcc  -O3 -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m32 -march=i686 -mtune=generic -fasynchronous-unwind-tables -Wall -W -pthread -fopenmp -fopenmp -lfreetype -fopenmp -lfreetype -o utilities/import utilities/import.o magick/libMagick.la wand/libWand.la 

Code: Select all

ldd /usr/bin/animate
        linux-gate.so.1 =>  (0x00110000)
        libMagick.so.10 => /usr/lib/libMagick.so.10 (0x00111000)
        libWand.so.10 => /usr/lib/libWand.so.10 (0x00327000)
../..
        [color=#FF0000]libgomp.so.1 => /usr/lib/libgomp.so.1 (0x00887000)[/color]
        libc.so.6 => /lib/libc.so.6 (0x00ae7000)
../..
I checked in ImageMagick-6.3.5-8 and I have the same behavior:
libmagick configure step adds a reference to openmp but when you use only pkg-config --libs Wand for a new program (outside the lib) using the Wand API you don't get the '-fopenmp' and then linking fails.
The problem is not inside the imagemagick tree it's only when you want to build against libmagick.
I think the '-fopenmp' flags should be inserted in magick/ImageMagick.pc, wand/Wand.pc and /Magick++/lib/ImageMagick++.pc
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: ImageMagick-6.3.5-7 missing explicit reference to openmp

Post by magick »

We include the -fopenmp flag in the PC files in ImageMagick 6.3.5-9 Beta available sometime tomorrow. Thanks.
Post Reply