Fork me on GitHub
#planck
<
2020-03-22
>
Ykä13:03:56

Hi all! Has anyone tried to run or compile planck on Alpine linux? We’d like to run planck inside Alpine docker image. It seems that the precompiled Debian and Arch binaries are compiled against glibc that is not available on Alpine. Compiling on Alpine fails as well:

### Building 1st stage Planck binary
CMake Error at /usr/share/cmake/Modules/FindPkgConfig.cmake:458 (message):
  A required package was not found
Call Stack (most recent call first):
  /usr/share/cmake/Modules/FindPkgConfig.cmake:637 (_pkg_check_modules_internal)
  CMakeLists.txt:100 (pkg_check_modules)


Build Failed.
Any ideas on how to fix this?

mfikes14:03:45

https://github.com/planck-repl/planck/wiki/Building describes installing build dependencies for various Linux distributions. Alpine is not specifically covered, but that page may help sort out what might be missing. (It is unfortunate CMake isn’t indicating the missing package). @yka

Ykä14:03:44

Thanks. I’ve indeed been checking that page and adding the dependencies. The thing is now I’m a bit stuck because CMake isn’t giving any clues.

Ykä14:03:44

I’ll check the dependencies once more. If I get it compiled, I can post a list of the needed packages so that they can be added on the wiki page 🙂

Ykä14:03:05

Ha! I had one missing dependency. Now I get another failure:

/root/planck/planck-c/functions.c: In function 'function_fstat':
/root/planck/planck-c/functions.c:1195:66: error: 'ACCESSPERMS' undeclared (first use in this function)
 1195 |                                 JSValueMakeNumber(ctx, (double) (ACCESSPERMS & file_stat.st_mode)),
      |                                                                  ^~~~~~~~~~~
/root/planck/planck-c/functions.c:1195:66: note: each undeclared identifier is reported only once for each function it appears in
make[2]: *** [CMakeFiles/planck.dir/build.make:141: CMakeFiles/planck.dir/functions.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/planck.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
Build Failed.
I’m building it on master branch. Should I rather build it from a tag?

mfikes14:03:19

Perhaps an additional header include is needed in that file for Alpine

Ykä14:03:28

Looks like some other people have also made Alpine compatability fixes for ACCESSPERMS https://github.com/ceph/ceph/commit/0314cffbee9c0b3ae6c24aea1bbf56afc2e49a40

mfikes14:03:10

Yeah, if you find a suitable #ifndef to add to the code near there, contribute that as a patch to Planck

Ykä14:03:41

I’ll take a look at it later

mfikes17:03:42

@borkdude I've released Planck 2.25.0. Let me know if you could use any particular binary for this release added to https://planck-repl.org/binaries/

borkdude18:03:46

@mfikes I'm on macOS. I don't see 2.25.0 listed there.

mfikes18:03:12

If you use Homebrew, it is in the queue to be built for brew

Ykä21:03:38

I added the ACCESSPERMS macro via #ifndef, but still no luck. I’m a bit more lost now:

In file included from /root/planck/planck-c/shell.c:9:
/root/planck/planck-c/shell.c: In function 'result_to_object_ref':
/root/planck/planck-c/shell.c:92:23: error: expected identifier before '(' token
   92 |     char *x = result->stdout;
      |                       ^~~~~~
/root/planck/planck-c/shell.c:93:23: error: expected identifier before '(' token
   93 |     char *y = result->stderr;
      |                       ^~~~~~
/root/planck/planck-c/shell.c:95:71: error: expected identifier before '(' token
   95 |     JSObjectRef rv = create_shell_result(ctx, result->status, result->stdout, result->stderr);
      |                                                                       ^~~~~~
/root/planck/planck-c/shell.c:95:22: error: too few arguments to function 'create_shell_result'
   95 |     JSObjectRef rv = create_shell_result(ctx, result->status, result->stdout, result->stderr);
      |                      ^~~~~~~~~~~~~~~~~~~
/root/planck/planck-c/shell.c:80:20: note: declared here
   80 | static JSObjectRef create_shell_result(JSContextRef ctx, int status, char *out, char *err) {
      |                    ^~~~~~~~~~~~~~~~~~~
In file included from /root/planck/planck-c/shell.c:9:
/root/planck/planck-c/shell.c: In function 'process_child_pipes':
/root/planck/planck-c/shell.c:212:17: error: expected identifier before '(' token
  212 |     params->res.stdout = out_buf ? out_buf : strdup("");
      |                 ^~~~~~
/root/planck/planck-c/shell.c:213:17: error: expected identifier before '(' token
  213 |     params->res.stderr = err_buf ? err_buf : strdup("");
      |                 ^~~~~~
make[2]: *** [CMakeFiles/planck.dir/build.make:258: CMakeFiles/planck.dir/shell.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:76: CMakeFiles/planck.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
Build Failed.
I think I will try to come some other solution than running Planck in Alpine 🙂

mfikes21:03:17

@yka Maybe I'll give it a stab. I see there is a Vagrant build for Alpine https://app.vagrantup.com/alpine/boxes/alpine64/versions/3.7.0

mfikes21:03:54

That version of Alpine might be a little old

Ykä21:03:48

I used alpine:3.11 docker base image

Ykä21:03:39

I installed at least the following packages: gcc make cmake pkgconf unzip curl-dev libzip-dev webkit2gtk perl-utils musl-dev webkit2gtk-dev I’ll make a Dockerfile out of that

Ykä21:03:16

Just a minute. I need to test that it works.

Ykä21:03:42

oh, obviously Clojure too, and Java.

Ykä22:03:08

Here’s a big bunch of the needed Alpine packages, in a Dockerfile: https://gist.github.com/ykarikos/1d14685307636b3391df38441ce30aa3 It’s still missing something, but it’s getting a bit too late here in Finland, so I have to get some sleep now.