Brian B
Brian B

Reputation: 1450

How to eliminate /usr/local from pre compiler and linker paths?

I am trying to build an open source package and running into trouble involving a conflict with a prototype library I have installed in /usr/local, where the "right" version resides in /usr.

% (make distclean>/dev/null; ./configure > no_env_conf.log 2>& 1; make > no_env_make.log 2>&1 && echo Success || echo 'Build Error')
Build Error

I want to configure and compile without /usr/local in the precompile or linker paths. I thought I could do that by specifying the appropriate environment variables, but that does not quite work:

% (make distclean>/dev/null; CFLAGS=-I/usr/include LDFLAGS=-L/usr/lib ./configure > no_env_conf.log 2>& 1; make > no_env_make.log 2>&1 && echo Success || echo 'Build Error')
Build Error

But if I simply remove /usr/local from the filesystem then everything works:

% (sudo mv /usr/local /usr/local_off; make distclean>/dev/null; ./configure > no_env_conf.log 2>& 1; make > no_env_make.log 2>&1 && echo Success || echo 'Compile Error'; sudo mv /usr/local_off /usr/local )
Success

Is there a way to eliminate /usr/local from the paths used by the pre compiler and linker? I would especially like something that could be handled by configure options or environment variables.

Specific context: I am building ccache on OSX Lion where I have installed v1.2.6 of zlib in /usr/local, while the required one in /usr happens to be 1.2.5. This build actually happens as part of a wider script-controlled build of MythTV and all its dependencies including ccache.

Upvotes: 0

Views: 93

Answers (1)

Employed Russian
Employed Russian

Reputation: 213506

From "man gcc":

-nostdinc
   Do not search the standard system directories for header files.
   Only the directories you have specified with -I options (and the
   directory of the current file, if appropriate) are searched.

Also note that while pre-compilers do exist, you are not using one -- you are using a regular compiler, so you should stop calling it "pre compiler".

Upvotes: 1

Related Questions