planck

Planck ClojureScript REPL
Ykä 2020-03-22T13:59:56.002600Z

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?

mfikes 2020-03-22T14:25:45.006Z

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ä 2020-03-22T14:28:44.007300Z

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ä 2020-03-22T14:30:44.008Z

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ä 2020-03-22T14:33:05.008900Z

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?

mfikes 2020-03-22T14:36:19.010600Z

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

Ykä 2020-03-22T14:36:28.010900Z

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

mfikes 2020-03-22T14:38:10.012500Z

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

👍 1
Ykä 2020-03-22T14:38:41.012800Z

I’ll take a look at it later

mfikes 2020-03-22T17:43:42.013600Z

@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/

borkdude 2020-03-22T18:17:46.014100Z

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

mfikes 2020-03-22T18:18:12.014600Z

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

borkdude 2020-03-22T18:18:18.014800Z

:thumbsup:

Ykä 2020-03-22T21:11:38.016300Z

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 🙂

mfikes 2020-03-22T21:16:17.017Z

@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

mfikes 2020-03-22T21:17:54.017400Z

That version of Alpine might be a little old

Ykä 2020-03-22T21:34:48.017800Z

I used alpine:3.11 docker base image

Ykä 2020-03-22T21:38:39.018300Z

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ä 2020-03-22T21:41:16.018700Z

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

Ykä 2020-03-22T21:49:42.019200Z

oh, obviously Clojure too, and Java.

Ykä 2020-03-22T22:05:08.020400Z

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.