Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[analyzer] Switch to using setuptools (#193, #185). #231

Merged
merged 1 commit into from
Nov 4, 2023

Conversation

ivanperez-keera
Copy link
Collaborator

Distutils is deprecated (https://peps.python.org/pep-0632/). This commit replaces the import of distutils with an import of setuptools, which is one of the recommended replacements. This fixes #193.

Installation using setuptools also generates an egg file during installation. This fixes #185.

I have checked that the proposed solution works with python2 and python3. Images to replicate my results follow.

Python2:

# Based on image by Maxime Arthaud
FROM ubuntu:jammy
MAINTAINER Ivan Perez <ivan.perezdominguez@nasa.gov>
ARG njobs=2
ARG build_type=Release

# Upgrade
RUN apt-get update
RUN apt-get upgrade -y

# Refresh cache
RUN apt-get update

# Install all dependencies
RUN apt-get install --yes gcc g++ cmake libgmp-dev libboost-dev libboost-filesystem-dev \
    libboost-thread-dev libboost-test-dev python2 python-pip libsqlite3-dev libtbb-dev \
    libz-dev libedit-dev llvm-14 llvm-14-dev llvm-14-tools clang-14 \
    git 

RUN python2 -m pip install -U pygments

# Add ikos source code
WORKDIR /root
RUN git clone https://github.com/ivanperez-keera/ikos

WORKDIR /root/ikos
RUN git checkout dev-setuptools

# Build ikos
RUN rm -rf /root/ikos/build && mkdir /root/ikos/build
WORKDIR /root/ikos/build
ENV MAKEFLAGS "-j$njobs"
ENV PYTHONPATH /opt/ikos/lib/python2.7/site-packages/
RUN mkdir -p /opt/ikos/lib/python2.7/site-packages/
RUN cmake \
        -DCMAKE_INSTALL_PREFIX="/opt/ikos" \
        -DCMAKE_BUILD_TYPE="$build_type" \
        -DLLVM_CONFIG_EXECUTABLE="/usr/lib/llvm-14/bin/llvm-config" \
        -DPYTHON_EXECUTABLE:FILEPATH="$(which python2)" \
        ..
RUN make
RUN make install

# Add ikos to the path
ENV PATH "/opt/ikos/bin:$PATH"

# Done
WORKDIR /

Python3:

# Based on image by Maxime Arthaud
FROM ubuntu:jammy
MAINTAINER Ivan Perez <ivan.perezdominguez@nasa.gov>
ARG njobs=2
ARG build_type=Release

# Upgrade
RUN apt-get update
RUN apt-get upgrade -y

# Refresh cache
RUN apt-get update

# Install all dependencies
RUN apt-get install --yes gcc g++ cmake libgmp-dev libboost-dev libboost-filesystem-dev \
    libboost-thread-dev libboost-test-dev python3 python3-pygments python3-setuptools \
    libsqlite3-dev libtbb-dev libz-dev libedit-dev llvm-14 llvm-14-dev llvm-14-tools clang-14 \
    git 

# Add ikos source code
WORKDIR /root
RUN git clone https://github.com/ivanperez-keera/ikos

WORKDIR /root/ikos
RUN git checkout dev-setuptools

# Build ikos
RUN rm -rf /root/ikos/build && mkdir /root/ikos/build
WORKDIR /root/ikos/build
ENV MAKEFLAGS "-j$njobs"
RUN cmake \
        -DCMAKE_INSTALL_PREFIX="/opt/ikos" \
        -DCMAKE_BUILD_TYPE="$build_type" \
        -DLLVM_CONFIG_EXECUTABLE="/usr/lib/llvm-14/bin/llvm-config" \
        ..
RUN make
RUN make install

# Add ikos to the path
ENV PATH "/opt/ikos/bin:$PATH"

# Done
WORKDIR /

…).

Distutils is deprecated (https://peps.python.org/pep-0632/).

This commit replaces the import of distutils with an import of setuptools,
which is one of the recommended replacements.

Installation using setuptools also generates an egg file during installation.
@ivanperez-keera
Copy link
Collaborator Author

@arthaud Does this work for you?

I'd like to merge this myself, I just want a second pair of eyes before I merge. Thanks!

@arthaud
Copy link
Member

arthaud commented Nov 4, 2023

I don't have time to test this but I will assume this is fine.

@ivanperez-keera
Copy link
Collaborator Author

@arthaud Ok, thank you.

@ivanperez-keera ivanperez-keera removed the request for review from arthaud November 4, 2023 17:26
@ivanperez-keera ivanperez-keera merged commit da3fb8c into NASA-SW-VnV:master Nov 4, 2023
@ivanperez-keera ivanperez-keera deleted the dev-setuptools branch November 4, 2023 18:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Support for building on Ubuntu 22.04 Generating a .egg file
2 participants