Can't build gem -- native extension build fails -- can you see why? - webrat

I can't figure out what is going wrong here -- any ideas??
I'm running on a Ubuntu 8.04 LTS, and have installed libxml2 and libxslt from these instructions:
http://www.techsww.com/tutorials/libraries/libxml/installation/installing_libxml_on_ubuntu_linux.php
http://www.techsww.com/tutorials/libraries/libxslt/installation/installing_libxslt_on_ubuntu_linux.php
However, I installed the latest versions:
libxslt-1.1.24
libxml2-2.7.3
The install was uneventful
-------------------- I set LD_LIBRARY_PATH ----------------------------------
echo $LD_LIBRARY_PATH
/usr/local/libxslt/lib:
------------- seems like the function is present -- at least based on the output of strings ------------
/usr/local/libxslt/lib$ strings * | grep ParseStylesheetDoc
xsltParseStylesheetDoc
xsltParseStylesheetDoc
xsltParseStylesheetDoc
xsltParseStylesheetDoc
xsltParseStylesheetDoc
xsltParseStylesheetDoc
xsltParseStylesheetDoc
----------------------- But the compile still fails ----------------------------------------
sudo gem install webrat
Building native extensions. This could take a while...
ERROR: Error installing webrat:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb install webrat
checking for iconv.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2... yes
checking for libxml/parser.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2... yes
checking for libxslt/xslt.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2... yes
checking for libexslt/exslt.h in /opt/local/include/,/opt/local/include/libxml2,/opt/local/include,/opt/local/include,/opt/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/local/include,/usr/local/include/libxml2,/usr/include,/usr/include/libxml2... yes
checking for xmlParseDoc() in -lxml2... yes
checking for xsltParseStylesheetDoc() in -lxslt... no
libxslt is missing. try 'port install libxslt' or 'yum install libxslt-devel'
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/local/bin/ruby
--with-iconv-dir
--without-iconv-dir
--with-iconv-include
--without-iconv-include=${iconv-dir}/include
--with-iconv-lib
--without-iconv-lib=${iconv-dir}/lib
--with-xml2-dir
--without-xml2-dir
--with-xml2-include
--without-xml2-include=${xml2-dir}/include
--with-xml2-lib
--without-xml2-lib=${xml2-dir}/lib
--with-xslt-dir
--without-xslt-dir
--with-xslt-include
--without-xslt-include=${xslt-dir}/include
--with-xslt-lib
--without-xslt-lib=${xslt-dir}/lib
--with-xml2lib
--without-xml2lib
--with-xsltlib
--without-xsltlib
Gem files will remain installed in /usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.3.3 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.8/gems/nokogiri-1.3.3/ext/nokogiri/gem_make.out

In Ubuntu you need to follow these steps:
sudo apt-get install libxml2-dev
sudo apt-get install libxslt-dev

Jared Evans in this post on his blog, described a solution that worked for me on Ubuntu 8.04 LTS. His trick is to NOT use apt-get to install rubygems, but rather to build it from source. This worked great for me. His post is directed at installing rails, so I used these (modified slightly) steps from it to just install nokogiri:
FIRST INSTALL RUBY WITH APT-GET:
sudo apt-get update
sudo apt-get install ruby irb ri rdoc ruby1.8-dev libzlib-ruby
libyaml-ruby libreadline-ruby libncurses-ruby libcurses-ruby libruby
libruby-extras libfcgi-ruby1.8 build-essential libopenssl-ruby
libdbm-ruby libdbi-ruby libdbd-sqlite3-ruby sqlite3 libsqlite3-dev
libsqlite3-ruby libxml-ruby libxml2-dev
IN ADDITION TO JARED'S INSTRUCTIONS I ALSO INSTALLED (I'm not certain that libxslt1.1 is necessary):
sudo apt-get install libxslt1.1
sudo apt-get install libxslt1-dev
DOWNLOAD RUBYGEMS SOURCE:
Download the latest RubyGems (currently 1.3.6) from rubyforge (I used the zip package).
BUILD RUBYGEMS:
cd /TO/DIRECTORY/WHERE/YOU/UNZIPPED/rubygems-1.3.6/
sudo ruby setup.rb
sudo ln -s /usr/bin/gem1.8 /usr/bin/gem
INSTALL NOKOGIRI:
sudo gem update –system
sudo gem install nokogiri
The response will be:
1 gem installed
Installing ri documentation for nokogiri-1.4.1...
No definition for parse_memory
No definition for parse_file
No definition for parse_with
No definition for get_options
No definition for set_options
Installing RDoc documentation for nokogiri-1.4.1...
No definition for parse_memory
No definition for parse_file
No definition for parse_with
No definition for get_options
No definition for set_options
I haven't yet noticed any problems caused by the 'No definition' messages...

