For some reason, my yum installer does not link library files. For example, I am trying to include in a c file, so I run sudo yum install c-ares. Everything installs, but when I run the program, I get the error:
fatal error: ares.h: No such file or directory
The same thing happens when I try to include other packages, such as
Any thoughts on how I can get yum to put these libraries in the right place?
There are usually two packages - one containing the library so you can run existing programs and another for development that contains the headers that has the name with "-devel" appended to it.
So in this case you need to also install "c-ares-devel"
you need to install the development packages. Like c-ares-devel
Related
I use Tcl_CreateObjCommand to build a Tcl extension in C called libA.so, the C code call the function from an external C library called libext.so, where should I put libext.so, so that the tcl could find and load it when it load libA.so
Use a package installer
If you have a package manager you should install tcl/tk with it.
sudo apt-get install tk
or you might want also tk-dev (which is sometimes called tk-devel):
sudo apt-get install tk tk-dev
Install manually
You can put so's manually in /usr/local (libraraies in /usr/local/lib/ and include files in /usr/local/include/), But remember to avoid installing them under /usr if you do have a packaging system.
There's also an option of putting them under your project directory, but you'll have to help the dynamic linker find them (using LD_LIBRARY_PATH or ld.so.conf). Also, you'll have to update your project's include paths and library paths.
I am a begineer trying to get code in C. I am working on a Mac and using xcode. My only past experience has been with java using eclipse and everything was pretty straight forward. I have almost no experience with terminal.
I am required to learn a bit of C for a project I will be working on and the learning of syntax is coming along okay, but I am at a point where I need to include some libraries in my c program. Specifically I am attempting to make plots with gnuplots.
I have downloaded gnuplot-4.6.3 from their repository and I do not even know how to install the files. I have been looking around and have tried using terminal to use the ./configure command when I am in the gnuplot-4.6.3 directory. But I really don't know what I am doing so I don't even know where to go next or what to do next.
Sorry if this is so trivial, I honestly just have never done this before and I cannot find a good tutorial on what to do.
Thanks for any help you can offer.
I would recommend using MacPorts for installing third-party tools and libraries. It knows the dependencies required and will install them as part of the installation.
Download it from macports.org.
Install it, and allow it to modify your ~/.profile so that /opt/local/bin is in your $PATH (any issue then just do export PATH=/opt/local/bin:$PATH from the command line).
sudo port selfupdate
sudo port install gnuplot
Now that will install the library into /opt/local/lib with the include files in /opt/local/include, so now just add that library to your Xcode project. Select the target and in the Build Phases tab open up the Link Binary With Libraries and press the + button and select Add Other. Now find /opt/local/lib/libgnuplot.a (I am assuming that's what it's called; I don't have it installed my self):
Now add /opt/local/include to your Header Search Paths so the compiler can find the gnuplot header files. Select the target and in Build Setting type in "header search" in the search box. Now double-click on the Header Search Path in the target column (or the project column to the right) and add /opt/local/include:
It's fine! You're learning then! Keep up! When I hit this kind of problem you may want to learn about the basis for linux gcc/g++ compilation and linking processes. Then you should learn Cmake and Automake, which are basically packages to configure projects before compiling building.
A typical (good) project in Unix systems build with commands
./configure
make
sudo make install
or
cmake CMakelists.txt
make all
sudo make install
That's what you need to do after downloading a source tarball online to install unix programs.
Now since you are using Mac, there are so-called package installers, one which is macports and homebrew. I personally suggest homebrew than macports here (I've tried both, although macports still outnumber homebrew with the number of repos, homebrew has the newest support, especially when upgrading to a new OS). So to install homebrew you can do
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
Execute that in your terminal (see http://brew.sh/) for more information.
Then you could simply install GNUplot by
brew install gnuplot
I want to build some package from source (e2fsprogs to be more concrete) and install its header files to my system. After that I will delete the build tree so it will not be accessible anymore. What is the right way to do this?
When I want to install program, I make simply:
$ ./configure
$ make
# make install
What are the equivalent actions when I want to install headers?
For e2fsprogs, quoting verbatim from the INSTALL file shipped with the sources:
7) Install the include files and libraries
You can run `make install-libs' to install the include files and
libraries. Please note that this installation is not needed for the
programs to work. It is only needed if you expect to develop other
programs using the libraries or if you want to compile other program
using these libraries (like the 4.4BSD dump and restore port).
More generally though, when I want to find out what is the 'proper' way to install something that has worked for others, I look at:
What the package looks like, in my favourite distro
How the package is built for my favourite distro
I have two versions of PHP installed on the system, one in /opt/local (API=20090626) and another in /opt/php54 (API=20100525). I'm trying to compile an extension for the /opt/php54 version, so I run /opt/php54/bin/phpize in the extension directory, then ./configure --enable-<ext> && make && sudo make install. The problem though is that the compiled extension is not for API=20100525, but rather for API=20090626 (the one in /opt/local). Even when running make install, it tries to install it in /opt/local instead of /opt/php54.
What am I doing wrong?
Add --with-php-config=/opt/php54/bin/php-config to the configure string.
I want to install gettext but i cannot because my AIX says that gettext is dependent on glib and when i try to install glib it says that I cannot because glib is in turn dependent on gettext.
Please let me know how I could get past this situation?
root [rover]% rpm -i gettext-0.17-1.aix5.1.ppc.rpm
error: failed dependencies: libglib-2.0.a(libglib-2.0.so.0) is needed by gettext-0.17-1
libxlsmp.a(smprt.o) is needed by gettext-0.17-1
root [rover]% rpm -i glib2-2.22.5-2.aix5.1.ppc.rpm
error: failed dependencies: gettext is needed by glib2-2.22.5-2
You really have 2 problems:
error: failed dependencies: libglib-2.0.a(libglib-2.0.so.0) is needed by gettext-0.17-1
libxlsmp.a(smprt.o) is needed by gettext-0.17-1
The first error is indeed solved by what is said above (DO NOT use the --nodeps option in this case, it can cause really bad things to happen): use rpm -i (or -U for upgrade) to install both gettext and glib2 at the same time. If you have both in the same directory you can just use rpm -ihv (or -Uhv) *.rpm to install all of the RPM's at once, and it will resolve interdependencies that way.
HOWEVER, you still will not likely be able to install gettext due to #2: libxlsmp.a is a SECOND library/dependency that you need to solve.
It's my understanding that this library comes from a base AIX package (NOT an RPM/Open Source package) that will need to be installed from your AIX installation Media by installp. According to other web research it's the "xlsmp" package.
You have to pass in both files at once for dependency resolution to work: rpm -U gettext.rpm glib2.rpm.
I am not sure this will work or not, but install one of the package ignoring the dependencies.
use --nodeps flag of rpm to do this. Once it is installed, then go ahead with the other package.
root [rover]% rpm --nodeps -i gettext-0.17-1.aix5.1.ppc.rpm
Make sure to resolve other dependencies (if any) later if you are following this.