google / gcp_scanner

A comprehensive scanner for Google Cloud
Apache License 2.0
313 stars 97 forks source link

standalone binary raises error when compiled on a newer version of Linux #7

Open mshudrak opened 2 years ago

mshudrak commented 2 years ago
./scanner
[9662] Error loading Python lib '/tmp/_MEI9HTRtJ/libpython3.10.so.1.0': dlopen: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /tmp/_MEI9HTRtJ/libpython3.10.so.1.0)

Based on this, we need to build gcp_scanner on an older system than we plan to use it on. We could also add support for StaticX.

ro4i7 commented 1 year ago
./scanner
[9662] Error loading Python lib '/tmp/_MEI9HTRtJ/libpython3.10.so.1.0': dlopen: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /tmp/_MEI9HTRtJ/libpython3.10.so.1.0)

Based on this, we need to build gcp_scanner on an older system than we plan to use it on. We could also add support for StaticX.

Hello, @mshudrak @ZetaTwo I think, using StaticX would be a more feasible solution. It can create a self-contained binary that includes all the necessary libraries, so it can run on any Linux system, then that building the binary on an older system.

Like, we can compile the binary as normally we would do, then use StaticX to create a static binary that includes all the necessary libraries including GLIBC, and then this binary will work on a variety of systems.

Can I create PR on this, if needed?

mshudrak commented 1 year ago

@ro4i7 this is a great issue to work on. Feel free to send PR but don't forget to test produced binary on various systems, please.

ro4i7 commented 1 year ago

@ro4i7 this is a great issue to work on. Feel free to send PR but don't forget to test produced binary on various systems, please.

Ok, I start checking it, meanwhile, I'm creating a PR on it, is it ok?

mshudrak commented 1 year ago

Yes, totally ok.

saurabhmj11 commented 1 year ago

./scanner [9662] Error loading Python lib '/tmp/_MEI9HTRtJ/libpython3.10.so.1.0': dlopen: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /tmp/_MEI9HTRtJ/libpython3.10.so.1.0)

The error message you're seeing suggests that the binary you're trying to run was compiled on a system that had a different version of the GNU C Library (glibc) than the one you're using now. Specifically, it looks like the binary was compiled on a system with glibc version 2.33 or higher, but the version you have installed on your current system is older than that.

One solution to this problem is to upgrade your system's glibc to a version that's compatible with the binary you're trying to run. However, upgrading glibc can be a complex and potentially risky process, so it's generally not recommended unless you know what you're doing.

Another option is to try to find a version of the binary that's compatible with your current system's glibc version. If the binary is open source, you may be able to recompile it from source on your system to ensure compatibility. Alternatively, you could try contacting the developers of the binary to see if they can provide a version that's compatible with your system.

Finally, if none of the above options work, you may need to use a virtual machine or container with an older version of Linux and glibc to run the binary. This approach can be more complicated to set up, but it can be a good way to ensure compatibility with older binaries.