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

apt-get package does not work with CMake find_package on Ubuntu #1639

Open
itavero opened this issue Sep 14, 2022 · 6 comments
Open

apt-get package does not work with CMake find_package on Ubuntu #1639

itavero opened this issue Sep 14, 2022 · 6 comments

Comments

@itavero
Copy link
Contributor

itavero commented Sep 14, 2022

I'm trying to create a new Docker image for our CI environment.
Rather than compiling CppUTest every time in our pipeline, I want to add a precompiled version of it.

Our Docker image is based on ubuntu:jammy which has an apt-get package available for CppUTest.
Unfortunately it seems that there's something wrong with the CMake modules it provides for find_package support, as it provides the following error during the CMake configuration phase:

#6 40.21 -- The CXX compiler identification is GNU 11.2.0
#6 40.23 -- Detecting CXX compiler ABI info
#6 40.32 -- Detecting CXX compiler ABI info - done
#6 40.33 -- Check for working CXX compiler: /usr/bin/c++ - skipped
#6 40.33 -- Detecting CXX compile features
#6 40.34 -- Detecting CXX compile features - done
#6 40.34 -- Configuring incomplete, errors occurred!
#6 40.34 See also "/tmp/build/CMakeFiles/CMakeOutput.log".
#6 40.35 CMake Error at /usr/lib/x86_64-linux-gnu/CppUTest/cmake/CppUTestConfig.cmake:11 (message):
#6 40.35   File or directory /usr/lib/include referenced by variable
#6 40.35   CppUTest_INCLUDE_DIRS does not exist !
#6 40.35 Call Stack (most recent call first):
#6 40.35   /usr/lib/x86_64-linux-gnu/CppUTest/cmake/CppUTestConfig.cmake:27 (set_and_check)
#6 40.35   CMakeLists.txt:7 (find_package)

In order to reproduce it, you can grab the Dockerfile and CMakeLists.txt from this Gist and run docker build -t cpputest . in the same directory.

@itavero
Copy link
Contributor Author

itavero commented Sep 14, 2022

Did a test where I build my own CppUTest deb package using CPack.
This package does seem to work, so I guess it has something to do with how the package is created.

FROM ubuntu:jammy
ENV CMAKE_MAKE_PROGRAM=ninja
ENV CMAKE_GENERATOR=Ninja
RUN apt-get update && \
   apt-get install --no-install-recommends -y git cmake ninja-build gcc g++ ca-certificates && \
   apt-get clean autoclean && \
   apt-get autoremove --yes && \
   rm -rf /var/lib/apt/lists/* && \
   rm -rf /var/cache/apt/archives && \
   rm -rf /usr/share/doc/ && \
   rm -rf /usr/share/man/ && \
   rm -rf /usr/share/locale/ \
   gcc --version && \
   cmake --version && \
   ninja --version
RUN git clone https://github.com/cpputest/cpputest.git /tmp/cpputest/ && \
   cd /tmp/cpputest/ && \
   echo "include(CPack)" >> /tmp/cpputest/CMakeLists.txt && \
   cmake -S /tmp/cpputest/ -B /tmp/build/ -DCPACK_GENERATOR=DEB -DCPACK_DEBIAN_PACKAGE_MAINTAINER="itavero" && \
   cmake --build /tmp/build/ --target package

FROM ubuntu:jammy
COPY CMakeLists.txt /testproject/
COPY bla.cpp /testproject/
COPY --from=0 /tmp/build/*.deb /tmp/
ENV CMAKE_MAKE_PROGRAM=ninja
ENV CMAKE_GENERATOR=Ninja
RUN apt-get update && \
   apt-get install --no-install-recommends -y nano git cmake ninja-build gcc g++ ca-certificates && \
   apt-get clean autoclean && \
   apt-get autoremove --yes && \
   dpkg -i /tmp/CppUTest*.deb && \
   rm -rf /var/lib/apt/lists/* && \
   rm -rf /var/cache/apt/archives && \
   rm -rf /usr/share/doc/ && \
   rm -rf /usr/share/man/ && \
   rm -rf /usr/share/locale/ \
   gcc --version && \
   cmake --version && \
   ninja --version && \
   ls -hal /testproject/ && \
   cmake -S /testproject -B /tmp/build

@thetic
Copy link
Contributor

thetic commented Sep 15, 2022

I recommend submitting an issue against the Ubuntu package: https://launchpad.net/ubuntu/+source/cpputest/+bugs.

@itavero
Copy link
Contributor Author

itavero commented Sep 20, 2022

I recommend submitting an issue against the Ubuntu package: https://launchpad.net/ubuntu/+source/cpputest/+bugs.

Thanks for the suggestion. I've also created a bug report on Launchpad

@thetic
Copy link
Contributor

thetic commented Sep 28, 2022

@basvodde are we involved in packaging for Ubuntu at all? If not, can we close this?

@basvodde
Copy link
Member

Let me try to check this today or this week. I'll need to check this as I remember somewhat had changed.

@Arrowbox
Copy link

Arrowbox commented Oct 5, 2022

I think this is the same as #1563 that I opened a while back.

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

No branches or pull requests

4 participants