Try removing the libxslt* and install them again. That fixed the issue for me.

You have to install the development kits of these libraries.

I get the same error when trying to install to a non-standard location (as I don't have access to directories outside my home directory). It seems as if this answer simply installed to the default location in /usr for success. Or did I misunderstand?
More context about what I'm trying to do at http://groups.google.com/group/nokogiri-talk/browse_thread/thread/c1e909be09e90f5a, if that's helpful.

Here's what worked for me on Ubuntu 11.04 (natty):
sudo apt-get install libxslt-dev libxml2-dev
sudo gem install nokogiri

Related

Regarding to installation of Gsreamer 1.8.0 in ubuntu

Can any one give me the proper guidelines for gstreamer(1.8.0) installation in Ubuntu version 16.04??
Through command line
For installing gstreamer1.0 you can use:
sudo apt-get install libgstreamer1.0-* gstreamer1.0-tools gstreamer1.0-libav*
Depending on what are your needs, you probably are going to need other modules that are not installed in the previous command. I would consider adding:
gst-plugins-base
gst-plugins-good
gst-plugins-bad
gst-plugins-ugly
Using next command:
sudo apt-get install gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-plugins-ugly
After you have installed all the plugins you can verify the installation using:
gst-inspect-1.0

flask-mysqldb support for Python 3.6? [duplicate]

I am trying to get a Python script to run on the linux server I'm connected to via ssh. The script uses mysqldb. I have all the other components I need, but when I try to install mySQLdb via setuptools like so:,
python setup.py install
I get the following error report related to the mysql_config command.
sh: mysql_config: command not found
Traceback (most recent call last):
File "setup.py", line 15, in <module>
metadata, options = get_config()
File "/usr/lib/python2.5/MySQL-python-1.2.3/setup_posix.py", line 43, in get_config
libs = mysql_config("libs_r")
File "/usr/lib/python2.5/MySQL-python-1.2.3/setup_posix.py", line 24, in mysql_config
raise EnvironmentError("%s not found" % (mysql_config.path,))
EnvironmentError: mysql_config not found
Has anyone else encountered this error and if so how did you resolve it/what can I do to successfully install mysqldb?
mySQLdb is a python interface for mysql, but it is not mysql itself. And apparently mySQLdb needs the command 'mysql_config', so you need to install that first.
Can you confirm that you did or did not install mysql itself, by running "mysql" from the shell? That should give you a response other than "mysql: command not found".
Which linux distribution are you using? Mysql is pre-packaged for most linux distributions. For example, for debian / ubuntu, installing mysql is as easy as
sudo apt-get install mysql-server
mysql-config is in a different package, which can be installed from (again, assuming debian / ubuntu):
sudo apt-get install libmysqlclient-dev
if you are using mariadb, the drop in replacement for mysql, then run
sudo apt-get install libmariadbclient-dev
Reference:
https://github.com/JudgeGirl/Judge-sender/issues/4#issuecomment-186542797
I was installing python-mysql on Ubuntu 12.04 using
pip install mysql-python
First I had the same problem:
Not Found "mysql_config"
This worked for me
$ sudo apt-get install libmysqlclient-dev
Then I had this problem:
...
_mysql.c:29:20: error fatal: Python.h: No existe el archivo o el directorio
compilación terminada.
error: command 'gcc' failed with exit status 1
Then I tried with
apt-get install python-dev
(If you're using python3, install python3-dev instead.)
And then I was happy :)
pip install mysql-python
Installing collected packages: mysql-python
Running setup.py install for mysql-python
building '_mysql' extension
gcc -pthread -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fPIC -Dversion_info=(1,2,4,'beta',4) -D__version__=1.2.4b4 -I/usr/include/mysql -I/usr/include/python2.7 -c _mysql.c -o build/temp.linux-x86_64-2.7/_mysql.o -DBIG_JOINS=1 -fno-strict-aliasing -g
In file included from _mysql.c:44:0:
/usr/include/mysql/my_config.h:422:0: aviso: se redefinió "HAVE_WCSCOLL" [activado por defecto]
/usr/include/python2.7/pyconfig.h:890:0: nota: esta es la ubicación de la definición previa
gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-Bsymbolic-functions -Wl,-z,relro build/temp.linux-x86_64-2.7/_mysql.o -L/usr/lib/x86_64-linux-gnu -lmysqlclient_r -lpthread -lz -lm -lrt -ldl -o build/lib.linux-x86_64-2.7/_mysql.so
Successfully installed mysql-python
Cleaning up...
(Specific to Mac OS X)
I have tried a lot of things, but these set of commands finally worked for me.
Install mysql
brew install mysql
brew unlink mysql
brew install mysql-connector-c
Add the mysql bin folder to PATH
export PATH=/usr/local/Cellar/mysql/8.0.11/bin:$PATH
mkdir /usr/local/Cellar/lib/
Create a symlink
sudo ln -s /usr/local/Cellar/mysql/8.0.11/lib/libmysqlclient.21.dylib /usr/local/Cellar/lib/libmysqlclient.21.dylib
brew reinstall openssl (source)
Finally, install mysql-client
LIBRARY_PATH=$LIBRARY_PATH:/usr/local/opt/openssl/lib/ pip install mysqlclient
Update:
In case this doesn't work, #vinyll suggests to run brew link mysql before step 8.
On Red Hat I had to do
sudo yum install mysql-devel gcc gcc-devel python-devel
sudo easy_install mysql-python
Then it worked.
On python 3.5.2 + any future version
sudo apt-get install libmysqlclient-dev python-dev
The below worked for me on Ubuntu 12.04 LTS:
apt-get install libmysqlclient-dev python-dev
All though it worked, i still went ahead to do the below:
export PATH=$PATH:/usr/local/mysql/bin/
I got the same error while trying to install mysql-python.
This is how I fixed it.
sudo PATH=/usr/local/mysql/bin/:$PATH pip install mysql-python
The problem was that the installer could not find the mysql_config in the default path. Now it can ..and it worked..
15 warnings generated.
clang -bundle -undefined dynamic_lookup -Wl,-F. build/temp.macosx-10.8-intel-2.7/_mysql.o -L/usr/local/mysql/lib -lmysqlclient_r -lz -lm -lmygcc -o build/lib.macosx-10.8-intel-2.7/_mysql.so -arch x86_64
Successfully installed mysql-python
Cleaning up...
Hope this helps.
Thanks.
I fixed this problem with the following steps:
sudo apt-get install libmysqlclient-dev
sudo apt-get install python-dev
sudo python setup.py install
The commands (mysql too) mPATH might be missing.
export PATH=$PATH:/usr/local/mysql/bin/
Step1:-Install Python3 & Python3-dev Both
sudo apt-get install python3 python3-dev
Step2:- Install Python & Mysql Connector
sudo apt-get install libmysqlclient-dev
step3:- Install python mysql client
sudo apt-get install mysqlclient
This will Solve your Problem
The package libmysqlclient-dev is deprecated, so use the below command to fix it.
Package libmysqlclient-dev is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source
sudo apt-get install default-libmysqlclient-dev
I think the most convenient way to solve this problem in 2020 is using another python package. We don't need install any other binary software.
Try this
pip install mysql-connector-python
and then
import mysql.connector
mydb = mysql.connector.connect(
host="",
user="",
passwd="",
database=""
)
cursor = mydb.cursor( buffered=True)
cursor.execute('show tables;')
cursor.execute('insert into test values (null, "a",10)')
mydb.commit()
mydb.disconnect()
If you're on macOS and already installed mysql#5.7 via brew install:
brew install mysql-connector-c
brew unlink mysql#5.7
brew link --overwrite --dry-run mysql#5.7 first, to see what symlinks are getting overwritten
brew link --overwrite --force mysql#5.7 to actually overwrite mysql-related symlinks with mysql#5.7
pip install mysqlclient
I fixed it by installing libmysqlclient:
sudo apt-get install libmysqlclient16-dev
In centos 7 this works for me :
yum install mariadb-devel
pip install mysqlclient
The MySQL-python package is using the mysql_config command to learn about the mysql configuration on your host. Your host does not have the mysql_config command.
The MySQL development libraries package (MySQL-devel-xxx) from dev.mysql.com provides this command and the libraries needed by the MySQL-python package. The MySQL-devel packages are found in the download - community server area. The MySQL development library package names start with MySQL-devel and vary based MySQL version and linux platform (e.g. MySQL-devel-5.5.24-1.linux2.6.x86_64.rpm.)
Note that you do not need to install mysql server.
For Alpine Linux:
$ apk add mariadb-dev mariadb-client mariadb-libs
MariaDB is a drop-in replacement for MySQL and became the new standard as of Alpine 3.2. See https://bugs.alpinelinux.org/issues/4264
On my Fedora 23 machine I had to run the following:
sudo dnf install mysql-devel
In CentOS 7 , the following things should be done:
#step1:install mysql
https://dev.mysql.com/doc/mysql-yum-repo-quick-guide/en/
#step2:
sudo yum install mysql-devel
or
sudo yum install mysql-community-devel
I think, following lines can be executed on terminal
sudo ln -s /usr/local/zend/mysql/bin/mysql_config /usr/sbin/
This mysql_config directory is for zend server on MacOSx. You can do it for linux like following lines
sudo ln -s /usr/local/mysql/bin/mysql_config /usr/sbin/
This is default linux mysql directory.
I had this issues and solved if by adding a symlink to mysql_config.
I had installed mysql with homebrew and saw this in the output.
Error: The `brew link` step did not complete successfully
Depending on how you got mysql it will be in different places. In my case /usr/local/Cellar/mysql
Once you know where it is you should be able to ma a symbolic link to where python is looking for it. /usr/local/mysql
This worked for me.
ln -s /usr/local/Cellar/mysql/<< VERSION >>/bin/mysql_config /usr/local/mysql/bin/mysql_config
I had the same problem. I solved it by following this tutorial to install Python with python3-dev on Ubuntu 16.04:
sudo apt-get update
sudo apt-get -y upgrade
sudo apt-get install -y python3-pip
sudo apt-get install build-essential libssl-dev libffi-dev python3-dev
And now you can set up your virtual environment:
sudo apt-get install -y python3-venv
pyvenv my_env
source my_env/bin/activate
also, i fetch the same problem
I fixed this problem with the following steps:
First I run this command
sudo apt-get install libmysqlclient-dev
then I install
pip install mysqlclient==2.1.0
this is worked for me
You need to install the python-dev package:
sudo apt-get install python-dev
sudo apt-get install python-mysqldb
Python 2.5? Sounds like you are using a very old version of Ubuntu Server (Hardy 8.04?) - please confirm which Linux version the server uses.
python-mysql search on ubuntu package database
Some additional info:
From the README of mysql-python -
Red Hat Linux
.............
MySQL-python is pre-packaged in Red Hat Linux 7.x and newer. This
includes Fedora Core and Red Hat Enterprise Linux. You can also
build your own RPM packages as described above.
Debian GNU/Linux
................
Packaged as python-mysqldb_::
# apt-get install python-mysqldb
Or use Synaptic.
.. _python-mysqldb: http://packages.debian.org/python-mysqldb
Ubuntu
......
Same as with Debian.
Footnote: If you really are using a server distribution older than Ubuntu 10.04 then you are out of official support, and should upgrade sooner rather than later.
This method is only for those who know that Mysql is installed but still mysql_config can't be find. This happens if python install can't find mysql_config in your system path, which mostly happens if you have done the installation via .dmg Mac Package or installed at some custom path. The easiest and documented way by MySqlDB is to change the site.cfg. Find the mysql_config which is probably in /usr/local/mysql/bin/ and change the variable namely mysql_config just like below and run the installation again. Don't forget to un-comment it by removing "#"
Change below line
"#mysql_config = /usr/local/bin/mysql_config"
to
"mysql_config = /usr/local/mysql/bin/mysql_config"
depending upon the path in your system.
By the way I used python install after changing the site.cfg
sudo /System/Library/Frameworks/Python.framework/Versions/2.7/bin/python setup.py install
So far, all solutions (Linux) require sudo or root rights to install .
Here is a solution if you do not have root rights and without sudo. (no sudo apt install ...):
Download the .deb file of the libmysqlclient-dev, e.g. from this mirror
Navigate to the downloaded file and run dpkg -x libmysqlclient-dev_<version tag>.deb . This will extract a folder called usr.
Symlink ./usr/bin/mysql_config to somewhere that is found on your $PATH:
ln -s `pwd` /usr/bin/mysql_config FOLDER_IN_YOUR_PATH
It should now be able to find mysql_config
Tested on Ubuntu 18.04.
For macOS Mojave , additional configuration was required, for compilers to find openssl you may need to set:
export LDFLAGS="-L/usr/local/opt/openssl/lib"
export CPPFLAGS="-I/usr/local/opt/openssl/include"
I encountered the same problem, just added the path where *mysql_config* resided to the environment variable PATH and it worked for me.
sudo apt-get build-dep python-mysqldb will install all the dependencies to build the package from PIP/easy_install

(ONIE) stg: command not found and Error 127 in Ubuntu terminal

I was trying to follow this guide: https://github.com/opencomputeproject/onie/blob/master/machine/kvm_x86_64/INSTALL but have gotten stuck.
On this line: make MACHINE=kvm_x86_64 all, I get stg: command not found when it is trying to apply a patch. I get Error 127 on a make command. Here's the output:
I have g++ and git installed. What am I doing wrong?
From the ONIE project wiki Building ONIE:
For a Debian-based system, a Makefile target exists that installs the required packages on your build machine. The ONIE project will maintain this target for the current stable version of Debian. This target requires the use of sudo(8), since package installation requires root privileges:
$ cd build-config
$ sudo apt-get update
$ sudo apt-get install build-essential
$ make debian-prepare-build-host
I built this on Ubuntu Desktop 15.04. For anyone else trying to build ONIE virtual machine, install these packages first:
Packages
qemu-kvm
git
stg
gperf
bison
flex
autoconf
texinfo
gawk
libtool
libtool-bin
libncurses5-dev
libexpat1
libexpat1-dev
python2.7-dev
python3.4-dev
xorriso
You can install most of these with sudo apt-get install <package>. You should be able to follow the ONIE guide now and set it up. Thanks to EtanReisner for all the help!
On Ubuntu, install stg package by,
sudo apt-get install stgit
the error stg: command not found should be resolved.

Error installing charlock_holmes : Error installing GITLAB

I am trying to install GITLAB. I get this error executing "sudo gem install charlock_holmes --version '0.6.9'" (section Install Gems)
GEOGIT:/geogit/Administrative_Tools # sudo gem install charlock_holmes --version '0.6.9'
Building native extensions. This could take a while...
ERROR: Error installing charlock_holmes:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9 extconf.rb
checking for main() in -licui18n... no
which: no brew in (/usr/sbin:/bin:/usr/bin:/sbin)
checking for main() in -licui18n... no
***************************************************************************************
*********** icu required (brew install icu4c or apt-get install libicu-dev) ***********
***************************************************************************************
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers. Check the mkmf.log file for more
details. You may need configuration options.
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/usr/bin/ruby1.9
--with-icu-dir
--without-icu-dir
--with-icu-include
--without-icu-include=${icu-dir}/include
--with-icu-lib
--without-icu-lib=${icu-dir}/
--with-icui18nlib
--without-icui18nlib
--with-icui18nlib
--without-icui18nlib
Gem files will remain installed in /usr/lib64/ruby/gems/1.9.1/gems/charlock_holmes-0.6.9 for inspection.
Results logged to /usr/lib64/ruby/gems/1.9.1/gems/charlock_holmes-0.6.9/ext/charlock_holmes/gem_make.out
Someone, can help me debug those logs and error?
This looks like issue 1952
It was actually weirdness with the way my ubuntu VPS is commissioned. Mine did not come with a C compiler or libdev obviously.
The problem fix I found was to install libdev first, then the GCC
Then apt-get install libicu-dev.
Update 2015: additional comments include:
yum install libicu-devel worked for me
You just need to make sure "patch" is installed (yum install patch) then it should work
For MacOS install the following dependency:
brew install icu4c
According to the documentation (https://github.com/gitlabhq/gitlabhq/blob/master/doc/install/installation.md) the package libicu-dev is required
Install it with "apt-get install libicu-dev" and then charlock_holmes could be installed
I used "yum install libicu-devel" and then I could install charlock_holmes
I got the same mistake on a Centos 5.4 server, the yum repository only have the icu version 3.6, so i have to search and install manually the library icu 4.2 which solve the problem. In case someone else need to know how to do it, i recommend to check this link http://source.icu-project.org/repos/icu/icu/tags/release-4-2-1/readme.html#HowToBuildUNIX
I had kind of the same problem: when I was trying to install charlock_holmes gem, I had this error:
charlock_holmes-0.7.3/mkmf.log
have_library: checking for main() in -licui18n... -------------------- no
I fixed it by running the first command of #VonC:
sudo apt-get install libicu-dev
Hope I helped someone!

Error: gdal-config not found while installing R dependent packages whereas gdal is installed

Please point out the point that I am missing:
openSUSE 11.3
xx#linux-y3pi:~/Desktop/R> sudo R CMD INSTALL rgdal_0.7-12.tar.gz
root's password:
* installing to library ‘/usr/lib64/R/library’
* installing *source* package ‘rgdal’ ...
** package ‘rgdal’ successfully unpacked and MD5 sums checked
configure: gdal-config: gdal-config
checking gdal-config usability... ./configure: line 1353: gdal-config: command not found
no
Error: gdal-config not found
The gdal-config script distributed with GDAL could not be found.
If you have not installed the GDAL libraries, you can
download the source from http://www.gdal.org/
If you have installed the GDAL libraries, then make sure that
gdal-config is in your path. Try typing gdal-config at a
shell prompt and see if it runs. If not, use:
--configure-args='--with-gdal-config=/usr/local/bin/gdal-config'
with appropriate values for your installation.
ERROR: configuration failed for package ‘rgdal’
* removing ‘/usr/lib64/R/library/rgdal’
xx#linux-y3pi:~/Desktop/R> whereis gdal-config
gdal-config: /usr/local/bin/gdal-config
xx#linux-y3pi:~/Desktop/R> gdal-config
Usage: gdal-config [OPTIONS]
Options:
[--prefix[=DIR]]
[--libs]
[--dep-libs]
[--cflags]
[--datadir]
[--version]
[--ogr-enabled]
[--formats]
xx#linux-y3pi:~/Desktop/R>
> sessionInfo()
R version 2.15.1 (2012-06-22)
Platform: x86_64-unknown-linux-gnu (64-bit)
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=C 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
>
xx#linux-y3pi:~/Desktop/R> gdal-config --version
1.9.0
xx#linux-y3pi:~/Desktop/R> proj
Rel. 4.8.0, 6 March 2012
usage: proj [ -beEfiIlormsStTvVwW [args] ] [ +opts[=arg] ] [ files ]
linux-y3pi:~ # $PATH
bash: /home/xx/qtsdk-2010.05/qt/bin/:/home/xx/qtsdk-2010.05/bin:/home/xx/qtsdk-2010.05/qt/bin:/home/xx/qtsdk-2010.05/qt/bin/:/home/xx/qtsdk-2010.05/bin:/usr/lib64/mpi/gcc/openmpi/bin:/home/xx/bin:/usr/local/bin:/usr/bin:/sbin:/usr/sbin:/bin:/usr/bin/X11:/usr/X11R6/bin:/usr/games: No such file or directory
In Ubuntu 18.04
I fixed this by sudo apt install libgdal-dev
Hope someone find this helpful. Some above answers seems to be outdated and lengthy.
In earlier versions (which had apt-get)
sudo apt-get install libgdal-dev
You need the -dev package with headers and shared library links for development besides the normal package for deployment. Two different use cases as far as the distro is concerned.
On my distribution:
edd#max:/tmp$ dpkg -l | grep gdal | cut -c-72
ii libgdal1-1.7.0 1.7.3-6ubuntu3
ii libgdal1-dev 1.7.3-6ubuntu3
edd#max:/tmp$
and R CMD INSTALL rgdal_0.7-8.tar.gz works just fine as you would expect from a CRAN package given all the build-time checks at CRAN.
Update late 2016: As #JoshO'Brien points out in the comment
Minor update: Here in 2016, running Ubuntu 14.04.2, libgdal1h seems to
have replaced libgdal1(though libgdal1-dev is still needed). At least
I get an error to that effect when I attempted to apt-get install libgdal1
For Ubuntu 16.04 the corresponding line would be
sudo apt-get install libgdal1i
Such renaming of upstream libraries is common; something such as apt-cache search libgdal can help locate the current package names. The important key though is that the "abstract" development package libgdal-dev is all that is needed to build as it pulls the "concrete" current run-time package (here: libgdal1i) in via a dependency.
You can use apt-file package, to find which package contains the missing file you are looking for.
First install the apt-file using the command apt-get install apt-file Update apt-file using the command apt-file update Now you can use apt-file to find the missing file. apt-file search gdal-config
For my case, I got the same error when configuring grass-7.1 from svn. As shown below:
$ ./configure
...more...
checking whether to use GDAL... yes
checking for gdal-config... /usr/bin/gdal-config
...more....
./configure: 1: ./configure: /usr/bin/gdal-config: not found
./configure: 6093: test: =: unexpected operator
configure: error: *** Unable to locate GDAL library.
But, after looking for gdal-config file with apt-file as shown below, I was able to resolve the error, after installing the package libgdal1-dev
$ apt-file search gdal-config
Results
libgdal1-dev: /usr/bin/gdal-config
So I installed libgdal1-dev, as shown below:
$ sudo apt-get install libgdal1-dev
This happens because the configuration failed for package ‘rgdal’
so we have to install necessary dependencies.
The packages libgdal-dev and libproj-dev are required:
sudo apt-get install gdal-bin proj-bin libgdal-dev libproj-dev
Then install rgdal by
install.packages("rgdal")
Load rgdal by
library(rgdal)
On macOS
brew install gdal
removed the error
gdal-config not found
Try this on CentOS 6
sudo yum install gdal gdal-python gdal-devel mapserver mapserver-python libxml2 libxml2-python python-lxml python-pip python-devel gcc
Read the reference manual.
SystemRequirements for building from source: GDAL >= 1.6.0 library
from http://trac.osgeo.org/gdal/wiki/DownloadSource and PROJ.4 (proj
>= 4.4.9) from http://trac.osgeo.org/proj/;
The same problem occurred today to me on a Linux CentOS 6.10 on which I do not have administration rights.
What I did:
a) Create a conda environment dedicated to my R version
conda create --name MYR
b) Activate the environment
source activate MYR
c) Install R
conda install -c conda-forge r-base
d) Install libgdal
conda install -c conda-forge libgdal
This solved the problem for me. My R version was 4.1.3. I guess other versions should work.
For manjora or archlinux, just try:
yay -S gdal

Resources