On my mac OS X machine Darwin maci 15.6.0 Darwin Kernel Version 15.6.0
I have installed libxml2 and libxslt in following custom directory
/usr/local/MyLibs/libxml2-2.9.2
and libxslt
/usr/local/MyLibs/libxslt-1.1.29
Now I want to use these libs to build my CPANM module XML::LibXSLT.
This tells me that I can do so using --configure-args (its still experimental). So I do something like,
cpanm http://search.cpan.org/CPAN/authors/id/S/SH/SHLOMIF/XML-LibXSLT-1.94.tar.gz --configure-args="--cflags=-I/usr/local/libxslt-1.1.29/include -I/usr/include/libxml2 -I/usr/local/MyLibs/libxml2-2.9.2/include/libxml2 --libs=-L/usr/local/libxslt-1.1.29/lib -lxslt -lxml2 -lz -lpthread -licucore -lm -L/usr/local/MyLibs/libxml2-2.9.2/lib -lxml2 -lz -lpthread -liconv -lm" --force
However, the build log says that it did not use the libraries installed in my custom location.
Is there something that I am not doing correctly?
From the distro's README,
The Makefile.PL tries to determine the correct compiler and linker
flags for its library dependencies using pkg-config and
xslt-config. If this fails, you may override the values like this
perl Makefile.PL INC="..." LIBS="..."
where INC contains flags for the compiler (such as -I/some_path/include etc.) and LIBS contains linker flags (such as -L/some_path/lib -llibsomething ...).
It might be simpler to forgo cpanm and install the module yourself.
curl -L -o - http://search.cpan.org/CPAN/authors/id/S/SH/SHLOMIF/XML-LibXSLT-1.95.tar.gz | tar xz
cd XML-LibXSLT-1.95
perl Makefile.PL INC="..." LIBS="..."
make test
make install
I think you were missing quotes around the --cflags argument (needed in order to group multiple space-separated arguments together):
--configure-args="--cflags='-I/usr/local/libxslt-1.1.29/include -I/usr/include/libxml2 -I/usr/local/MyLibs/libxml2-2.9.2/include/libxml2'"
However --cflags and --libs are just examples from the cpanm documentation, and might not even be recognized by a distribution's Makefile.PL. As the other answer points out, the arguments to use for XML::LibXSLT are INC="…" and LIBS="…"; I think providing those to cpanm's --configure-args should work:
cpanm --configure-args="INC='…' LIBS='…'"
Related
I am trying to install a perl module Bio::DB::Sam on my home directory on a remote server.
I downloaded the module, extracted the files, and ran:
perl Build.pl prefix=~/local
this is what happens next:
This module requires samtools 0.1.10 or higher (samtools.sourceforge.net).
Please enter the location of the bam.h and compiled libbam.a files: **/some_places/samtools-0.1.19**
Found /some_places/samtools-0.1.19/bam.h and /some_places/samtools-0.1.19/libbam.a.
Created MYMETA.yml and MYMETA.json
Creating new 'Build' script for 'Bio-SamTools' version '1.39'
Next when I try to run:
./Build
this is what I get:
Building Bio-SamTools
gcc -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic -o blib/arch/auto/Bio/DB/Sam/Sam.so lib/Bio/DB/Sam.o c_bin/bam2bedgraph.o -L/some_places/samtools-0.1.19 -lbam -lpthread -lz
/usr/bin/ld: /some_places/samtools-0.1.19/libbam.a(bgzf.o): relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/some_places/samtools-0.1.19/libbam.a: could not read symbols: Bad value
collect2: ld returned 1 exit status
error building blib/arch/auto/Bio/DB/Sam/Sam.so from lib/Bio/DB/Sam.o c_bin/bam2bedgraph.o at ~/perl5/lib/perl5/ExtUtils/CBuilder/Base.pm line 323.
I did google the possible solutions and tried a couple, but they didn't work, e.g. --enable-shared OR export CXXFLAGS="$CXXFLAGS -fPIC".
I have already have Bioperl installed on my home directory.
Any help would be appreciated.
Cheers
Here is a script that will fetch the SAMtools source and compile it, then fetch and compile the Perl bindings.
wget http://sourceforge.net/projects/samtools/files/samtools/0.1.18/samtools-0.1.18.tar.bz2
tar xjf samtools-0.1.18.tar.bz2 && cd samtools-0.1.18
make CFLAGS=-fPIC
export SAMTOOLS=`pwd`
cpanm Bio::DB::Sam
Part of the problem you were likely seeing is that the SAMtools project has recently undergone some major code reorganization (and this has naturally made it difficult to work with external language bindings).
I fixed this issue by remaking samtools with the -fPIC parameter
make clean
make CXXFLAGS=-fPIC CFLAGS=-fPIC CPPFLAGS=-fPIC
then installed using cpan.
cpan[2]> install Bio::DB::Sam
[Solved]
wget http://sourceforge.net/projects/samtools/files/samtools/0.1.18/samtools-0.1.18.tar.bz2
tar xjf samtools-0.1.18.tar.bz2 && cd samtools-0.1.18
make CFLAGS=-fPIC
enter cpan in terminal and enter
install Bio::DB::Sam
Be carefully:
You can not use the following command:
perl -MCPAN -Mlocal::lib -e 'CPAN::install(Bio::DB::Sam)'
You can only use cpan and then use
install Bio::DB::Sam
I followed instructions from README file below of Bio-SamTools-1.43 to edit the Makefile in samtools 0.1.17. Then, to install, I used
perl -MCPAN -e shell
install Bio::DB::Sam
README:
This is a Perl interface to the SAMtools sequence alignment
interface. It ONLY works on versions of Samtools up to 0.1.17. It does
not work on version 1.0 or higher due to major changes in the library
structure.
See http://samtools.sourceforge.net/ for samtools documentation.
ONE-STEP INSTALLATION
In the root directory of this distribution you will find the script
INSTALL.pl. Running this will download the latest versions of this
module and SamTools into a temporary directory, compile them, test and
install. Simply run:
perl INSTALL.pl
MULTI-STEP INSTALLATION
The more traditional install requires you to separately download,
unpack and compile SAMtools 0.1.10 through 0.1.17 in some accessible
directory. Typing "make" in the samtools directory will usually
work. SAMtools versions 0.1.18 and higher do not work with this
library.
Then set the environment variable SAMTOOLS to point to this directory.
You will also need to install Bio::Perl from CPAN.
Now run:
perl Build.PL
./Build
./Build test
(sudo) ./Build install
TROUBLESHOOTING:
If you encounter problems during compiling, you may need to edit
Build.PL so that extra_compiler_flags matches the CFLAGS and DFLAGS
settings in the Samtools Makefile. Here are some common problems:
When building this module, you get an error like the following:
relocation R_X86_64_32 against `a local symbol' can not be used when
making a shared object; recompile with -fPIC
To fix this, edit the Makefile in the Samtools distribution by adding
"-fPIC" to the CFLAGS line. While you're at it, you may also wish to
get rid of a bunch of unused variable warnings that appears under
recent versions of gcc. The modified CFLAGS will look like this
CFLAGS= -g -Wall -Wno-unused -Wno-unused-result -O2 -fPIC #-m64 #-arch ppc
Then do "make clean; make" in the Samtools directory to recompile the
library. After this you should be able to build this module without
errors.
When building this module, you get an error about a missing math
library.
To fix this, follow the recipe in (1) except add -m64 to CFLAGS so it
looks like this:
CFLAGS= -g -Wall -O2 -fPIC #-m64 #-arch ppc
TESTING AND CONTRIBUTING:
You can obtain the most recent development version of this module via
its GitHub site at https://github.com/GMOD/GBrowse-Adaptors. Please
feel free to submit bug reports, patches, etc. via GitHub.
AUTHOR:
Lincoln D. Stein
Copyright (c) 2009-2015 Ontario Institute for Cancer Research
This package and its accompanying libraries are free software; you can
redistribute it and/or modify it under the terms of the Artistic
License 2.0, the Apache 2.0 License, or the GNU General Public License
(version 1 or higher). Refer to LICENSE for the full license text.
I get the mongo-c-driver from official website, as follows:
$git https://github.com/mongodb/mongo-c-driver.git
$cd mongo-c-driver
$./autogen.sh
$ make
$ sudo make install
Deal.c:2:19: fatal error: mongo.h: No such file or directory
However,when I run my C file named "Deal.c" like this:
gcc -o Deal Deal.c -l /usr/local/include -L /usr/local/lib -lmongoc
Error:#include "mongo.h"
^ compilation terminated.
My system version: is Ubuntu 13.10
It appears that you are missing the path to the headers as well as the locations of the libraries. One option would be to install to the same prefix that your platform uses, such as:
./configure --prefix=/usr --libdir=/usr/lib64
If that is not an option, then you can update your Makefile to include the proper library and include path as such:
gcc Deal.c -L/usr/local/lib -I/usr/local/include/libmongoc-1.0 -I/usr/local/include/libbson-1.0 -lmongoc-1.0 -lbson-1.0
This will typically be done automatically for you by using pkg-config on Unix'like systems as such:
gcc Deal.c $(pkg-config --cflags --libs libmongoc-1.0)
However, if you install into a non-standard path such as /usr/local, then you will need to let pkg-config know where to find the libmongoc-1.0.pc file, such as:
PKG_CONFIG_PATH=/usr/local/lib/pkgconfig gcc Deal.c $(pkg-config --cflags --libs libmongoc-1.0)
I am installing Perl module XML::LibXSLT, and I am getting the errors shown below.
Writing Makefile for XML::LibXSLT
Writing MYMETA.yml and MYMETA.json
cp LibXSLT.pm blib\lib\XML\LibXSLT.pm
E:\Perl\bin\perl.exe E:\Perl\lib\ExtUtils\xsubpp -typemap E:\Perl\lib\ExtUtils\
typemap -typemap typemap LibXSLT.xs > LibXSLT.xsc && E:\Perl\bin\perl.exe -MExt
Utils::Command -e mv -- LibXSLT.xsc LibXSLT.c
E:\Perl\site\bin\gcc.exe -c -DNDEBUG -DWIN32 -D_CONSOLE -DNO_STRICT -DWIN64
-DCONSERVATIVE -DPERL_TEXTMODE_SCRIPTS -DUSE_SITECUSTOMIZE -DPERL_IMPLICIT_CONTE
XT -DPERL_IMPLICIT_SYS -DUSE_PERLIO -DHASATTRIBUTE -fno-strict-aliasing -mms-bit
fields -O2 -DVERSION=\"1.81\" -DXS_VERSION=\"1.81\" "-IE:\Perl\lib\CO
RE" -DHAVE_BLANK -DHAVE_BLANK -DHAVE_EXSLT LibXSLT.c
LibXSLT.xs:12:32: fatal error: libxslt/xsltconfig.h: No such file or directory
compilation terminated.
dmake.exe: Error code 129, while making 'LibXSLT.o'
SHLOMIF/XML-LibXSLT-1.81.tar.gz
E:\Perl\site\bin\dmake.exe -- NOT OK
Running make test
Can't test without successful make
Running make install
Make had returned bad status, install seems impossible
Any idea to how to rectify this. Please let me know.
Actaully, I am installing this by using
perl -MCPAN -e "CPAN::Shell->force(qw(install XML::LibXSLT));
So, it is getting 'XML-LibXSLT-1.81.tar.gz' automatically and working this with Windows 7.
It would help if you said how you were trying to install the module. Is this cpan or cpanm, or are you doing it manually? It also looks like you're building on a Windows system, is that right?
The immediate problem is that the gcc compiler can't find libxslt/xsltconfig.h. It may be that the download wasn't unpacked correctly, but I see you are trying to build version 1.81 when the latest is 1.82. You should really fetch the latest version before you try to build it.
Sounds like you're missing the headers files for libxslt. Did you install libxslt?
XML::LibXSLT's README:
This module is a fast XSLT library, based on the GNOME libxslt engine
that you can find at http://www.xmlsoft.org/XSLT/
...
A NOTE ON INSTALLATION
The library depends on libxslt. You have to have both the library and
its header files installed (on various Linux/UNIX distributions thay
are usually packaged as libxslt-dev or libxslt-devel). The module can
further make use of libexslt, which is distributed with libxslt, but
on some systems packaged separately. These libraries may have their
own dependencies (usually resolved automatically by the packaging
system).
...
I need to install the Perl PDL library via CPAN as the non-root user.
CPAN for non-root works thanks to this SO question: How can I use CPAN as a non-root user?
Now, PDL depends on the FFTW library. Evidently, my sysadmin has the 32-bit version installed when I require the 64-bit for this machine.
I base this on the following error message during the CPAN install:
gcc -shared -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector --param=ssp-buffer-size=4 -m64 -mtune=generic FFTW.o -o ../../blib/arch/auto/PDL/FFTW/FFTW.so \
-lm -L/lib -L/usr/lib -L/usr/local/lib -L/usr/local/lib64 -L/lib64 -L/usr/lib64 -ldfftw -ldrfftw \
/usr/bin/ld: skipping incompatible /usr/local/lib/libdfftw.a when searching for -ldfftw
/usr/bin/ld: skipping incompatible /usr/local/lib/libdfftw.a when searching for -ldfftw
/usr/bin/ld: cannot find -ldfftw
Now I have successfully installed fftw in $HOME/lib, indeed libdfftw.a.
The problem is I can't get this gcc compilation instance to use that locally installed copy.
I have tried the following:
Setting LD_LIBRARY_PATH in .bash_profile, and yes, exporting it -- No dice.
Following How can I set library and include paths for Makefile.PL for a single installation?, I set o conf makepl_arg in cpan to: LIBS=-L/homedir/lib INC=-I/homedir/include -- Still no dice
I did the same as step 2 but for o conf mbuild_arg --- Again, no dice.
None of these attempts had any effect on the gcc line above; there were no additional paths specified with -L flags.
What else can I try in cpan to get this compilation command to reference my copy of fftw?
Update 1
I should add that before I make any changes, makepl_arg is:
makepl_arg [INSTALLDIRS=site]
Hence, I am setting makepl_arg to:
makepl_arg [INSTALLDIRS=site LIBS=-L/homedir/lib INC=-I/homedir/include]
I am setting these configurations without doing o conf commit to permit experimentation. Should I be commiting these changes?
Update 2
I see that those -L flags in the above gcc line are coming from the makefile, which itself seems to be made by MakeMaker which I presume is reading the file 'Makefile.PL'
The solution was to examine the .cpan/build/PDL-*/ directory.
In it the INSTALL file indicates that the perldl.conf file can be modified to indicate paths to FFTW libs and FFTW include directories.
The process is as follows and can be done after a failed attempt at installing PDL:
Copy the .cpan/build/PDL-*/perldl.conf file to ~/.perldl.conf - notice the . being added before the filename - PDL will look for this file when installing, even under CPAN
Modify FFTW__LIBS and FFTW_INC in ~/.perldl.conf to point to the appropriate locations.
Attempt install of PDL again with CPAN.
A bit confusing that PDL does not adhere to the makepl_arg cpan configuration.
I am trying to install Bugzilla. I don't recall it being so difficult. We have a ubuntu server on the cloud, and at first I attempted to install through the rackspace UI. This didn't work, so I ssh'ed in and actually downloaded the tarball to do it the old-fashioned way.
However, it appears there are three perl modules having install problems. I have tried everything I know to get them to install, and am at a loss. I've tried googling for some answers, but I am either not using the correct terminology or this is truly unique to my situation.
The three offending perl modules failing the checksetup.pl:
/usr/bin/perl install-module.pl DateTime
/usr/bin/perl install-module.pl DateTime::TimeZone
/usr/bin/perl install-module.pl Template
When I attempt to install any of them, they fail miserably, apparently because the cc compiler is not installed (see below). When I checked for a cc package under APT, I could only find gcc. Will that be sufficient, and will I need to alias gcc to cc in order for these installs to work?
/usr/bin/perl /usr/local/share/perl/5.10.1/ExtUtils/xsubpp -typemap /usr/share/perl/5.10/ExtUtils/typemap Stash.xs > Stash.xsc && mv Stash.xsc Stash.c
cc -c -D_REENTRANT -D_GNU_SOURCE -DDEBIAN -fno-strict-aliasing -pipe -fstack-protector -I/usr/local/include -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -O2 -g -DVERSION=\"2.22\" -DXS_VERSION=\"2.22\" -fPIC "-I/usr/lib/perl/5.10/CORE" Stash.c
/bin/sh: cc: not found
make[1]: *** [Stash.o] Error 127
make[1]: Leaving directory `/root/.cpan/build/Template-Toolkit-2.22-xzQg_q/xs'
make: *** [subdirs] Error 2
ABW/Template-Toolkit-2.22.tar.gz
/usr/bin/make -- NOT OK
Skipping test because of notest pragma
Running make install
Make had returned bad status, install seems impossible
You shouldn't compile Perl with one compiler (cc) and then compile modules with another compiler or compiler build (gcc) unless you happen to know their compatible. I find it very hard to believe that Ubuntu provided a Perl built with a compiler they don't provide.
Then there's the issue that you're installing unmanaged modules into a distro-managed Perl. That's... less than ideal.
The simplest solution is probably:
apt-get install \
libdatetime-perl \
libdatetime-timezone-perl \
libtemplate-perl
Another solution is to install a local build of Perl, perhaps using perlbrew.
Personally, I never use the system Perl. It's there for the system's needs first (not mine), and that causes problems. In this case, since the distro does provide the packages you need, it should be fine to just install those packages.
Just Install GCC and then Perl.To install the gcc package in the Debian/Ubuntu Linux distribution, enter the following command in a terminal:
> apt-get install gcc make linux-headers-$(uname -r)
I went ahead and installed the gcc package, and the installs completed. Whew. It has been a long time...