Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to install magick on centOS 6.9 in R 3.5.1 - error loading shared lib #166

Closed
serbinsh opened this issue Dec 20, 2018 · 12 comments
Closed

Comments

@serbinsh
Copy link

serbinsh commented Dec 20, 2018

** testing if installed package can be loaded
Error: package or namespace load failed for ‘magick’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/data/home/sserbin/R/library/magick/libs/magick.so':
  /data/home/sserbin/R/library/magick/libs/magick.so: undefined symbol: _ZN6Magick5Image5writeEPNS_4BlobERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/data/home/sserbin/R/library/magick’

The downloaded source packages are in
	‘/tmp/RtmpdOzStn/downloaded_packages’
Warning message:
In install.packages("magick") :
  installation of package ‘magick’ had non-zero exit status

This happens after it builds the package during the load test. so it builds fine but the dyn.load() to the shared libs seems to fail?

@serbinsh
Copy link
Author

ALso, FYI

[sserbin@modex ~]$ sudo yum install -y ImageMagick ImageMagick-devel
[sudo] password for sserbin:
Loaded plugins: priorities, refresh-packagekit, security, versionlock
Setting up Install Process
91 packages excluded due to repository priority protections
Package ImageMagick-6.7.2.7-6.el6.x86_64 already installed and latest version
Package ImageMagick-devel-6.7.2.7-6.el6.x86_64 already installed and latest version
Nothing to do

@serbinsh
Copy link
Author

One more, also crashes in the same way when doing a:

devtools::install_github("ropensci/magick") is there a ImageMagick++-devel library version issue such that I would need to build the system libs from source for IM?

@jeroen
Copy link
Member

jeroen commented Dec 20, 2018

Are you sure you don't have an additional version of imagemagick built from source in /usr/local? I just tested on docker with CentOS release 6.10 (Final) with ImageMagick-c++-devel 6.7.2.7 and the R package works out of the box.

> sessionInfo()
R version 3.5.1 (2018-07-02)
Platform: x86_64-redhat-linux-gnu (64-bit)
Running under: CentOS release 6.10 (Final)

Matrix products: default
BLAS: /usr/lib64/R/lib/libRblas.so
LAPACK: /usr/lib64/R/lib/libRlapack.so

