denzyldick / phanalist

Performant static analyzer for PHP, which is extremely easy to use. It helps you catch common mistakes in your PHP code.
https://denzyldick.github.io/phanalist/
MIT License
127 stars 5 forks source link

/lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found #62

Open rmikalkenas opened 6 months ago

rmikalkenas commented 6 months ago

Installed via composer require denzyl/phanalist

Main image: php:8.3.3-cli-bullseye

> ldd --version
ldd (Debian GLIBC 2.31-13+deb11u8) 2.31
Copyright (C) 2020 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Written by Roland McGrath and Ulrich Drepper.

I understand that the version of glibc on my machine is lower, but is there any chance to make this tool compatible with older machines?

SerheyDolgushev commented 6 months ago

@rmikalkenas can you please instead of using the composer try to download a standalone binary on the same machine, using

curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/denzyldick/phanalist/main/bin/init.sh | sh

And try to run it?

I just want to identify if we have no corresponding complied executable, or if it is just a composer issue.

rmikalkenas commented 6 months ago

@SerheyDolgushev same error.

Reproducer:

# Dockerfile
FROM php:8.3.3-cli-bullseye

RUN curl --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/denzyldick/phanalist/main/bin/init.sh | sh

RUN ~/phanalist -V

Output:

/root/phanalist: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.33' not found (required by /root/phanalist)
/root/phanalist: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.32' not found (required by /root/phanalist)
/root/phanalist: /lib/x86_64-linux-gnu/libc.so.6: version `GLIBC_2.34' not found (required by /root/phanalist)
SerheyDolgushev commented 6 months ago

@rmikalkenas can you please try to compile it locally, using the following instructions:

  1. Clone the latest phanalist:

    cd ~/Projects
    git clone git@github.com:denzyldick/phanalist.git
    cd phanalist
  2. Create the following php-cli-bullseye docker file:

    FROM php:8.3.3-cli-bullseye
    RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh -s -- -y
    WORKDIR /usr/src/phanalist
    COPY . .
    RUN ~/.cargo/bin/cargo build --release
  3. Build php-cli-bullseye image using that docker file, it will compile phanalist:

    docker build -f php-cli-bullseye -t phanalist-php-cli-bullseye .
  4. Get the compiled phanalist:

    docker run -v ./:/tmp/release --rm phanalist-php-cli-bullseye cp /usr/src/phanalist/target/release/phanalist /tmp/release/phanalist

After this step, you will get the ~/Projects/phanalist/phanalist binary, which can be run in php:8.3.3-cli-bullseye.

Can you please confirm it works for your case?

denzyldick commented 6 months ago

Hi everyone,

Thanks for submitting this issue. I think the issue is that the cargo.toml has a build dependency bindgen = "0.65.1".

I think this was a left behind when we removed the dependency with rocksdb. But im not really sure, i dont know what it does. But i will look into it when I get behind the PC.

Thanks.

rmikalkenas commented 6 months ago

@rmikalkenas can you please try to compile it locally, using the following instructions:

  1. Clone the latest phanalist:
cd ~/Projects
git clone git@github.com:denzyldick/phanalist.git
cd phanalist
  1. Create the following php-cli-bullseye docker file:
FROM php:8.3.3-cli-bullseye
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh -s -- -y
WORKDIR /usr/src/phanalist
COPY . .
RUN ~/.cargo/bin/cargo build --release
  1. Build php-cli-bullseye image using that docker file, it will compile phanalist:
docker build -f php-cli-bullseye -t phanalist-php-cli-bullseye .
  1. Get the compiled phanalist:
docker run -v ./:/tmp/release --rm phanalist-php-cli-bullseye cp /usr/src/phanalist/target/release/phanalist /tmp/release/phanalist

After this step, you will get the ~/Projects/phanalist/phanalist binary, which can be run in php:8.3.3-cli-bullseye.

Can you please confirm it works for your case?

Seems to be working then. But would be great to avoid compilation.. Simply download compiled binary and run:)

SerheyDolgushev commented 6 months ago

@rmikalkenas can you please try to compile it locally, using the following instructions:

  1. Clone the latest phanalist:
cd ~/Projects
git clone git@github.com:denzyldick/phanalist.git
cd phanalist
  1. Create the following php-cli-bullseye docker file:
FROM php:8.3.3-cli-bullseye
RUN curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs/ | sh -s -- -y
WORKDIR /usr/src/phanalist
COPY . .
RUN ~/.cargo/bin/cargo build --release
  1. Build php-cli-bullseye image using that docker file, it will compile phanalist:
docker build -f php-cli-bullseye -t phanalist-php-cli-bullseye .
  1. Get the compiled phanalist:
docker run -v ./:/tmp/release --rm phanalist-php-cli-bullseye cp /usr/src/phanalist/target/release/phanalist /tmp/release/phanalist

After this step, you will get the ~/Projects/phanalist/phanalist binary, which can be run in php:8.3.3-cli-bullseye. Can you please confirm it works for your case?

Seems to be working then. But would be great to avoid compilation.. Simply download compiled binary and run:)

Yep, that is a temporary fix just to unblock you. But it is not an applicable long-term fix. But seems like @denzyldick will handle it.

denzyldick commented 6 months ago

Locally, I could reproduce the same issue using the steps provided by @SerheyDolgushev. The solution was using the musl target. I changed the composer script. In the next release, I hope it will fix your issue. @rmikalkenas. Thanks for submitting the issue. If there is anything I can do or if you have any suggestions for the project, we are open to hearing it.

@SerheyDolgushev can you update the release binaries 😄?

SerheyDolgushev commented 6 months ago

@denzyldick I run ./bin/release.sh but the binaries are the same, as there were no any recent changes that affected them. So seems like after https://github.com/denzyldick/phanalist/pull/63/files composer will use only musl target, but how about gnu platforms? I would assume there are some gnu platforms that are using composer, and after that change they will switch to musl which might be problematic. Maybe there should be an additional check, similar to https://github.com/denzyldick/phanalist/blob/main/bin/init.sh#L80-L82?