Coder Social home page Coder Social logo

Dockerized build about graaf HOT 5 CLOSED

bobluppes avatar bobluppes commented on May 22, 2024
Dockerized build

from graaf.

Comments (5)

MichaeINeumann avatar MichaeINeumann commented on May 22, 2024 1

Thank you very much for the explanation. I just wanted to understand. It seems my reasoning was correct. I'm fine with using header-only libraries and understand the need because of the generic approach. The idea of precompiled diagram types is interesting, but I am happy with the current setup.

from graaf.

MichaeINeumann avatar MichaeINeumann commented on May 22, 2024

I may have found a solution.
Of course, for this ticket, a Dockerfile would also have to be created.

I am still learning how this works exactly.

But if no one else can be found, I would like to try my hand at this task.

Here is explaned how do Compile your app inside the Docker container:
https://hub.docker.com/_/gcc

Manuell Steps:

docker pull gcc
docker container create -it gcc

id: 6c795b4b94d4bbc0b624114224376d4f0a825b14ce791e7b104febb9c91a5e99
docker container start -i 6c795b4b94d4bbc0b624114224376d4f0a825b14ce791e7b104febb9c91a5e99

Container was started.

root@6c795b4b94d4:/# g++ --version
g++ (GCC) 13.2.0
root@6c795b4b94d4:/# cd home

  1. Clone the repository - clone your own fork if you want to contribute
    git clone [email protected]:bobluppes/graaf.git
    mkdir -p graaf/build && cd graaf/build

root@6c795b4b94d4:/home/graaf/build# apt-get upgrade
root@6c795b4b94d4:/home/graaf/build# apt-get install cmake

  1. Build the project
    cmake ..
    cmake --build .

Run the tests to ensure everything is working correctly
ctest

-- Performing Test HAVE_PTHREAD_AFFINITY -- success
-- Configuring done
-- Generating done
-- Build files have been written to: /home/graaf/build
[ 96%] Linking CXX executable Graaf_perf
[ 96%] Built target Graaf_perf
[ 98%] Building CXX object _deps/google_benchmark-build/src/CMakeFiles/benchmark_main.dir/benchmark_main.cc.o
[100%] Linking CXX static library libbenchmark_main.a
[100%] Built target benchmark_main
root@6c795b4b94d4:/home/graaf/build# ctest
265/265 Test #265: UnweightedGraphTest.AddUnweightedEdge<std::pair<graaf::graph<int, graaf::my_unweighted_edge, (graaf::graph_type)1>, graaf::my_unweighted_edge >> ................................................ Passed 0.00 sec

100% tests passed, 0 tests failed out of 265

Total Test time (real) = 1.34 sec

from graaf.

bobluppes avatar bobluppes commented on May 22, 2024

Hi @MichaeINeumann, do I understand you have the build working now? Congrats 🥳

I see @misarb also has a PR(#74) open which adds a dockerfile. If you are up for trying it out their setup/providing feedback, maybe we can harmonize on the solution.

from graaf.

MichaeINeumann avatar MichaeINeumann commented on May 22, 2024

@bobluppes PR(#74) by @misarb works well.
It worked fine on the first try and started the build.

docker build -t graaf .

What I don't understand is that the build remains in the Docker image and no container is created. I then manually created a container from the image and found the build folder and was also able to run Graaf_test under build/test.

docker container create -it --name graaf graaf
docker container start -i graaf

I probably don't need a build to use the Graaf library. As described, only the header files need to be included. So the build process is only for testing the code?
https://bobluppes.github.io/graaf/docs/quickstart/installation

I thought I could use a pre-compiled library. So that you can also use it with older compilers. But I don't have any experience here and my questions certainly don't make sense.

Anyway, the Dockerfile works, even if I can't understand the exact background yet.

from graaf.

bobluppes avatar bobluppes commented on May 22, 2024

Thanks for testing the script @MichaeINeumann, then let's merge the PR and if needed we can iterate on it to improve.

Regarding your question on the build of Graaf, since it is intended to use as a header-only library, there is no option to build it statically and have another program link against it. After all, due to the generic programming approach (a vertex and edge can be any arbitrary user defined class), we would not know what to compile without a concrete usage (specifying the vertex and edge types). Therefore the library cannot be pre-compiled.

The build system therefore builds the various executables (test, performance, and examples) in which it included and compiles the header-only library each time.

We could however think about specifying some common graph types (graph<int, int>) which we can pre-compile and use as a static library. What do you think about this?

from graaf.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.