Giter Site home page Giter Site logo

Comments (2)

emma-eva avatar emma-eva commented on May 22, 2024

also build and execute process is hard, plz make it easy

from libcsp.

 avatar commented on May 22, 2024

I concur.

I spent 9 hours on this and found what appears to be a dead end:

 > [7/7] RUN bash <<EOF:
0.136 /usr/bin/ld: /tmp/ccLBePAx.o (symbol from plugin): in function `main':
0.136 (.text+0x0): multiple definition of `main'; main.o (symbol from plugin):(.text+0x0): first defined here
0.161 /usr/bin/ld: /tmp/cc1sVYJL.ltrans0.ltrans.o: in function `csp___other_1_csp_main':
0.161 <artificial>:(.text+0x3d): undefined reference to `csp_main'
0.162 collect2: error: ld returned 1 exit status
------
Dockerfile:27
--------------------
  26 |     
  27 | >>> RUN bash <<EOF
  28 | >>>   set -e
  29 | >>>   cspcli init --working-dir=.
  30 | >>>   $CC $CFLAGS -c main.c -o main.o \
  31 | >>>     -fplugin=libcsp -fplugin-arg-libcsp-working-dir=.
  32 | >>>   cspcli analyze --working-dir=.
  33 | >>>   $CC $CFLAGS -o app *.o *.c \
  34 | >>>     -pthread -lcsp
  35 | >>> EOF
  36 |     
--------------------

I have no idea how to debug this further. I give up.

#include <libcsp/csp.h>

#include <stdio.h>

int main() {
  printf("Hi Mom!");
  return 0;
}
FROM debian:bookworm-slim

RUN apt update && apt install -y \
  wget gcc-12 gcc-12-plugin-dev g++-12 make libtool autoconf automake

RUN mkdir app

WORKDIR app

ENV CC="gcc-12"
ENV CXX="g++-12"
ENV CFLAGS="-O3 -flto"

RUN bash <<EOF
  set -e
  wget -q -O libcsp.tar.gz \
    https://github.com/shiyanhui/libcsp/releases/download/v0.0.2/libcsp-0.0.2.tar.gz
  tar -xzvf libcsp.tar.gz
  cd libcsp-0.0.2
  ./configure
  make
  make install
EOF

COPY main.c .

RUN bash <<EOF
  set -e
  cspcli init --working-dir=.
  $CC $CFLAGS -c main.c -o main.o \
    -fplugin=libcsp -fplugin-arg-libcsp-working-dir=.
  cspcli analyze --working-dir=.
  $CC $CFLAGS -o app *.o *.c \
    -pthread -lcsp
EOF

ENTRYPOINT ["app"]

from libcsp.

Related Issues (15)

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.