0

I'm in a hard time trying to compile things with just dependencies within the system original folders. However, there are different versions of libraries and tools installed in /usr/local.

G++ is always including files from /usr/local/include but it is linking with libraries in /usr/lib what causes a great mess.

My quick solution is to just tell Linux (Ubuntu) to not look in /usr/local and just rely in things that are outside of it: in places where packages are installed by default.

The sad story is that I can't just delete what is in /usr/local, because some applications are using libraries there.

How this can be done?

2

when compiling you have set environment variable:

LD_LIBRARY_PATH=/usr/lib (or wherever you need)

and also check if /etc/ld.so.conf and/or /etc/ld.so.conf.d/ does not have paths you don't need.

2
  • Is it possible to disable looking at these paths, only while compiling? – Fernando Aug 6 '19 at 15:52
  • That's called compiler flags and you should have a look at GCC's documentation for CFLAGS and LDFLAGS – Ginnungagap Aug 10 '19 at 21:12
0

Consider using a chroot or container for building software in a clean environment with known dependencies. Both Debian and Red Hat packaging communities consider this a best practice. For Debian, the tool of choice is pbuilder. It is designed to generate debs, which is convenient because you can install those with apt.

While you could change builds ignore /usr/local/ entirely, the devil is in the details. Build scripts vary widely, from arcane autotools to custom written Makefiles. In the time it takes to understand that and patch out any /usr/local/, you could have a chroot system generating reproducible builds.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.