locale:
 [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
 [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
 [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
 [7] LC_PAPER=en_US.UTF-8       LC_NAME=C
 [9] LC_ADDRESS=C               LC_TELEPHONE=C
[11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base

loaded via a namespace (and not attached):
[1] compiler_3.5.1

> library(magick)
Linking to ImageMagick 6.7.2
Enabled features: cairo, fontconfig, freetype, ghostscript, lcms, rsvg, x11
Disabled features: fftw, pango, webp

So I'm quite sure you have a local conflict with your ImageMagick installation.

@serbinsh
Copy link
Author

serbinsh commented Dec 22, 2018

@jeroen not that I know of


* installing *source* package ‘magick’ ...
** package ‘magick’ successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-fopenmp -I/usr/include/ImageMagick
Using PKG_LIBS=-lMagick++ -lMagickCore
** libs

I will do some digging around

also

[sserbin@modex ~]$ which display
/usr/bin/display

Also, the issue comes when building the r package. It builds fine but fails on test load. I can, however, load and older R imagemagick library just fine. I just cannot upgrade it?

@serbinsh
Copy link
Author

serbinsh commented Dec 22, 2018

So I built the system libs from scratch and placed in our shared cluster storage/lib location. I am now trying to build/install r-magick libs from scratch, but...

[sserbin@modex ImageMagick]$ PKG_CONFIG_PATH=/data/software/ImageMagick/7.0.8-19/lib/pkgconfig R CMD build r-magick/
* checking for file ‘r-magick/DESCRIPTION’ ... OK
* preparing ‘magick’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* running ‘cleanup’
* installing the package to build vignettes
      -----------------------------------
* installing *source* package ‘magick’ ...
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/data/software/ImageMagick/7.0.8-19/include/ImageMagick-7
Using PKG_LIBS=-L/data/software/ImageMagick/7.0.8-19/lib -lMagick++-7.Q16HDRI -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI
** libs
g++ -m64 -std=gnu++11 -I"/usr/include/R" -DNDEBUG -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/data/software/ImageMagick/7.0.8-19/include/ImageMagick-7   -I"/data/home/sserbin/R/library/Rcpp/include" -I/usr/local/include  -fvisibility=hidden -fpic  -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches   -m64 -mtune=generic -c RcppExports.cpp -o RcppExports.o
...

g++ -m64 -std=gnu++11 -shared -L/usr/lib64/R/lib -o magick.so RcppExports.o animation.o attributes.o base.o color.o composite.o config.o convolve.o device.o edges.o edit.o fonts.o options.o properties.o resize.o segment.o transformations.o -L/data/software/ImageMagick/7.0.8-19/lib -lMagick++-7.Q16HDRI -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI -L/usr/lib64/R/lib -lR
/usr/bin/ld: /data/software/ImageMagick/7.0.8-19/lib/libMagick++-7.Q16HDRI.a(libMagick___7_Q16HDRI_la-Blob.o): relocation R_X86_64_32S against `_ZTVN6Magick4BlobE' can not be used when making a shared object; recompile with -fPIC
/data/software/ImageMagick/7.0.8-19/lib/libMagick++-7.Q16HDRI.a: could not read symbols: Bad value
collect2: error: ld returned 1 exit status
make: *** [magick.so] Error 1
ERROR: compilation failed for package ‘magick’
* removing ‘/tmp/RtmpiE9Aq1/Rinst782f6df9a040/magick’
      -----------------------------------
ERROR: package installation failed
[sserbin@modex ImageMagick]$

so it seems to still fail with a complaint about building shared libs? I built magick with the options:

./configure --prefix=/data/software/ImageMagick/7.0.8-19 --disable-shared --enable-delegate-build

Might be I messed up by trying to build static, trying again without disabling the shared libs

@serbinsh
Copy link
Author

serbinsh commented Dec 22, 2018

OK, got it installed after a somewhat involved process.....not sure why it was so challenging on our cluster environment

[sserbin@modex ImageMagick]$ PKG_CONFIG_PATH=/data/software/ImageMagick/7.0.8-19/lib/pkgconfig R CMD build r-magick
* checking for file ‘r-magick/DESCRIPTION’ ... OK
* preparing ‘magick’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* running ‘cleanup’
* installing the package to build vignettes
* creating vignettes ... OK
Warning: ‘inst/doc’ files
    ‘intro.Rmd’, ‘intro.html’, ‘intro.R’
  ignored as vignettes have been rebuilt.
  Run R CMD build with --no-build-vignettes to prevent rebuilding.
* cleaning src
* running ‘cleanup’
* checking for LF line-endings in source and make files and shell scripts
* checking for empty or unneeded directories
* looking to see if a ‘data/datalist’ file should be added
* building ‘magick_2.0.9000.tar.gz’

[sserbin@modex ImageMagick]$

I had to install some additional missing R depends:

install.packages(‘rsvg’)
install.packages('gapminder')

The follow these instructions so I could build R pdftools
https://github.com/ropensci/pdftools#building-from-source

./configure --prefix=/data/software/poppler/0.47.0
make
make install

Then I did:

export LD_LIBRARY_PATH="/data/software/poppler/0.47.0/lib:$LD_LIBRARY_PATH"
export PKG_CONFIG_PATH="/data/software/poppler/0.47.0/lib/pkgconfig"

Then I did:

install.packages('pdftools')
Installing package into ‘/data/home/sserbin/R/library’
(as ‘lib’ is unspecified)
trying URL 'http://cran.us.r-project.org/src/contrib/pdftools_2.0.tar.gz'
Content type 'application/x-gzip' length 931405 bytes (909 KB)
==================================================
downloaded 909 KB

* installing *source* package ‘pdftools’ ...
** package ‘pdftools’ successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-I/data/software/poppler/0.47.0/include/poppler/cpp -I/data/software/poppler/0.47.0/include/poppler
Using PKG_LIBS=-L/data/software/poppler/0.47.0/lib -lpoppler-cpp
** libs
...
cd /data/software/src/ImageMagick # where i had the R package source from github
module load ImageMagick/7.0.8-19
module load netcdf/4.4.1.1-gnu540 # for rgdal - required for magick build
module load hdf5/1.8.19-gcc540     # for rgdal - required for magick build
PKG_CONFIG_PATH=/data/software/ImageMagick/7.0.8-19/lib/pkgconfig R CMD build r-magick
PKG_CONFIG_PATH=/data/software/ImageMagick/7.0.8-19/lib/pkgconfig R CMD INSTALL magick_2.0.9000.tar.gz

...
Rd warning: /tmp/Rtmpg1lDwV/R.INSTALL444c11c5fa54/magick/man/reexports.Rd:14: file link ‘%>%’ in package ‘magrittr’ does not exist and so has been treated as a topic
    segmentation                            html
    thresholding                            html
    transform                               html
    video                                   html
    wizard                                  html
** building package indices
** installing vignettes
** testing if installed package can be loaded
* DONE (magick)

...

> library(magick)
Linking to ImageMagick 7.0.8.19
Enabled features: fontconfig, freetype, fftw, pango, x11
Disabled features: cairo, ghostscript, lcms, rsvg, webp

So it seems I have the package now. surprisingly difficult

@jeroen
Copy link
Member

jeroen commented Dec 23, 2018

The rsvg and pdftools dependencies are optional, you don't need those to install magick.

The key here seems that you built a custom version of ImageMagick in /data/software/ImageMagick/ instead of the stock ImageMagick 6.7.2 that ships with CentOS.

@serbinsh
Copy link
Author

Ah, got it. Thanks @jeroen. I am going to close this now since it seems to be sorted. Not sure if this thread would be helpful to anyone else but it will be in the closed and searchable issues if anyone else has a similar situation or setup.

@transcriptomics
Copy link

I faced a similar issue with R version-3.5.2 on CentOS 7.
Similar to posted above by @jeroen, I also found that the ImageMagick must be compiled with the same version of gcc that was used to compile R and subsequently used while installing/building magick-- in my case gcc version-7.3.0.

However, even when I did all that, I kept getting the same error as above. The reason was that when I had compiled R, the R library got linked to the old ImageMagick (version-7.0.8-12) that was built with a previous version of gcc (version-4.9.5).

So even after rebuilding ImageMagick (this time version-7.0.8-24) with new gcc (version-7.3.0), which is the same gcc used to compile R, when I tried to install magick it still found the old ImageMagick (version-7.0.8-12) because it was linked to R library and I had not deleted the old installation of ImageMagick (version-7.0.8-12). see below:

[test@sh-101-31 /home/groups/test/sysapp]$ git clone https://github.com/ropensci/magick.git
Cloning into 'magick'...
remote: Enumerating objects: 38, done.
remote: Counting objects: 100% (38/38), done.
remote: Compressing objects: 100% (26/26), done.
remote: Total 4998 (delta 15), reused 25 (delta 11), pack-reused 4960
Receiving objects: 100% (4998/4998), 15.68 MiB | 20.40 MiB/s, done.
Resolving deltas: 100% (3657/3657), done.
[test@sh-101-31 /home/groups/test/sysapp]$ R CMD build magick  
Hi test, welcome to R...
* checking for file ‘magick/DESCRIPTION’ ... OK
* preparing ‘magick’:
* checking DESCRIPTION meta-information ... OK
* cleaning src
* running ‘cleanup’
* installing the package to build vignettes
      -----------------------------------
Hi test, welcome to R...
* installing *source* package ‘magick’ ...
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/home/groups/test/sysapp/ImageMagickv7.0.8-24/include/ImageMagick-7  
Using PKG_LIBS=-L/home/groups/test/sysapp/ImageMagickv7.0.8-24/lib -lMagick++-7.Q16HDRI -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI  
** libs
g++ -std=gnu++11 -I"/home/groups/test/sysapp/Rvpatched/lib64/R/include" -DNDEBUG -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/home/groups/test/sysapp/ImageMagickv7.0.8-24/include/ImageMagick-7   -I"/home/groups/test/sysapp/Rvpatched/lib64/R/library/Rcpp/include" -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2 -c RcppExports.cpp -o RcppExports.o
g++ -std=gnu++11 -I"/home/groups/test/sysapp/Rvpatched/lib64/R/include" -DNDEBUG -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/home/groups/test/sysapp/ImageMagickv7.0.8-24/include/ImageMagick-7   -I"/home/groups/test/sysapp/Rvpatched/lib64/R/library/Rcpp/include" -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2 -c animation.cpp -o animation.o
g++ -std=gnu++11 -I"/home/groups/test/sysapp/Rvpatched/lib64/R/include" -DNDEBUG -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/home/groups/test/sysapp/ImageMagickv7.0.8-24/include/ImageMagick-7   -I"/home/groups/test/sysapp/Rvpatched/lib64/R/library/Rcpp/include" -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2 -c attributes.cpp -o attributes.o
g++ -std=gnu++11 -I"/home/groups/test/sysapp/Rvpatched/lib64/R/include" -DNDEBUG -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/home/groups/test/sysapp/ImageMagickv7.0.8-24/include/ImageMagick-7   -I"/home/groups/test/sysapp/Rvpatched/lib64/R/library/Rcpp/include" -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2 -c base.cpp -o base.o
g++ -std=gnu++11 -I"/home/groups/test/sysapp/Rvpatched/lib64/R/include" -DNDEBUG -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/home/groups/test/sysapp/ImageMagickv7.0.8-24/include/ImageMagick-7   -I"/home/groups/test/sysapp/Rvpatched/lib64/R/library/Rcpp/include" -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2 -c color.cpp -o color.o
g++ -std=gnu++11 -I"/home/groups/test/sysapp/Rvpatched/lib64/R/include" -DNDEBUG -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/home/groups/test/sysapp/ImageMagickv7.0.8-24/include/ImageMagick-7   -I"/home/groups/test/sysapp/Rvpatched/lib64/R/library/Rcpp/include" -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2 -c composite.cpp -o composite.o
g++ -std=gnu++11 -I"/home/groups/test/sysapp/Rvpatched/lib64/R/include" -DNDEBUG -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/home/groups/test/sysapp/ImageMagickv7.0.8-24/include/ImageMagick-7   -I"/home/groups/test/sysapp/Rvpatched/lib64/R/library/Rcpp/include" -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2 -c config.cc -o config.o
g++ -std=gnu++11 -I"/home/groups/test/sysapp/Rvpatched/lib64/R/include" -DNDEBUG -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/home/groups/test/sysapp/ImageMagickv7.0.8-24/include/ImageMagick-7   -I"/home/groups/test/sysapp/Rvpatched/lib64/R/library/Rcpp/include" -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2 -c convolve.cpp -o convolve.o
g++ -std=gnu++11 -I"/home/groups/test/sysapp/Rvpatched/lib64/R/include" -DNDEBUG -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/home/groups/test/sysapp/ImageMagickv7.0.8-24/include/ImageMagick-7   -I"/home/groups/test/sysapp/Rvpatched/lib64/R/library/Rcpp/include" -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2 -c device.cpp -o device.o
g++ -std=gnu++11 -I"/home/groups/test/sysapp/Rvpatched/lib64/R/include" -DNDEBUG -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/home/groups/test/sysapp/ImageMagickv7.0.8-24/include/ImageMagick-7   -I"/home/groups/test/sysapp/Rvpatched/lib64/R/library/Rcpp/include" -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2 -c edges.cpp -o edges.o
g++ -std=gnu++11 -I"/home/groups/test/sysapp/Rvpatched/lib64/R/include" -DNDEBUG -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/home/groups/test/sysapp/ImageMagickv7.0.8-24/include/ImageMagick-7   -I"/home/groups/test/sysapp/Rvpatched/lib64/R/library/Rcpp/include" -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2 -c edit.cpp -o edit.o
g++ -std=gnu++11 -I"/home/groups/test/sysapp/Rvpatched/lib64/R/include" -DNDEBUG -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/home/groups/test/sysapp/ImageMagickv7.0.8-24/include/ImageMagick-7   -I"/home/groups/test/sysapp/Rvpatched/lib64/R/library/Rcpp/include" -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2 -c fonts.cpp -o fonts.o
g++ -std=gnu++11 -I"/home/groups/test/sysapp/Rvpatched/lib64/R/include" -DNDEBUG -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/home/groups/test/sysapp/ImageMagickv7.0.8-24/include/ImageMagick-7   -I"/home/groups/test/sysapp/Rvpatched/lib64/R/library/Rcpp/include" -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2 -c options.cpp -o options.o
g++ -std=gnu++11 -I"/home/groups/test/sysapp/Rvpatched/lib64/R/include" -DNDEBUG -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/home/groups/test/sysapp/ImageMagickv7.0.8-24/include/ImageMagick-7   -I"/home/groups/test/sysapp/Rvpatched/lib64/R/library/Rcpp/include" -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2 -c properties.cpp -o properties.o
g++ -std=gnu++11 -I"/home/groups/test/sysapp/Rvpatched/lib64/R/include" -DNDEBUG -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/home/groups/test/sysapp/ImageMagickv7.0.8-24/include/ImageMagick-7   -I"/home/groups/test/sysapp/Rvpatched/lib64/R/library/Rcpp/include" -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2 -c resize.cpp -o resize.o
g++ -std=gnu++11 -I"/home/groups/test/sysapp/Rvpatched/lib64/R/include" -DNDEBUG -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/home/groups/test/sysapp/ImageMagickv7.0.8-24/include/ImageMagick-7   -I"/home/groups/test/sysapp/Rvpatched/lib64/R/library/Rcpp/include" -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2 -c segment.cpp -o segment.o
g++ -std=gnu++11 -I"/home/groups/test/sysapp/Rvpatched/lib64/R/include" -DNDEBUG -fopenmp -DMAGICKCORE_HDRI_ENABLE=1 -DMAGICKCORE_QUANTUM_DEPTH=16 -I/home/groups/test/sysapp/ImageMagickv7.0.8-24/include/ImageMagick-7   -I"/home/groups/test/sysapp/Rvpatched/lib64/R/library/Rcpp/include" -I/usr/local/include  -fvisibility=hidden -fpic  -g -O2 -c transformations.cpp -o transformations.o
g++ -std=gnu++11 -shared -L/home/groups/test/sysapp/Rvpatched/lib64/R/lib  -L/home/groups/test/sysapp/ImageMagickv7.0.8-12/lib  -o magick.so RcppExports.o animation.o attributes.o base.o color.o composite.o config.o convolve.o device.o edges.o edit.o fonts.o options.o properties.o resize.o segment.o transformations.o -L/home/groups/test/sysapp/ImageMagickv7.0.8-24/lib -lMagick++-7.Q16HDRI -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI -L/home/groups/test/sysapp/Rvpatched/lib64/R/lib -lR
installing to /tmp/RtmpzexjtC/Rinstf3a4661220af/magick/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Hi test, welcome to R...
Error: package or namespace load failed for ‘magick’ in dyn.load(file, DLLpath = DLLpath, ...):
 unable to load shared object '/tmp/RtmpzexjtC/Rinstf3a4661220af/magick/libs/magick.so':
  /tmp/RtmpzexjtC/Rinstf3a4661220af/magick/libs/magick.so: undefined symbol: _ZN6Magick5Image5writeEPNS_4BlobERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm
Error: loading failed
Execution halted
ERROR: loading failed
* removing ‘/tmp/RtmpzexjtC/Rinstf3a4661220af/magick’
      -----------------------------------
ERROR: package installation failed

You can see that in the very last compilation step

g++ -std=gnu++11 -shared -L/home/groups/test/sysapp/Rvpatched/lib64/R/lib  -L/home/groups/test/sysapp/ImageMagickv7.0.8-12/lib  -o magick.so RcppExports.o animation.o attributes.o base.o color.o composite.o config.o convolve.o device.o edges.o edit.o fonts.o options.o properties.o resize.o segment.o transformations.o -L/home/groups/test/sysapp/ImageMagickv7.0.8-24/lib -lMagick++-7.Q16HDRI -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI -L/home/groups/test/sysapp/Rvpatched/lib64/R/lib -lR

g++ is using both ImageMagick version-7.0.8-12 and version-7.0.8-24, the first one is carryover from when R was compiled.

All I had to do is make the old installation unavailable and everything worked.

[test@sh-101-31 /home/groups/test/sysapp]$ mv ImageMagickv7.0.8-12/ ImageMagickv7.0.8-12.old

Now while installing magick within R the old installation was not found and shared libraries loaded correctly. this was a lot easier than compiling R again with correct dynamic link to new local install of ImageMagick:

> BiocManager::install("magick")
Bioconductor version 3.8 (BiocManager 1.30.4), R 3.5.2 Patched (2019-01-24
  r76013)
Installing package(s) 'magick'
trying URL 'https://cran.rstudio.com/src/contrib/magick_2.0.tar.gz'
Content type 'application/x-gzip' length 4998781 bytes (4.8 MB)
==================================================
downloaded 4.8 MB

Hi test, welcome to R...
* installing *source* package ‘magick’ ...
** package ‘magick’ successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
...
...
g++ -std=gnu++11 -shared -L/home/groups/test/sysapp/Rvpatched/lib64/R/lib -L/home/groups/test/sysapp/ImageMagickv7.0.8-12/lib -o magick.so RcppExports.o animation.o attributes.o base.o color.o composite.o config.o convolve.o device.o edges.o edit.o fonts.o options.o properties.o resize.o segment.o transformations.o -L/home/groups/test/sysapp/ImageMagickv7.0.8-24/lib -lMagick++-7.Q16HDRI -lMagickWand-7.Q16HDRI -lMagickCore-7.Q16HDRI -L/home/groups/test/sysapp/Rvpatched/lib64/R/lib -lR
installing to /home/groups/test/sysapp/Rvpatched/lib64/R/library/magick/libs
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Hi test, welcome to R...
* DONE (magick)

The downloaded source packages are in
        ‘/tmp/Rtmpg7JSAr/downloaded_packages’
Updating HTML index of packages in '.Library'
Making 'packages.html' ... done
>

Hope this saves someone else a few hours that I wasted!!

@CicadaDennis
Copy link

Hello,
Having same problem, but not sure how the above information applies to my situation. Any help would be greatly appreciated.

First, I was having the following problem, which was "solved" by having the system administrator install the rpm for ImageMagick-c++-devel.

* installing *source* package 'magick' ...
** package 'magick' successfully unpacked and MD5 sums checked
Package Magick++ was not found in the pkg-config search path.
Perhaps you should add the directory containing `Magick++.pc'
to the PKG_CONFIG_PATH environment variable
No package 'Magick++' found
Using PKG_CFLAGS=
Using PKG_LIBS=-lMagick++-6.Q16
------------------------- ANTICONF ERROR ---------------------------
Configuration failed because Magick++ was not found. Try installing:
 - deb: 'libmagick++-dev' (Debian, Ubuntu)
 - rpm: 'ImageMagick-c++-devel' (Fedora, CentOS, RHEL)
 - csw: 'imagemagick_dev' (Solaris)
On MacOS it is recommended to use install ImageMagick-6 from homebrew
with extra support for fontconfig and rsvg rendering:
   brew reinstall imagemagick@6 --with-fontconfig --with-librsvg
For older Ubuntu versions Trusty (14.04) and Xenial (16.04) use our PPA:
   sudo add-apt-repository -y ppa:opencpu/imagemagick
   sudo apt-get update
   sudo apt-get install -y libmagick++-dev
If Magick++ is already installed, check that 'pkg-config' is in your
PATH and PKG_CONFIG_PATH contains a Magick++.pc file. If pkg-config
is unavailable you can set INCLUDE_DIR and LIB_DIR manually via:
R CMD INSTALL --configure-vars='INCLUDE_DIR=... LIB_DIR=...'
--------------------------------------------------------------------

Then, when I try to install magick the following error occurs that is just like the ones listed above:

> sessionInfo()
R version 3.3.1 (2016-06-21)
Platform: x86_64-pc-linux-gnu (64-bit)
Running under: Red Hat Enterprise Linux Server 7.5 (Maipo)

locale:
[1] C

attached base packages:
[1] stats     graphics  grDevices utils     datasets  methods   base     
> install.packages("magick")
Installing package into '/gpfs/home/h/b/hbrokaw/Carbonate/rpackages'
(as 'lib' is unspecified)
--- Please select a CRAN mirror for use in this session ---
trying URL 'https://ftp.ussg.iu.edu/CRAN/src/contrib/magick_2.0.tar.gz'
Content type 'application/x-gzip' length 4998781 bytes (4.8 MB)
==================================================
downloaded 4.8 MB

* installing *source* package 'magick' ...
** package 'magick' successfully unpacked and MD5 sums checked
Found pkg-config cflags and libs!
Using PKG_CFLAGS=-fopenmp -I/usr/include/ImageMagick  
Using PKG_LIBS=-lMagick++ -lMagickCore  
** libs
icpc -std=c++11 -I/N/soft/rhel7/r/3.3.1/lib64/R/include -DNDEBUG -fopenmp -I/usr/include/ImageMagick   -I/usr/local/include -I"/gpfs/hps/soft/rhel7/r/3.3.1/lib64/R/library/Rcpp/include"   -fpic  -g -O2 -c RcppExports.cpp -o RcppExports.o
icpc -std=c++11 -I/N/soft/rhel7/r/3.3.1/lib64/R/include -DNDEBUG -fopenmp -I/usr/include/ImageMagick   -I/usr/local/include -I"/gpfs/hps/soft/rhel7/r/3.3.1/lib64/R/library/Rcpp/include"   -fpic  -g -O2 -c animation.cpp -o animation.o
icpc -std=c++11 -I/N/soft/rhel7/r/3.3.1/lib64/R/include -DNDEBUG -fopenmp -I/usr/include/ImageMagick   -I/usr/local/include -I"/gpfs/hps/soft/rhel7/r/3.3.1/lib64/R/library/Rcpp/include"   -fpic  -g -O2 -c attributes.cpp -o attributes.o
icpc -std=c++11 -I/N/soft/rhel7/r/3.3.1/lib64/R/include -DNDEBUG -fopenmp -I/usr/include/ImageMagick   -I/usr/local/include -I"/gpfs/hps/soft/rhel7/r/3.3.1/lib64/R/library/Rcpp/include"   -fpic  -g -O2 -c base.cpp -o base.o
icpc -std=c++11 -I/N/soft/rhel7/r/3.3.1/lib64/R/include -DNDEBUG -fopenmp -I/usr/include/ImageMagick   -I/usr/local/include -I"/gpfs/hps/soft/rhel7/r/3.3.1/lib64/R/library/Rcpp/include"   -fpic  -g -O2 -c color.cpp -o color.o
icpc -std=c++11 -I/N/soft/rhel7/r/3.3.1/lib64/R/include -DNDEBUG -fopenmp -I/usr/include/ImageMagick   -I/usr/local/include -I"/gpfs/hps/soft/rhel7/r/3.3.1/lib64/R/library/Rcpp/include"   -fpic  -g -O2 -c composite.cpp -o composite.o
icpc -std=c++11 -I/N/soft/rhel7/r/3.3.1/lib64/R/include -DNDEBUG -fopenmp -I/usr/include/ImageMagick   -I/usr/local/include -I"/gpfs/hps/soft/rhel7/r/3.3.1/lib64/R/library/Rcpp/include"   -fpic  -g -O2 -c config.cc -o config.o
icpc -std=c++11 -I/N/soft/rhel7/r/3.3.1/lib64/R/include -DNDEBUG -fopenmp -I/usr/include/ImageMagick   -I/usr/local/include -I"/gpfs/hps/soft/rhel7/r/3.3.1/lib64/R/library/Rcpp/include"   -fpic  -g -O2 -c convolve.cpp -o convolve.o
icpc -std=c++11 -I/N/soft/rhel7/r/3.3.1/lib64/R/include -DNDEBUG -fopenmp -I/usr/include/ImageMagick   -I/usr/local/include -I"/gpfs/hps/soft/rhel7/r/3.3.1/lib64/R/library/Rcpp/include"   -fpic  -g -O2 -c device.cpp -o device.o
icpc -std=c++11 -I/N/soft/rhel7/r/3.3.1/lib64/R/include -DNDEBUG -fopenmp -I/usr/include/ImageMagick   -I/usr/local/include -I"/gpfs/hps/soft/rhel7/r/3.3.1/lib64/R/library/Rcpp/include"   -fpic  -g -O2 -c edges.cpp -o edges.o
icpc -std=c++11 -I/N/soft/rhel7/r/3.3.1/lib64/R/include -DNDEBUG -fopenmp -I/usr/include/ImageMagick   -I/usr/local/include -I"/gpfs/hps/soft/rhel7/r/3.3.1/lib64/R/library/Rcpp/include"   -fpic  -g -O2 -c edit.cpp -o edit.o
icpc -std=c++11 -I/N/soft/rhel7/r/3.3.1/lib64/R/include -DNDEBUG -fopenmp -I/usr/include/ImageMagick   -I/usr/local/include -I"/gpfs/hps/soft/rhel7/r/3.3.1/lib64/R/library/Rcpp/include"   -fpic  -g -O2 -c fonts.cpp -o fonts.o
icpc -std=c++11 -I/N/soft/rhel7/r/3.3.1/lib64/R/include -DNDEBUG -fopenmp -I/usr/include/ImageMagick   -I/usr/local/include -I"/gpfs/hps/soft/rhel7/r/3.3.1/lib64/R/library/Rcpp/include"   -fpic  -g -O2 -c options.cpp -o options.o
icpc -std=c++11 -I/N/soft/rhel7/r/3.3.1/lib64/R/include -DNDEBUG -fopenmp -I/usr/include/ImageMagick   -I/usr/local/include -I"/gpfs/hps/soft/rhel7/r/3.3.1/lib64/R/library/Rcpp/include"   -fpic  -g -O2 -c properties.cpp -o properties.o
icpc -std=c++11 -I/N/soft/rhel7/r/3.3.1/lib64/R/include -DNDEBUG -fopenmp -I/usr/include/ImageMagick   -I/usr/local/include -I"/gpfs/hps/soft/rhel7/r/3.3.1/lib64/R/library/Rcpp/include"   -fpic  -g -O2 -c resize.cpp -o resize.o
icpc -std=c++11 -I/N/soft/rhel7/r/3.3.1/lib64/R/include -DNDEBUG -fopenmp -I/usr/include/ImageMagick   -I/usr/local/include -I"/gpfs/hps/soft/rhel7/r/3.3.1/lib64/R/library/Rcpp/include"   -fpic  -g -O2 -c segment.cpp -o segment.o
icpc -std=c++11 -I/N/soft/rhel7/r/3.3.1/lib64/R/include -DNDEBUG -fopenmp -I/usr/include/ImageMagick   -I/usr/local/include -I"/gpfs/hps/soft/rhel7/r/3.3.1/lib64/R/library/Rcpp/include"   -fpic  -g -O2 -c transformations.cpp -o transformations.o
icpc -std=c++11 -shared -L/N/soft/rhel7/r/3.3.1/lib64/R/lib -L/usr/lib64 -L/lib64 -o magick.so RcppExports.o animation.o attributes.o base.o color.o composite.o config.o convolve.o device.o edges.o edit.o fonts.o options.o properties.o resize.o segment.o transformations.o -lMagick++ -lMagickCore -L/N/soft/rhel7/r/3.3.1/lib64/R/lib -lR
installing to /gpfs/home/h/b/hbrokaw/Carbonate/rpackages/magick/libs
** R
** inst
** preparing package for lazy loading
** help
*** installing help indices
** building package indices
** installing vignettes
** testing if installed package can be loaded
Error in dyn.load(file, DLLpath = DLLpath, ...) : 
  unable to load shared object '/gpfs/home/h/b/hbrokaw/Carbonate/rpackages/magick/libs/magick.so':
  /gpfs/home/h/b/hbrokaw/Carbonate/rpackages/magick/libs/magick.so: undefined symbol: _ZN6Magick5Image5writeEPNS_4BlobERKNSt7__cxx1112basic_stringIcSt11char_traitsIcESaIcEEEm
Error: loading failed
Execution halted
ERROR: loading failed
* removing '/gpfs/home/h/b/hbrokaw/Carbonate/rpackages/magick'

The downloaded source packages are in
	'/tmp/RtmpLKEu9I/downloaded_packages'
Warning message:
In install.packages("magick") :
  installation of package 'magick' had non-zero exit status

@xihajun
Copy link

xihajun commented Oct 28, 2021

Hello, may I kindly ask did you solve this issue @CicadaDennis

@xihajun
Copy link

xihajun commented Oct 28, 2021

This seems to solve my issue for centos 8.0

yum install ImageMagick ImageMagick-devel ImageMagick-c++ ImageMagick-c++-devel

some mistake I took

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants