# pecl-imagick compilation error



## eticaret (Feb 4, 2010)

Hello!

I have searched through mail list, but couldnt find a fix for pecl-imagick compilation error.

```
cc -shared  .libs/imagick_class.o .libs/imagickdraw_class.o .libs/imagickpixel_class.o .libs/imagickpixeliterator_class.o 
.libs/imagick_helpers.o .libs/imagick_read.o .libs/imagick.o  -lMagickWand -lMagickCore  -march=opteron -Wl,-soname -Wl,imagick.so -o ./.libs
/imagick.so
/usr/bin/ld: cannot find -lMagickWand
*** Error code 1

Stop in /usr/ports/graphics/pecl-imagick/work/imagick-2.3.0.
```

We have ImageMagick-nox11-6.5.8.10 already installed:


```
root@hostname [/usr/ports/graphics/pecl-imagick]# pkg_info | grep Magick
ImageMagick-nox11-6.5.8.10 Image processing tools
```

It is FreeBSD 7.2-RELEASE-p5

We appreciate your advise.

Regards,


----------



## Danik (Oct 18, 2010)

ImageMagick-nox11-6.6.3.10 and 7.0-RELEASE FreeBSD 7.0-RELEASE 

Trying to install imagemagick and have error in compiling.

Tried to v 2.2.2 and 3.0.0 and 3.0.1RC2 install from ports and from pecl and have the same problem.

`pecl install imagick`



