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

Docker support #107

Open
vasily-kartashov opened this issue Jul 3, 2021 · 4 comments
Open

Docker support #107

vasily-kartashov opened this issue Jul 3, 2021 · 4 comments

Comments

@vasily-kartashov
Copy link

When trying to build this on docker

FROM alpine:3 AS builder

RUN apk add --update alpine-sdk git autoconf automake libtool gettext wxgtk

WORKDIR /logo

RUN git clone https://github.com/jrincayc/ucblogo-code .
RUN autoupdate \
    && autoreconf --install \
    && ./configure \
    && make

this is the output

#9 sha256:bd84a55c3942878a235a76be0f43657b169773ed66878789fcd65de661549b16
#9 1.045 configure.ac:100: warning: The preprocessor macro `STDC_HEADERS' is obsolete.
#9 1.045   Except in unusual embedded environments, you can safely include all
#9 1.045   ISO C90 headers unconditionally.
#9 3.313 configure.ac:100: warning: The preprocessor macro `STDC_HEADERS' is obsolete.
#9 3.313 configure.ac:100:   Except in unusual embedded environments, you can safely include all
#9 3.313 configure.ac:100:   ISO C90 headers unconditionally.
#9 3.970 configure.ac:12: installing './compile'
#9 3.972 configure.ac:7: installing './install-sh'
#9 3.973 configure.ac:7: installing './missing'
#9 4.000 Makefile.am: installing './depcomp'
#9 4.149 docs/Makefile.am:1: installing 'docs/texinfo.tex'
#9 4.320 checking for a BSD-compatible install... /usr/bin/install -c
#9 4.528 checking whether build environment is sane... yes
#9 4.535 checking for a race-free mkdir -p... ./install-sh -c -d
#9 4.540 checking for gawk... no
#9 4.540 checking for mawk... no
#9 4.540 checking for nawk... no
#9 4.540 checking for awk... awk
#9 4.541 checking whether make sets $(MAKE)... yes
#9 4.548 checking whether make supports nested variables... yes
#9 4.554 checking for gcc... gcc
#9 4.577 checking whether the C compiler works... yes
#9 4.613 checking for C compiler default output file name... a.out
#9 4.614 checking for suffix of executables... 
#9 4.653 checking whether we are cross compiling... no
#9 4.692 checking for suffix of object files... o
#9 4.718 checking whether the compiler supports GNU C... yes
#9 4.745 checking whether gcc accepts -g... yes
#9 4.771 checking for gcc option to enable C11 features... none needed
#9 4.851 checking whether gcc understands -c and -o together... yes
#9 4.900 checking whether make supports the include directive... yes (GNU style)
#9 4.908 checking dependency style of gcc... gcc3
#9 4.941 checking for g++... g++
#9 4.960 checking whether the compiler supports GNU C++... yes
#9 4.988 checking whether g++ accepts -g... yes
#9 5.015 checking for g++ option to enable C++11 features... none needed
#9 5.099 checking dependency style of g++... gcc3
#9 5.131 checking enable_objects... no
#9 5.132 checking enable_gitid... no
#9 5.132 configure: No WX_CONFIG_CHECK available
#9 5.132 checking enable_x11... no
#9 5.132 checking enable_docs... yes
#9 5.133 ./configure: line 5311: AX_CFLAGS_WARN_ALL: not found
#9 5.133 ./configure: line 5312: syntax error: unexpected word (expecting ")")

Please advise.

@dmalec
Copy link
Collaborator

dmalec commented Jul 3, 2021

That specific error is due to not having autoconf-archive installed and can be resolved by adding it to apk add command. But it looks like there are some additional things needed to build on alpine.

Alpine Version

I did find a couple errors which led me to switch to alpine 3.13:
https://gitlab.alpinelinux.org/alpine/aports/-/issues/12396

make: /bin/sh: Operation not permitted

As well as:

#8 6.378 config.status: error: Something went wrong bootstrapping makefile fragments
#8 6.378     for automatic dependency tracking.  If GNU make was not used, consider
#8 6.378     re-running the configure script with MAKE="gmake" (or whatever is
#8 6.378     necessary).  You can also try re-running configure with the
#8 6.378     '--disable-dependency-tracking' option to at least be able to build
#8 6.378     the package (albeit without support for automatic dependency tracking).

There may be a better approach; but, moving back to 3.13 appears to resolve these.

pr command

The next error relates to missing the pr command:

#8 6.251 LC_ALL=C sort helptemp | pr -5 -t -l999 -w80 >> helpfiles/HELPCONTENTS
#8 6.253 /bin/sh: pr: not found
#8 6.254 make: *** [Makefile:1646: regenerate-help-index] Error 127

This can be addressed by adding coreutils.

makeinfo

The next error is missing makeinfo:

