Update: I got it working, the problem has something to do with the fact that I was running it through emacs. I ran the makefile from the command line instead, and pkg-config ran. After adding the path to guile-2.0.pc with export PKG_CONFIG_PATH=/opt/local/lib/pkgconfig everything compiled and ran OK. Still won't compile through emacs but I don't want to deal with that.
I am trying to compile a C program but received a "pkg-config: command not found" error, but am pretty sure pkg-config is installed.
Below is the MAKEFILE
# Use GCC, if you have it installed.
CC=gcc
# Tell the C compiler where to find <libguile.h>
CFLAGS=`pkg-config --cflags guile-2.0`
# Tell the linker what libraries to use and where to find them.
LIBS=`pkg-config --libs guile-2.0`
simple-guile: simple-guile.o
${CC} simple-guile.o ${LIBS} -o simple-guile
simple-guile.o: test.c
${CC} -c ${CFLAGS} test.c
Below is the error message (re: second error, I think if I can resolve this issue the libguile.h file will be found)
make
gcc -c `pkg-config --cflags guile-2.0` test.c
/bin/sh: pkg-config: command not found
test.c:2:11: fatal error: 'libguile.h' file not found
#include <libguile.h>
^
1 error generated.
make: *** [simple-guile.o] Error 1
I installed pkg-config by
brew install pkg-config
Installation appears successful?...
Jeffs-iMac:~ Jeff$ which pkg-config
/opt/local/bin/pkg-config
If it's relevant, this should be the same directory in which guile is located:
Jeffs-iMac:~ Jeff$ which guile
/opt/local/bin/guile
Am using OS X 10.11.3
I tried uninstalling and reinstalling pkg-config per: Can't install rmagick, pkg-config: command not found
I'm a novice programmer, any help would be greatly appreciated.
Related
On a Linux Mint 64bit system using gcc
I'm trying to compile the MiniBrowser example included with the WebKit package that I downloaded. webkitgtk-2.22.3
I have successfully setup the WebKit library, but when I try to compile the Tools/MiniBrowser example I get the error message given in the question title.
NOTE: There is no file on my system called cmakeconfig.h
NOTE: There are a few files called CMakeLists.txt that I do not know what to do with.
NOTE: Compiled using:
gcc `pkg-config --cflags gtk+-3.0 webkit2gtk-4.0 gstreamer-1.0` -o main main.c `pkg-config --libs gtk+-3.0 webkit2gtk-4.0 gstreamer-1.0`
As per the question comments. Use the Linux command cmake with the argument CMakeLists.txt which hopefully will generate the file cmakeconfig.h
$ cmake CMakeLists.txt
I am running CentOS 6.4, I have just installed GLFW 3.0.4 for some software package for CFD L-B visualisation. That's not my issue, the issue is that I was following instructions to test of GLFW was installed properly, I ran into some issues.
I began by
g++ -c main.cpp
Which has outputted main.o file, and went onto run this with the help of advice of another thread :
g++ main.o -o main.exec `pkg-config --libs glfw3` -lGL -lGLU -lglfw3 -lX11 -lXxf86vm -lXrandr -lpthread -lXi -ldlD
which has then given me this error code:
Package glfw3 was not found in the pkg-config search path.
Perhaps you should add the directory containing `glfw3.pc'
to the PKG_CONFIG_PATH environment variable
No package 'glfw3' found
/usr/bin/ld: cannot find -lglfw3
collect2: ld returned 1 exit status
Have tried adding -L or -B to the path of glfw3.pc and no use,
Can you please advise on how I can get this to work properly?
I am on a mac.
So I've looked everywhere what i first did was download the SDL file from https://hg.libsdl.org/SDL
After that i followed the instructions on https://wiki.libsdl.org/Installation
and wrote the following on my terminal
mkdir build
cd build
../configure
make
sudo make install
so far so good but after this when i cd to my Desktop and type gcc test.c sdl2-config --cflags --libs into my terminal it still gives me the error
test.c:2:10: fatal error: 'SDL2/SDL.h' file not found
#include <SDL2/SDL.h>
^
1 error generated.
if i type just sdl2-config --cflags --libs into my terminal it returns
-I/usr/local/include/SDL2 -D_THREAD_SAFE
-L/usr/local/lib -lSDL2
so i think it is successfully installed any idea on what the problem is?
Thanks a lot
Your header is located at /usr/local/include/SDL2/SDL.h but you're trying to include /usr/local/include/SDL2/SDL2/SDL.h. Either remove "SDL2" from your #include statement or your -I switch.
I am trying to compile sshfs: https://github.com/osxfuse/sshfs
Running the ./configure script outputs:
./configure: line 3676: syntax error near unexpected token `SSHFS,'
./configure: line 3676: `PKG_CHECK_MODULES(SSHFS, fuse >= 2.3 glib-2.0 gthread-2.0)'
So I go here: http://www.gnu.org/software/libc/download.html in order to install libC.
However, I get this message:
*** The GNU C library is currently not available for this platform.
*** So far nobody cared to port it and if there is no volunteer it
*** might never happen. So, if you have interest to see glibc on
*** this platform visit
*** http://www.gnu.org/software/libc/porting.html
*** and join the group of porters
This is after I found out I needed to install other dependencies like gettext, libffi, glib2.
I'm running on a OS X 10.7.1 Lion.
Does this mean I cannot compile SSHFS or am I doing something wrong? It doesn't make sense they would give me the source code for SSHFS on the "Fuse for OSX" website but it doesn't compile on macs.
EDIT:
After installing glib I did the following:
pkg-config --libs --cflags --modversion gthread-2.0
2.38.1
-D_REENTRANT -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -L/usr/local/lib -lgthread-2.0 -lglib-2.0 -lintl
This proves I have gthread-2.0.
I also did:
pkg-config --libs --cflags --modversion glib-2.0
2.38.1
-I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include -L/usr/local/lib -lglib-2.0 -lintl
This proves I have glib-2.0.
but I still get the error message on line 3676 above saying PKG_CHECK_MODULES unexpected token "sshfs". Does this mean something is wrong with the PKG_CHECK_MODULES macro?
Do not confuse GNU C Library (glibC) and Glib (GLib is a general-purpose utility library).
What do you really need is to install Glib (not GlibC) on your MacOS. Please follow the manual which you will find on their web site, it will provide you with the steps how to install it on your MacOS.
I'm trying to compile the following project on a remote server.
I've git cloned the project on a folder called 'scode'.
The project requires glib2 and gsl libraries. Since I'm trying to compile on a remote server, I do not have sudo privileges. So I can't use a tool to install glib2 and gsl for me.
As a result, I've manually compiled both gsl and gslib2 under the folders 'scode/gsl' and 'scode/glib'.
I've had to modify the Makefile and add absolute paths to these directories as -I options.
Nonetheless, when I try to compile the final executable. I get the following error:
[dyuret#psglogin scode]$ make
gcc -O3 -D_GNU_SOURCE -Wall -std=c99 -I. -I /home-2/dyuret/scode/gsl
-I /home-2/dyuret/scode/glib/ pkg-config --cflags glib-2.0 scode.o svec.o pkg-config --libs glib-2.0 -lm -lgsl -lgslcblas -o scode
//home-2/dyuret/scode/glib/glib/libglib-2.0.la: file not recognized:
File format not recognized
collect2: error: ld returned 1 exit status make: * [scode] Error 1
I've researched the issue a bit. This link looks informative but I can't quite decipher what the author is saying, as I'm not that experienced with compilers, libtools and the compilation flow in general.
Any help would be much appreciated. I've already spent some time on this issue and I haven't been able to make much progress.
It sounds as if what you did in order to compile the libraries in non-default (i.e. non-system) locations was maybe wrong.
For packages using autoconf (i.e. that have a configure script in the source root) you're supposed to use the --prefix option to ./configure to set the target location where you want the package installed.
With packages building shared libraries, it's often essential to do the make install step, which it sounds as if you maybe didn't do.
Sorry for being vague, these things are a bit complicated.
Someone at my group helped me with the problem. Here're the steps he roughly carried out:
(1) Manually installed glib and additional libraries at $HOME directory - i.e. $HOME/lib, $HOME/include.
(1.1) I think he did this by './configure prefix=$HOME', 'make', 'make install'.
(2) Got rid of `pkg_config` usage, which was causing the problem I outlined originally. Here are his new CLFAGS and LIBS variables:
CFLAGS=-O3 -D_GNU_SOURCE -Wall -std=c99 -I. -I$$HOME/include -I$$HOME/include/glib-2.0 -I$$HOME/lib/glib-2.0/include
LIBS=-lglib-2.0 -lm -lgsl -lgslcblas -L$$HOME/lib -L/usr/local/cuda/lib64 -lcudart
After this, the code compiled without additional problems.