```
...
 cc -I. -I/root/tmp/pear/imagick -DPHP_ATOM_INC -I/var/tmp/pear-build-root/imagick-3.0.0/include -I/var/tmp/pear-build-root/imagick-3.0.0/main -
I/root/tmp/pear/imagick -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -I/usr/include/php/Zend -I/usr/include/php/ext -
I/usr/include/php/ext/date/lib -I/usr/local/include/ImageMagick -DHAVE_CONFIG_H -g -O2 -c /root/tmp/pear/imagick/imagick.c  -fPIC -DPIC -o 
.libs/imagick.o
/root/tmp/pear/imagick/imagick.c: In function 'zm_info_imagick':
/root/tmp/pear/imagick/imagick.c:2684: warning: passing argument 2 of 'MagickQueryFormats' from incompatible pointer type
/root/tmp/pear/imagick/imagick.c:2691: warning: passing argument 1 of 'MagickGetVersion' from incompatible pointer type
/bin/bash /var/tmp/pear-build-root/imagick-3.0.0/libtool --mode=link cc -DPHP_ATOM_INC -I/var/tmp/pear-build-root/imagick-3.0.0/include -
I/var/tmp/pear-build-root/imagick-3.0.0/main -I/root/tmp/pear/imagick -I/usr/include/php -I/usr/include/php/main -I/usr/include/php/TSRM -
I/usr/include/php/Zend -I/usr/include/php/ext -I/usr/include/php/ext/date/lib -I/usr/local/include/ImageMagick  -DHAVE_CONFIG_H  -g -O2   
-o ./imagick.la -export-dynamic -avoid-version -prefer-pic -module -rpath /var/tmp/pear-build-root/imagick-3.0.0/modules  imagick_class.lo 
imagickdraw_class.lo imagickpixel_class.lo imagickpixeliterator_class.lo imagick_helpers.lo imagick_read.lo imagick.lo -lMagickWand -lMagickCore 
-ljbig -llcms -ltiff -lfreetype -ljasper -ljpeg -llqr-1 -lglib-2.0 -lpng -lfftw3 -lfpx -lfontconfig -lbz2 -lxml2 -lz -lm -lltdl
cc -shared  .libs/imagick_class.o .libs/imagickdraw_class.o .libs/imagickpixel_class.o .libs/imagickpixeliterator_class.o .libs/imagick_helpers.o 
.libs/imagick_read.o .libs/imagick.o  -lMagickWand -lMagickCore -ljbig -llcms -ltiff -lfreetype -ljasper -ljpeg -llqr-1 -lglib-2.0 -lpng -lfftw3 
-lfpx -lfontconfig -lbz2 -lxml2 -lz -lm -lltdl  -Wl,-soname -Wl,imagick.so -o ./.libs/imagick.so
/usr/bin/ld: cannot find -lMagickWand
*** Error code 1

Stop in /var/tmp/pear-build-root/imagick-3.0.0.
ERROR: `make' failed
```


Can anyone suggest how to install imagic module?


----------



## SirDice (Oct 18, 2010)

You seem to be missing parts of ImageMagick:

```
root@build:/usr/ports#ll /usr/local/lib/libMagickWand.*
-rw-r--r--  1 root  wheel  1635272 Oct 14 08:10 /usr/local/lib/libMagickWand.a
-rwxr-xr-x  1 root  wheel     1698 Oct 14 08:10 /usr/local/lib/libMagickWand.la
lrwxr-xr-x  1 root  wheel       18 Oct 14 08:10 /usr/local/lib/libMagickWand.so -> libMagickWand.so.4
-rwxr-xr-x  1 root  wheel  1264750 Oct 14 08:10 /usr/local/lib/libMagickWand.so.4
root@build:/usr/ports#pkg_info -W /usr/local/lib/libMagickWand.so
/usr/local/lib/libMagickWand.so was installed by package ImageMagick-6.6.3.10
```


----------



## Danik (Oct 19, 2010)

I've just checked and all is in its place:


```
cd /usr/local/lib/
[root@mx1 /usr/local/lib]# ls -la|grep libMagickWand
-rw-r--r--   1 root  wheel   1350420 Oct 19 09:36 libMagickWand.a
-rwxr-xr-x   1 root  wheel      1387 Oct 19 09:36 libMagickWand.la
lrwxr-xr-x   1 root  wheel        18 Oct 19 09:36 libMagickWand.so -> libMagickWand.so.4
-rwxr-xr-x   1 root  wheel   1039230 Oct 19 09:36 libMagickWand.so.4
```

Any suggestions ?


----------



## Danik (Oct 19, 2010)

I just symlinked libs to /usr/lib from /usr/local/lib and all errors are gone.


```
ln /usr/local/lib/libMagickWand.a /usr/lib/libMagickWand.a
ln /usr/local/lib/libMagickWand.la /usr/lib/libMagickWand.la
ln /usr/local/lib/libMagickWand.so.4 /usr/lib/libMagickWand.so.4
ln /usr/local/lib/libMagickWand.so.4 /usr/lib/libMagickWand.so
```


----------



## SirDice (Oct 19, 2010)

Danik said:
			
		

> i just simlinked  libs to /usr/lib from /usr/local/lib and all errors gone


Don't EVER do that again!

Fix the cause not the effect!


----------



## DutchDaemon (Oct 19, 2010)

The effect will be fireworks..


----------



## Danik (Oct 20, 2010)

Ok I got it, but what should I do to resolve it the right way? Maybe I should add /usr/local/lib to some path variable or something alike?


----------



## SirDice (Oct 20, 2010)

Look at the output of [cmd=]ldconfig -r[/cmd] One of the first lines should show the search directories, /usr/local/lib/ should be in there.


----------



## Danik (Oct 21, 2010)

Ok, it is in the list:


```
search directories: /lib:/usr/lib:/usr/lib/compat:
[B]/usr/local/lib[/B]:/usr/local/lib/compat/pkg:/usr/local/lib/compat:/usr/local/lib/mysql:/usr/local/lib/pth:/usr/local/lib/courier-authlib
```

But without symlinks still no luck in compiling


----------



## SirDice (Oct 21, 2010)

That same list should also show libMagickWand:

```
root@build:/usr/ports#ldconfig -r | grep libMagick
        310:-lMagickCore.4 => /usr/local/lib/libMagickCore.so.4
        311:-lMagickWand.4 => /usr/local/lib/libMagickWand.so.4
        312:-lMagick++.4 => /usr/local/lib/libMagick++.so.4
```


----------



## Danik (Oct 22, 2010)

I get the same list 


```
ldconfig -r | grep libMagick
        93:-lMagickWand.4 => /usr/lib/libMagickWand.so.4
        189:-lMagickWand.4 => /usr/local/lib/libMagickWand.so.4
        190:-lMagick++.4 => /usr/local/lib/libMagick++.so.4
        256:-lMagickCore.4 => /usr/local/lib/libMagickCore.so.4
        282:-lMagick++.2 => /usr/local/lib/compat/pkg/libMagick++.so.2
        287:-lMagickCore.2 => /usr/local/lib/compat/pkg/libMagickCore.so.2
        288:-lMagickWand.2 => /usr/local/lib/compat/pkg/libMagickWand.so.2
```

but still not able to compile imagick


----------

