# [SOLVED] snx can't find libstdc++.so.5

## flatelin

When I try to run snx on the command line, I get this:

snx: error while loading shared libraries: libstdc++.so.5: cannot open shared object file: No such file or directory

However, I've verified that /usr/lib64/libstdc++.so.5 exists and is a link to /usr/lib64/libstdc++.so.5.0.7

I've also verified that /usr/lib64 is in  ld.so.conf

snx isn't managed by portage, but I have synced and updated since the last time I successfully worked from home so it's possible that something it depends on has broken things. I don't really understand the whole process, but I think that the snx executable gets updated whenever I VPN in to work (I believe this to be true because it prompts me for the root password before establishing the VPN and the snx file gets updated timestamps) so it's possible that I got a broken executable this morning when I attempted to connect, but the error makes it sound like a linking issue.

Any help is greatly appreciated.

--flatelinLast edited by flatelin on Fri Mar 28, 2014 5:58 pm; edited 1 time in total

----------

## Anon-E-moose

It could be looking for it in a specific directory rather than using the ld cache.

Run ldd on the binary and see what it lists.

----------

## flatelin

Here's the result of running  `ldd /usr/bin/snx`:

```
        linux-gate.so.1 (0xf7716000)

        libX11.so.6 => /usr/lib32/libX11.so.6 (0xf75bd000)

        libpthread.so.0 => /lib32/libpthread.so.0 (0xf75a2000)

        libresolv.so.2 => /lib32/libresolv.so.2 (0xf758b000)

        libdl.so.2 => /lib32/libdl.so.2 (0xf7586000)

        libpam.so.0 => /lib32/libpam.so.0 (0xf7577000)

        libnsl.so.1 => /lib32/libnsl.so.1 (0xf755e000)

        libstdc++.so.5 => not found

        libc.so.6 => /lib32/libc.so.6 (0xf73b2000)

        libxcb.so.1 => /usr/lib32/libxcb.so.1 (0xf7390000)

        /lib/ld-linux.so.2 (0xf7717000)

        libXau.so.6 => /usr/lib32/libXau.so.6 (0xf738b000)

        libXdmcp.so.6 => /usr/lib32/libXdmcp.so.6 (0xf7384000)
```

----------

## Anon-E-moose

Do you have a libstdc++.so.5  in lib32, you can't use the 64 bit one in a 32 bit app.

On my system

```
ldconfig -p |grep libstdc++.so.5

   libstdc++.so.5 (libc6,x86-64) => /usr/lib64/libstdc++.so.5

   libstdc++.so.5 (libc6) => /usr/lib32/libstdc++.so.5
```

Or just check with "ls -l /usr/lib32/libstdc++*"

----------

## flatelin

So I tried creating /usr/lib32/libstdc++.so.5 as a link to /usr/lib64/libstdc++.so.5 and got a new error:

```
snx: error while loading shared libraries: libstdc++.so.5: wrong ELF class: ELFCLASS64

```

So I'm guessing the issue is that my executable is compiled as 32-bit but my libstdc++.so.5 is compiled as 64-bit.

When I run the file command on the executable, I get this:

```
/usr/bin/snx: setuid ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, stripped
```

which seems to confirm that suspicion. It makes me wonder if I had a 32-bit libstdc++ that was recently removed by an update or if I've been getting 64-bit executables all this time but for some reason got a 32-bit executable this morning.

--flatelin

----------

## flatelin

 *Anon-E-moose wrote:*   

> Do you have a libstdc++.so.5  in lib32, you can't use the 64 bit one in a 32 bit app.
> 
> On my system
> 
> ```
> ...

 

No, I do not have a libstdc++.so.5 in /usr/lib32. How do I get one?

--flatelin

----------

## Anon-E-moose

What does "emerge -pv libstdc++-v3" return?

----------

## flatelin

 *Anon-E-moose wrote:*   

> What does "emerge -pv libstdc++-v3" return?

 

I just ran "equery uses sys-libs/libstdc++-v3" and got this:

```
 equery uses sys-libs/libstdc++-v3

[ Legend : U - final flag setting for installation]

[        : I - package is installed with flag     ]

[ Colors : set, unset                             ]

 * Found these USE flags for sys-libs/libstdc++-v3-3.3.6-r1:

 U I

 - - multilib : On 64bit systems, if you want to be able to compile 32bit and

                64bit binaries

 + + nls      : Add Native Language Support (using gettext - GNU locale

                utilities)
```

So now I've added "multilib" to package.use and am rebuilding.

Any idea if this is a new use flag? It seems strange that I've been working fine for the last couple of years without it.

--flatelin

----------

## Anon-E-moose

```
drwxr-xr-x  2 root root  752 Sep  1  2013 libstdc++-v3-3.3.6-r1
```

Not exactly new.

If you are using a multilib profile then it should be set there.

----------

## flatelin

 *Anon-E-moose wrote:*   

> 
> 
> ```
> drwxr-xr-x  2 root root  752 Sep  1  2013 libstdc++-v3-3.3.6-r1
> ```
> ...

 

How do I check that? 

The only profile I'm aware of is /etc/portage/make.profile which points to ../../usr/portage/profiles/default/linux/amd64/13.0.

--flatelin

----------

## Anon-E-moose

That profile should be a multilib one.

What does "emerge --info | grep multilib" show?

OR

what does this "grep multilib /etc/make.conf /etc/portage/package.*" show?  (use /etc/portage/make.conf if your's is there)

----------

## flatelin

 *Anon-E-moose wrote:*   

> That profile should be a multilib one.
> 
> What does "emerge --info | grep multilib" show?
> 
> OR
> ...

 

emerge --info | grep multilib returns nothing.

grep multilib /etc/portage/make.conf /etc/portage/package.* returns

```
/etc/portage/package.use:sys-libs/libstdc++-v3 multilib
```

which is the line I added moments ago.

Oh, things are working now that I've rebuilt with the multilib use flag. Thank you so much for your help!

--flatelin

----------

## flatelin

So if my profile is supposed to be multilib, should I be nervous that I've inadvertently done something to make it not multilib?

--flatelin

----------

## Anon-E-moose

You should have that flag set, not sure why you don't.

But it's only used when compiling 32 bit libs or apps.

Just mark this as solved, and good luck.

----------

## flatelin

 *Anon-E-moose wrote:*   

> You should have that flag set, not sure why you don't.
> 
> But it's only used when compiling 32 bit libs or apps.
> 
> Just mark this as solved, and good luck.

 

Thanks so much for the help!

--flatelin

----------

