LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   changing include directories - /usr/local/include (https://www.linuxquestions.org/questions/linux-newbie-8/changing-include-directories-usr-local-include-576278/)

quep_fly 08-10-2007 10:38 PM

changing include directories - /usr/local/include
 
So I have been having some troubles installing libvorbis and SDL_mixer (both in order to get the Wesnoth game working) - and it seems as if include files in /usr/local/include are not being found by my compiler. When compiling SDL_mixer, it tells me that a certain variables is undeclared, and I have found this variable to be declared in a libvorbis header file which is installed by libvorbis into /usr/local/include. Is it possible that my compiler is not looking for include files in /usr/local/include? And how can I change this?

Is it safe to simply copy all the include files in /usr/local/include into /usr/include? I have tried stuff like this before, and sometimes it can be very damaging.

Thanks in advance,

Matthew

weibullguy 08-10-2007 10:59 PM

I've never built Wesnoth, but it probably uses pkg-config to find dependencies. The metadata file for libvorbis will tell Wesnoth where to look for headers. This is the metadata file for libvorbis on my machine.
Code:

# libvorbis pkg-config source file

prefix=/usr
exec_prefix=${prefix}
libdir=/usr/lib64
includedir=${prefix}/include

Name: vorbis
Description: vorbis is the primary Ogg Vorbis library
Version: 1.1.2
Requires: ogg
Conflicts:
Libs: -L${libdir} -lvorbis -lm
Cflags: -I${includedir}

Before or when you execute the configure script for Wesnoth, set the PKG_CONFIG_PATH env variable to include /usr/local/lib/pkgconfig (although it should be a default location).
Code:

export PKG_CONFIG_PATH="$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig"
./configure --options


quep_fly 08-10-2007 11:09 PM

Thanks for the quick reply - I appreciate it. But I am not using pkg-config. I am not sure how or if I could do this - as my Linux system has no direct access to the internet. Instead, I am trying to install wesnoth using the source package off its website. But the problem I am actually having, I think, is installing libSDL_mixer and libvorbisfile.

So I think the issue is with where gcc make is looking for include files (?).

quep_fly 08-10-2007 11:37 PM

Okay, I think I'm finding something. I may need a new version of gcc (though I know I have a 3.x version...)

http://gcc.gnu.org/ml/gcc/1999-07n/msg00973.html

weibullguy 08-11-2007 12:27 AM

pkg-config is a helper utility that is found on most Linux systems.

btmiller 08-11-2007 02:23 PM

Changing the gcc version probably won't solve the include issue. The compiler looks in certain places for header filer files, e.g. /usr/include and IIRC does not look in /usr/local/include by default. You can do:

export CFLAGS="-I /usr/local/include"

to tell gcc it needs to look in /usr/local/include for headers. However, I've occasionally found CFLAGS to be overwritten by the configure script so there may be another way to pass the include directory to configure (check ./configure --help and see if there is such an option). You are also probably going to need to add /usr/local/lib to your library path assuming there are libraries in that idrectory that need to be linked against. Usually you can append this to your LD_LIBRARY_PATH.

quep_fly 08-12-2007 04:36 PM

Hi, sorry, I was wrong. I just recompiled a few dependencies, and it started working. I did copy a few include files from /usr/local/include to /usr/include, so this might have been the issue. I will try your advice, in case this was the issue.


All times are GMT -5. The time now is 08:00 PM.