configure.ac not finding dependencies under cygwin - cygwin

I'm using an autoconf/automake configure script on cygwin, and I have the problem that it doesn't fin my dependencies.
For example I do, in my configure.ac:
AC_CHECK_LIB(mp3lame,lame_init,,AC_MSG_ERROR(Required library LAME not found.))
AC_CHECK_HEADER(lame/lame.h,,AC_MSG_ERROR(Headers for LAME not found.))
To find lame. Lame is installed, if I do locate lame.h I find it in /usr/local/include/lame/lame.h. Now, if I set LIBRARY_PATH and INCLUDE_PATH with
export INCLUDE_PATH=/usr/local/include/
export LIBRARY_PATH=/usr/local/lib/
It works as expected. I have installed lame by downloading it and running:
./configure
make
make install
So I would think that it should end up in a "standard enough" path for my configure script to find it. In a similar way, I'm checking for the json parser jansson using:
PKG_CHECK_MODULES(JANSSON,jansson)
And it doesn't find it unless I do:
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig/
Is this a problem with cygwin (I wouldn't think so) or a problem with my configure.ac script?

This is not a problem with cygwin, nor with your configure.ac. It is a "feature" of PKG_CHECK_MODULES and is one of the reasons I recommend against using it. If a configure script generated from a configure.ac that uses PKG_CHECK_MODULES is used, it is necessary that the user set PKG_CONFIG_PATH. The best approach is to use AC_CHECK_LIB instead of PKG_CHECK_MODULES. You are absolutely correct that ./configure && make && make install gives you a standard installation that should work. The problem is that PKG_CHECK_MODULES does not play well with standard installations.

Related

How to provide Qt installation path to configure?

I got a source code from github. It writen by Qt, and I have installed the Qt from the Qt official website. But when I run ./configure. It said error: cannot find QtGui. What can I do? I don't want to install duplicated through the apt-get. I set the LD_LIBRARY_PATH in .zshrc. It's not work.
The usual way is to install dependencies through apt-get. If you install them manually, you need to resolve path issues by your own.
Since you've chosen the dark path, now you need to manually inform configure where your QT include files and libraries are located:
export CPPFLAGS='-I/qt/path/include'
export LDFLAGS='-L/qt/path/lib/'
./configure
One-liner:
env CPPFLAGS='-I/qt/path/include' LDFLAGS='-L/qt/path/lib/' ./configure
More info is here.

Compiler options basic ./configure explanation

recently, i try to compile a gnu wget from source code in cygwin environtment that pop-up error if perl is not found. otherwise, perl is installed both perl and perl5 on /bin/ but the wget is try search perl on /usr/bin. i think i have missed basic ./configure to setup path executable. so my question is basic.
what is it all about options on below:
*
--bindir=DIR
--sbindir=DIR
--libexecdir=DIR
*
Thank you
These options specify directories where a software package being compiled is going to be installed. As far as I remember it doesn't deal with checks performed by configure. Make sure that perl is in $PATH. If nothing helps, try to locate the exact place in the configure script (usually it's robot-generated and not intended for human eyes, but afterall it's a shell script, and anybody can read it) and see what checks exactly are performed to locate perl.
Update: I have checked, the tests corresponding to perl look like this in configure.ac (which essentially is a "source code" for configure):
AC_PATH_PROGS(PERL, [perl5 perl], no)
AC_PATH_PROG(POD2MAN, pod2man, no)
This means that PERL with executable named perl5 or perl (somewhere in $PATH) is checked, and then POD2MAN with executable pod2man. Carefully check the configure output and config.log file and see what tests have failed.
Update2: The third argument of the AC_PATH_PROG and AC_PATH_PROGS is value-if-no-found. Also you may specify the fourth argument, $PATH for this particular check. Make sure that configure gets rebuilt after you changed configure.ac (usually it happens automatically, but may be performed by autoconf explicitly)
what is it all about options on below:
*
--bindir=DIR
--sbindir=DIR
--libexecdir=DIR
The first (bindir), is where binaries will be installed. For wget, that's (on my system) /usr/bin.
The second (sbindir), is where static binaries will be installed. You might set that to /usr/sbin.
The third (libexecdir), is where your runtime libraries are to be installed. That's usually /usr/lib.
In fact, usually you let configure set all three by using --prefix.
./configure --prefix=/usr/local

'Can't find hdf5 library' while installing netCDF4

I am trying to build NetCDF4 from source on MacOSX. When I run ./configure I get the error:
checking for library containing H5Fflush... no
configure: error: Can't find or link to the hdf5 library. Use --disable-netcdf-4, or see config.log for errors.
I installed hdf5 before, and set the environment variables as:
LDFLAGS=-L/opt/local/lib
CPPFLAGS=-I/opt/local/include
In /opt/local/lib I have these files:
libhdf5.8.dylib
libhdf5.a
libhdf5.dylib
libhdf5.settings
libhdf5_cpp.8.dylib
libhdf5_cpp.a
libhdf5_cpp.dylib
libhdf5_hl.8.dylib
libhdf5_hl.a
libhdf5_hl.dylib
libhdf5_hl_cpp.8.dylib
libhdf5_hl_cpp.a
libhdf5_hl_cpp.dylib
And in /opt/local/include I have:
hdf5.h hdf5_hl.h
Why doesn't the configure script find the hdf5 library? I am happy to provide more information if needed!
EDIT:
My ultimate goal is to install netcdf4 for use as a Fortran module. I have tried installing everything through MacPorts, and it seemed to work, but when I tried to use it, the compiler told me that there was no netcdf.mod file, and sure enough there wasn't one to be found anywhere.
It turns out that just typing:
sudo port install netcdf-fortran
only installs the library files, but doesn't create a .mod file, which I guess is needed. So I found out that other people had the same problem, and the advice given was to install it with gcc44, which did create a .mod file, but then my compiler told me that the .mod file was built with a different version of gfortran and it couldn't be used, so that's why I am trying to build it from scratch, but if someone has a faster option, I would be more than happy to try it!
Ok, I finally figured it out.
I reinstalled netcdf-fortran with macports, then the .mod file suddenly appeared, I then had the problem, however, that when running gfortran, it would tell me that netcdf.mod was compiled with a different version of fortran than the one I am using. (Macports uses 4.8), so got gcc48 from macports and am using gfortran-mp-4.8 to compile now and it works.
Still don't know how to build all these things from scratch, but it works now at least!!!
Typically, I see this when there is a downstream dependency that cannot be fulfilled. The test program created by configure is finding libhdf5, but compilation is still failing because it cannot find something like libz or libszip, depending on how your libhdf5 was compiled.
If you check your config.log file and look for the error, it will probably tell you something along the lines of 'unresolved symbol'. This will give a clue as to which library is missing. If it is linking against the statically-built libhdf5, you may need to add the appropriate library usingLDFLAGS.
If you post the relevant portion of your config.log file, we may be able to help sort out what exactly is going wrong.
Sometimes it doesn't work in the configure parameters like
./configure --enable-shared --enable-fortran --enable-netcdf-4
CPPFLAGS=-I$home/apps2/include LDFALGS=-L$home/apps2/lib --prefix=$home/apps2
or doesn't work when export CPPFLAGS=-I$home/apps2/include in the open SHELL.
Maybe you can set the env vars CPPFLAGS and LDFLAGS in the .bashrc file (prior to the first two ways).

How to solve configure checking

Nowdays I'm just trying to build libsamperate from source using MSYS on Windows, but i meet a configure checking problem I've installed FFTW & libsndfile before, their include files lib files and pkg-config files are all in the right place, but when I use sh ./configure to generate makefile for libsamprate the output always mentions
checking for pkg-config... no
checking for SNDFILE... no
I also set the PKG_CONFIG_PATH(usr/local/lib/pkgconfig) and tried many times but the result seems the same
Does anyone knows anything about this?
As mentioned in comments, your environment is not set up to run the pkg-config executable. There are many problems associated with pkg-config, and it has become increasingly popular to suggest that the correct solution is to stop using it completely. Unfortunately, if you are trying to install a package that does use pkg-config, you are not in a position to use that solution. The closest you can get is to set PKG_CONFIG to 'true' or ':' in your environment. This causes pkg-config to emit no output but always return true when it is run, so you need to specify locations of libraries and headers via the standard mechanisms (LDFLAGS, etc.).
pkg-config is great in that it allows a user (someone installing the package) to be ignorant of the standard flags. The problem with pkg-config is that it allows the users to be ignorant.
As a package maintainer, you should stop using pkg-config. As a user, you should either set PKG_CONFIG=: in your environment or in a config.site, or get in the habit of invoking configure with PKG_CONFIG=: as an argument. (If you are using packages that rely on ancient autoconf in which you cannot pass such flags as an argument, I'm not sure what the appropriate action is, but suggesting that the package maintainer upgrade is probably not a bad idea.)

Cannot run Code::Blocks: libwx_gtk2u-2.8.so.0 not found

I am trying to install Code::Blocks 10.05 from (non-SVN) sources (codeblocks-10.05-src.tar.bz2). My OS is Ubuntu 11.04. I needed to download and install wxWidgets first (I now have wxGTK-2.8.12), which seemed to work. I compiled it according to these instructions:
http://wiki.codeblocks.org/index.php?title=Installing_Code::Blocks_from_source_on_Linux
Then I configured C::B with
./configure --with-wx-config=/opt/wx/2.8/bin/wx-config
and ran
export LDFLAGS="-Wl,-R /opt/wx/2.8/lib"
make
sudo -i
make install
When trying to run C::B, I get the following error:
codeblocks: error while loading shared libraries: libwx_gtk2u-2.8.so.0: cannot open shared object file: No such file or directory
The same question was asked here: error while loading shared libraries, but the suggested solution (namely adding the wxWidgets config to the options passed to configure) didn't work for me.
The output of wx-config --prefix is /opt/wx/2.8,
The output of wx-config --libs is -L/opt/wx/2.8/lib -pthread -lwx_gtk2u-2.8,
and that of which wx-config is /opt/wx/2.8/bin/wx-config.
I looked for the library and found /opt/wx/lib/libwx_gtk2u-2.8.so.0 to be a link to libwx_gtk2u-2.8.so.0.8.0 in the same folder.
What might be wrong here?
The problem is that the program cannot find the WX widgets libraries at run time. You will need to set your LD_LIBRARY_PATH variable to include the location of wxWidgets like this:
LD_LIBRARY_PATH=/opt/wx/2.8/lib ./codeblocks
The reason why its failing is because you compiled codeblocks against wxWidgets found in /opt/ and not the one installed in /usr/; the program doesn't know to look in /opt for the wx libraries.
Probably the easiest way to get code::blocks up and running on Ubuntu is to just install it via the Synaptic Package Manager. Just type in codeblocks into 'Quick search'. Find codeblocks on the list and just right-click to mark for install. Any dependencies and missing libraries needed will automatically be handled and installed by Synaptic as necessary.
If you're interested in trying the C::B nightly builds on Ubuntu then you'll want to checkout Jens' unofficial debian-repository here.
You can visit Why do I have to define LD_LIBRARY_PATH with an export every time I run my application? for a more generic case. For a particular case like yours you can follow the below given steps
If you had installed wxGTK then you would see the file in /usr/local/lib. You would get this error when the the above path is not as part of the makefile. I received this error while starting wxFormBuilder after building from source on CentOS. There are 2 approaches.
Approach 1: Putting the path in .bashrc
gedit /home/{your-username}/.bashrc
Then after the line # User specific aliases and functions paste the following
export $LD_LIBRARY_PATH=/usr/local/lib.
This would work for fine but for the current login, but for other users like root you might have to do the same in the respective .bashrc files.
Approach 2: Creating your own conf files
cd /etc/ld.so.conf.d
gedit wxformbuilder.conf
Give the path /usr/local/lib and save the file.
ldconfig (To update the library path).

Resources