Containerisieren von C++-Code und der Boost-Bibliothek mit Docker

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: Containerisieren von C++-Code und der Boost-Bibliothek mit Docker

by Guest » 13 Jan 2025, 13:39

Ich habe ein Beispielskript namens main.cpp, das wie folgt lautet:

Code: Select all

#include 
#include 
#include 

int main() {
std::string line;
boost::regex pat( "^Subject: (Re: |Aw: )*(.*)" );

while (std::cin) {
std::getline(std::cin, line);
boost::smatch matches;
if (boost::regex_match(line, matches, pat))
std::cout  => transferring dockerfile: 1.16kB                                                                                                                                                                                                                                                                                                                                                0.0s
=> [internal] load metadata for docker.io/library/ubuntu:20.04                                                                                                                                                                                                                                                                                                                       0.4s
=> [internal] load .dockerignore                                                                                                                                                                                                                                                                                                                                                     0.0s
=> => transferring context: 2B                                                                                                                                                                                                                                                                                                                                                       0.0s
=> CACHED [1/7] FROM docker.io/library/ubuntu:20.04@sha256:8e5c4f0285ecbb4ead070431d29b576a530d3166df73ec44affc1cd27555141b                                                                                                                                                                                                                                                          0.0s
=> => resolve docker.io/library/ubuntu:20.04@sha256:8e5c4f0285ecbb4ead070431d29b576a530d3166df73ec44affc1cd27555141b                                                                                                                                                                                                                                                                 0.0s
=> [internal] load build context                                                                                                                                                                                                                                                                                                                                                     0.0s
=> => transferring context: 114B                                                                                                                                                                                                                                                                                                                                                     0.0s
=> [2/7] RUN ln -snf /usr/share/zoneinfo/$CONTAINER_TIMEZONE /etc/localtime && echo $CONTAINER_TIMEZONE > /etc/timezone                                                                                                                                                                                                                                                              0.1s
=> [3/7] RUN apt-get update && apt-get install -y tzdata                                                                                                                                                                                                                                                                                                                             2.7s
=>  [4/7] WORKDIR /app                                                                                                                                                                                                                                                                                                                                                                0.0s
=> [5/7] RUN apt-get update && apt-get install -y     build-essential     libboost-all-dev     && rm -rf /var/lib/apt/lists/*                                                                                                                                                                                                                                                       29.8s
=> [6/7] COPY main.cpp /app/main.cpp                                                                                                                                                                                                                                                                                                                                                 0.1s
=> ERROR [7/7] RUN g++ -o myprogram main.cpp -lboost_signals                                                                                                                                                                                                                                                                                                                         0.5s
------
> [7/7] RUN g++ -o myprogram main.cpp -lboost_signals:
0.439 /usr/bin/ld: cannot find -lboost_signals
0.439 collect2: error: ld returned 1 exit status
------
dockerfile:23
--------------------
21 |     COPY main.cpp /app/main.cpp
22 |     # Compile the program using g++
23 | >>> RUN g++ -o myprogram main.cpp -lboost_signals
24 |     # Set the default command to run the compiled program
25 |     CMD ["./main"]
--------------------
ERROR: failed to solve: process "/bin/sh -c g++ -o myprogram main.cpp -lboost_signals" did not complete successfully: exit code: 1

Top