1. 38
  1.  

  2. 6

    Thank you for writting this.

    With regards to distribution options with racket,

    Is there a way to ship platform independent, but hard to reverse engineer ‘precompiled’ binaries ?

    For example for deploying closed-source software into a private enterprise (where the servers are controlled by customers)

    1. 6

      Racket CS modules are compiled to native code so you can ship those around and reverse-engineering them would be about as hard as reverse-engineering any other natively-compiled code. You’d have to compile these separately for every platform you want to target. I believe there’s a way to ship modules in “linklet” form, which is platform-independent, and Racket CS will convert those to native code on first run, but I’ve never tried it.

      Here’s the output of running raco decompile on the compiled version of the app in the post: https://gist.github.com/Bogdanp/64a7ef659d6376fff918e3cb23518f9b

    2. 4

      The serendipity is high right now as I have Dr Racket open right now and am working on a web app. Thanks a ton @bogdan.

      1. 4

        Interesting. Any experience with cross-compilation? Apparently there’s:

        https://docs.racket-lang.org/raco/cross-system.html

        But doesn’t appear to have a lot of convenience around it (eg: no “raco add-target win64; easily compile for win64”)?

        1. 2

          I’d never tried it before, but it seems to work great. I downloaded a build of Racket CS for linux to ~/Downloads/racket and then ran the following:

          $ racket -C -G ~/Downloads/racket/etc -X ~/Downloads/racket/collects -l- raco exe -o app app.rkt
          $ file app
          app: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=7fbdabb07e54037e2ede76daf74d7ecfdcc5b486, stripped
          
          $ racket -C -G ~/Downloads/racket/etc -X ~/Downloads/racket/collects -l- raco distribute dist app
          $ tree dist/
          dist/
          ├── bin
          │   └── app
          └── lib
              └── plt
                  ├── app
                  │   └── exts
                  │       └── ert
                  │           ├── r0
                  │           │   └── example.txt
                  │           ├── r1
                  │           │   └── error.css
                  │           ├── r2
                  │           │   └── dh4096.pem
                  │           └── r3
                  │               └── bundles
                  │                   ├── es
                  │                   │   └── srfi-19
                  │                   └── srfi-19
                  └── racketcs-7.7.0.9
          
          12 directories, 7 files
          

          Someone could definitely make this easier by providing a package to add a raco command like the one you’ve suggested.

        2. 2

          Interesting. I have enjoyed doing some scheme in the past.