0

I am trying to run Logic application to talk to my logic analyzer, and I observe the following behavior, after I install the rules under the driver.

./Logic 
./Logic: cpp_libs/libc.so.6: version `GLIBC_2.18' not found (required by /usr/lib/x86_64-linux-gnu/libstdc++.so.6)

sudo bash
./Logic 
./Logic: cpp_libs/libc.so.6: version `GLIBC_2.18' not found (required by /usr/lib/x86_64-linux-gnu/libstdc++.so.6)

sudo ./Logic 
# Application runs

What is the cause for this strange behavior?

I am running Ubuntu 14.04.

merlin2011
  • 3,925

1 Answers1

0

A plausible explanation for the difference in behavior is that the working and non-working commands are loading different libraries because they have different settings for the library search path LD_LIBRARY_PATH. There are other environment variables that could matter but are less likely, such as LD_PRELOAD, PATH (if ./Logic is a script that depends on some executables — but the error message isn't consistent with that), etc.

A plausible explanation for why invoking the command from an interactive instance of bash doesn't work, but invoking the command directly from sudo works, is that you are setting this environment in .bashrc, the file that interactive instances of bash runs. Running sudo clears almost all environment variables, hence sudo ./Logic works; but sudo bash followed by ./Logic doesn't work because running bash sets those variables again.

You should set environment variables in .profile (which is executed when the session starts), not in .bashrc. Your symptoms are characteristic of one of the problems with changing environment variables in .bashrc.

The setting for LD_LIBRARY_PATH should probably not be present in your setup files at all. Adding a directory that shadows system libraries is likely to be a source of incompatibilities. If you need it to run a particular program, set LD_LIBRARY_PATH only when running that program (via a shell wrapper, if you want to automate it), don't set it globally.