R3.2.4のソース(https://cran.r-project.org/web/packages/Cairo/index.html、最新バージョン)からRパッケージ "Cairo"をコンパイルしようとしています。Cairo Rパッケージをコンパイルする - /usr/lib64/libcairo.a:シンボルを追加できません:不正な値
これは、これをインストールする必要があるサーバー(SLES11 SP4、変更するオプションなし)がインターネットに接続されていないため、repoからインストールできません。
いくつかの問題は、正しい環境変数を設定することで既に修正されています(下記の設定を参照)。 残念なことに、パッケージをインストールしようとすると、構成後もコンパイルエラーが発生します。
セッティング:(Rのコマンドライン上)
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/lib64
export CAIRO_INCLUDE_PATH=/usr/include/cairo
export CAIRO_CFLAGS='-I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/fontconfig -I/usr/include/libpng12'
export CAIRO_LIBS='-L/usr/lib64 -lcairo -lfreetype -lpixman-1 -lfontconfig -lpng12 -lz -lXrender -lX11'
が出力:
> install.packages("/home/username/R_packages/Cairo_1.5-9.tar.gz", type="source", repos=NULL)
* installing *source* package ‘Cairo’ ...
** package ‘Cairo’ successfully unpacked and MD5 sums checked
checking for gcc... gcc -std=gnu99
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc -std=gnu99 accepts -g... yes
checking for gcc -std=gnu99 option to accept ISO C89... none needed
checking how to run the C preprocessor... gcc -std=gnu99 -E
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/wait.h that is POSIX.1 compatible... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for string.h... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking for an ANSI C-conforming const... yes
checking for pkg-config... /usr/bin/pkg-config
configure: CAIRO_CFLAGS=-I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/fontconfig -I/usr/include/libpng12
checking if R was compiled with the RConn patch... no
checking cairo.h usability... yes
checking cairo.h presence... yes
checking for cairo.h... yes
checking for PNG support in Cairo... yes
checking for ATS font support in Cairo... no
configure: CAIRO_LIBS=-L/usr/lib64 -lcairo -lfreetype -lpixman-1 -lfontconfig -lpng12 -lz -lXrender -lX11
checking for library containing deflate... none required
checking whether Cairo programs can be compiled... yes
checking whether cairo_image_surface_get_format is declared... no
checking for FreeType support in cairo... yes
checking whether FreeType needs additional flags... no
checking wheter libjpeg works... no
checking wheter libtiff works... no
configure: creating ./config.status
config.status: creating src/Makevars
config.status: creating src/cconfig.h
** libs
gcc -std=gnu99 -I/home/username/R3/lib64/R/include -DNDEBUG -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/fontconfig -I/usr/include/libpng12 -I. -Iinclude -I/usr/local/include -g -O2 -fpic -g -O2 -c cairobem.c -o cairobem.o
gcc -std=gnu99 -I/home/username/R3/lib64/R/include -DNDEBUG -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/fontconfig -I/usr/include/libpng12 -I. -Iinclude -I/usr/local/include -g -O2 -fpic -g -O2 -c cairogd.c -o cairogd.o
gcc -std=gnu99 -I/home/username/R3/lib64/R/include -DNDEBUG -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/fontconfig -I/usr/include/libpng12 -I. -Iinclude -I/usr/local/include -g -O2 -fpic -g -O2 -c cairotalk.c -o cairotalk.o
gcc -std=gnu99 -I/home/username/R3/lib64/R/include -DNDEBUG -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/fontconfig -I/usr/include/libpng12 -I. -Iinclude -I/usr/local/include -g -O2 -fpic -g -O2 -c img-backend.c -o img-backend.o
gcc -std=gnu99 -I/home/username/R3/lib64/R/include -DNDEBUG -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/fontconfig -I/usr/include/libpng12 -I. -Iinclude -I/usr/local/include -g -O2 -fpic -g -O2 -c img-jpeg.c -o img-jpeg.o
gcc -std=gnu99 -I/home/username/R3/lib64/R/include -DNDEBUG -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/fontconfig -I/usr/include/libpng12 -I. -Iinclude -I/usr/local/include -g -O2 -fpic -g -O2 -c img-tiff.c -o img-tiff.o
gcc -std=gnu99 -I/home/username/R3/lib64/R/include -DNDEBUG -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/fontconfig -I/usr/include/libpng12 -I. -Iinclude -I/usr/local/include -g -O2 -fpic -g -O2 -c pdf-backend.c -o pdf-backend.o
gcc -std=gnu99 -I/home/username/R3/lib64/R/include -DNDEBUG -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/fontconfig -I/usr/include/libpng12 -I. -Iinclude -I/usr/local/include -g -O2 -fpic -g -O2 -c ps-backend.c -o ps-backend.o
gcc -std=gnu99 -I/home/username/R3/lib64/R/include -DNDEBUG -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/fontconfig -I/usr/include/libpng12 -I. -Iinclude -I/usr/local/include -g -O2 -fpic -g -O2 -c svg-backend.c -o svg-backend.o
gcc -std=gnu99 -I/home/username/R3/lib64/R/include -DNDEBUG -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/fontconfig -I/usr/include/libpng12 -I. -Iinclude -I/usr/local/include -g -O2 -fpic -g -O2 -c w32-backend.c -o w32-backend.o
gcc -std=gnu99 -I/home/username/R3/lib64/R/include -DNDEBUG -I/usr/include/cairo -I/usr/include/freetype2 -I/usr/include/pixman-1 -I/usr/include/fontconfig -I/usr/include/libpng12 -I. -Iinclude -I/usr/local/include -g -O2 -fpic -g -O2 -c xlib-backend.c -o xlib-backend.o
gcc -std=gnu99 -shared -L/home/username/R3/lib64/R/lib -L/usr/local/lib64 -o Cairo.so cairobem.o cairogd.o cairotalk.o img-backend.o img-jpeg.o img-tiff.o pdf-backend.o ps-backend.o svg-backend.o w32-backend.o xlib-backend.o -L/usr/lib64 -lcairo -lfreetype -lpixman-1 -lfontconfig -lpng12 -lz -lXrender -lX11 -L/home/username/R3/lib64/R/lib -lR
/usr/lib64/gcc/x86_64-suse-linux/4.3/../../../../x86_64-suse-linux/bin/ld: /usr/lib64/libcairo.a(cairo.o): relocation R_X86_64_32 against `_cairo_pattern_nil' can not be used when making a shared object; recompile with -fPIC
/usr/lib64/libcairo.a: error adding symbols: Bad value
collect2: ld returned 1 exit status
make: *** [Cairo.so] Error 1
ERROR: compilation failed for package ‘Cairo’
* removing ‘/home/username/R3/lib64/R/library/Cairo’
Warning message:
In install.packages("/home/username/R_packages/Cairo_1.5-9.tar.gz", :
installation of package ‘/home/username/R_packages/Cairo_1.5-9.tar.gz’ had non-zero exit status
うまくいけば、専門家をコンパイルするいくつかのgcc/LD/Rは、間違っているものを私に伝えることができ、私はこの問題を解決することができますか。
おかげで、BadTenMan
あなたのenvの最後の行で、 '-lcairo'を削除してみてください。 – dlmeetei
これは動作しません、エラー: 構成:CAIRO_LIBS = -L/usr/lib64 -lfreetype -lpixman-1 -lfontconfig -lpng12 -lx -lXrender -lX11 deflateを含むライブラリのチェック...なしが必要です カイロプログラムをコンパイルすることができます... configure:error:単純なCairoプログラムをコンパイルできません。詳細については、config.logを参照してください。 エラー: 'Cairo'パッケージのコンフィグレーションに失敗しました これは必須です。 – BadTenMan