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?

Fernando
  • 101
  • 2

2 Answers2

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.

Martynas Saint
  • 1,211
  • 7
  • 15
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.

John Mahowald
  • 30,009
  • 1
  • 17
  • 32