#8 6.463 /logo/missing: line 81: makeinfo: not found
#8 6.465 WARNING: 'makeinfo' is missing on your system.
#8 6.465          You should only need it if you modified a '.texi' file, or
#8 6.465          any other file indirectly affecting the aspect of the manual.
#8 6.465          You might want to install the Texinfo package:
#8 6.465          <https://www.gnu.org/software/texinfo/>
#8 6.465          The spurious makeinfo call might also be the consequence of
#8 6.465          using a buggy 'make' (AIX, DU, IRIX), in which case you might
#8 6.465          want to install GNU make:
#8 6.465          <https://www.gnu.org/software/make/>

This can be addressed by adding texinfo and texlive.

terminal

The next error I'm a bit stumped by at the moment to be honest:

...
#8 18.02 term.c:146:10: error: 'TIOCGETP' undeclared (first use in this function)
#8 18.02   146 |  ioctl(0,TIOCGETP,(char *)(&tty_cooked));
#8 18.02       |          ^~~~~~~~
#8 18.02 term.c:146:10: note: each undeclared identifier is reported only once for each function it appears in
#8 18.02 term.c:146:29: error: 'tty_cooked' undeclared (first use in this function); did you mean 'y_coord'?
#8 18.02   146 |  ioctl(0,TIOCGETP,(char *)(&tty_cooked));
#8 18.02       |                             ^~~~~~~~~~
#8 18.02       |                             y_coord
#8 18.02 term.c:147:2: error: 'tty_cbreak' undeclared (first use in this function)
#8 18.02   147 |  tty_cbreak = tty_cooked;
#8 18.02       |  ^~~~~~~~~~
#8 18.02 term.c:148:25: error: 'CBREAK' undeclared (first use in this function)
#8 18.02   148 |  tty_cbreak.sg_flags |= CBREAK;
#8 18.02       |                         ^~~~~~
#8 18.02 term.c:149:26: error: 'ECHO' undeclared (first use in this function)
#8 18.02   149 |  tty_cbreak.sg_flags &= ~ECHO;
#8 18.02       |                          ^~~~
...

I tried adding a few different terminal related packages; but, I think I'm going to admit I've gotten to the point of just making guesses at this point and hope this jumps out to someone else :)

Revised Dockerfile

Where this puts my working Dockerfile:

FROM alpine:3.13 AS builder

RUN apk add --update \
 alpine-sdk \
 autoconf \
 autoconf-archive \
 automake \
 coreutils \
 libtool \
 gettext \
 git \
 texinfo \
 texlive \
 wxgtk

WORKDIR /logo

RUN git clone https://github.com/jrincayc/ucblogo-code .
RUN autoupdate \
    && autoreconf --install \
    && ./configure \
    && make

@dmalec
Copy link
Collaborator

dmalec commented Jul 3, 2021

Ah, one cup of coffee later ☕ and stepping back a bit - instead of wxgtk switching to wxgtk-dev should get past the terminal compilation issues. This does leave a different issue with stdio to sort out though.

@vasily-kartashov
Copy link
Author

I think the stdio error has something to do with the musl. I managed to compile it under debian:10

FROM debian:10 AS builder

RUN apt-get update \
 && apt-get install -y \
    build-essential autoconf autoconf-archive automake coreutils libtool gettext git texinfo texlive libwxgtk3.0-dev

WORKDIR /logo

RUN git clone https://github.com/jrincayc/ucblogo-code .
RUN autoreconf --install \
    && ./configure \
    && make

RUN ls -la /logo

CMD [ "/logo/ucblogo" ]

But now I am facing this

# docker run -it ucblogo                           
14:40:41: Error: Unable to initialize GTK+, is DISPLAY set properly?

@dmalec
Copy link
Collaborator

dmalec commented Jul 3, 2021

Gotcha, makes sense. I think the next step is probably going to depend on the project you are envisioning (it will likely depend on if you're looking to use turtle graphics or not and if you want an interactive environment or a virtual display environment). If you're willing to share a bit about your project, I think this sounds like a great topic for the discussion area :)
https://github.com/jrincayc/ucblogo-code/discussions/

That said, to get to a Logo prompt in the console, I'd suggest configuring without wx:

./configure --without-wx-config

(IIRC, it's necessary to have wx on the docker image in order to get the necessary macro to request not using it, so I wouldn't remove it from the install command).

However, that is going to require being able to build/link the non-wx console. I found that adding ncurses-dev satisfied the necessary requirements (there may be other approaches here as well).

In order to have paths to various data files set up properly, I'd suggest doing a make install and then running the installed binary rather than the one in the checked out directory.

FROM debian:10 AS builder

RUN apt-get update \
 && apt-get install -y \
    build-essential autoconf autoconf-archive automake coreutils libtool gettext git ncurses-dev texinfo texlive libwxgtk3.0-dev

WORKDIR /logo

RUN git clone https://github.com/jrincayc/ucblogo-code .
RUN autoreconf --install \
    && ./configure --without-wx-config \
    && make \
    && make install

RUN ls -la /logo

CMD [ "ucblogo" ]

Hopefully this will get you to a point where you see the following when you run the docker image:

Welcome to Berkeley Logo version 6.2.1
? 

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

2 participants