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

mlton: refactor and adds mlton20180207Binary mlton20180207 mltonHEAD #44386

Merged
merged 6 commits into from Oct 14, 2018
Merged

mlton: refactor and adds mlton20180207Binary mlton20180207 mltonHEAD #44386

merged 6 commits into from Oct 14, 2018

Conversation

ghost
Copy link

@ghost ghost commented Aug 3, 2018

Motivation for this change

Newer versions of the MLton compiler in nixpkgs.

Things done

Adds the following derivations:

  • mlton20130715

    • for this one I just copy and pasted the old default.nix
    • I have tested some projects that compile with this version and don't
      compile with the newer version, so I think it makes sense to keep
      the old version
  • mlton20180207Binary

    • This is used to build the source derivations
  • mlton20180207

    • latest release
  • mltonHEAD

    • latest commit to the master branch of the github repo at the time of
      creating this derivation

Everything seemed to build fine using Nix 2.0 on NixOS. I haven't tried building it on macOS.

  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS)
  • Built on platform(s)
    • NixOS
    • macOS
    • other Linux distributions
  • Tested via one or more NixOS test(s) if existing and applicable for the change (look inside nixos/tests)
  • Tested compilation of all pkgs that depend on this change using nix-shell -p nox --run "nox-review wip"
  • Tested execution of all binary files (usually in ./result/bin/)
  • Determined the impact on package closure size (by running nix path-info -S before and after)
  • Fits CONTRIBUTING.md.


usr_prefix = if stdenv.isDarwin then "usr/local" else "usr";

dynamic_linker =
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use stdenv.cc.bintools.dynamicLinker for this purpose.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I'll change that.

@joachifm
Copy link
Contributor

@GrahamcOfBorg build mlton mltonHEAD

@GrahamcOfBorg
Copy link

Failure on x86_64-linux (full log)

Attempted: mlton, mltonHEAD

Partial log (click to expand)

rm -f libmlton.a
ar rc libmlton.a util.o platform.o platform/.o gc.o basis/Real/IEEEReal-consts.o basis/Real/Real-consts.o basis/Real/gdtoa.o basis/Real/Math.o basis/Real/Real.o basis/Real/strtor.o basis/Real/IEEEReal.o basis/Net/Net.o basis/Net/NetProtDB.o basis/Net/NetHostDB-consts.o basis/Net/Socket/INetSock.o basis/Net/Socket/select.o basis/Net/Socket/Socket-consts.o basis/Net/Socket/GenericSock.o basis/Net/Socket/INetSock-consts.o basis/Net/Socket/Socket.o basis/Net/Socket/UnixSock.o basis/Net/NetServDB.o basis/Net/NetHostDB.o basis/coerce.o basis/Word/Word.o basis/Stdio.o basis/IntInf/int-inf.o basis/cpointer.o basis/Posix/Error-consts.o basis/Posix/SysDB/Group.o basis/Posix/SysDB/Passwd.o basis/Posix/Signal.o basis/Posix/Signal-consts.o basis/Posix/ProcEnv/ProcEnv.o basis/Posix/ProcEnv/isatty.o basis/Posix/ProcEnv/getenv.o basis/Posix/ProcEnv/sysconf.o basis/Posix/ProcEnv/getlogin.o basis/Posix/ProcEnv/getgroups.o basis/Posix/ProcEnv/sysconf-consts.o basis/Posix/ProcEnv/Uname.o basis/Posix/ProcEnv/setgroups.o basis/Posix/ProcEnv/ttyname.o basis/Posix/ProcEnv/setenv.o basis/Posix/ProcEnv/Times.o basis/Posix/ProcEnv/environ.o basis/Posix/Process/execp.o basis/Posix/Process/exit.o basis/Posix/Process/pause.o basis/Posix/Process/fork.o basis/Posix/Process/exitStatus.o basis/Posix/Process/system.o basis/Posix/Process/ifSignaled.o basis/Posix/Process/waitpid.o basis/Posix/Process/exece.o basis/Posix/Process/kill.o basis/Posix/Process/waitpid-consts.o basis/Posix/Process/ifExited.o basis/Posix/Process/nanosleep.o basis/Posix/Process/stopSig.o basis/Posix/Process/ifStopped.o basis/Posix/Process/termSig.o basis/Posix/Process/alarm.o basis/Posix/Process/sleep.o basis/Posix/Error.o basis/Posix/IO/dup2.o basis/Posix/IO/read.o basis/Posix/IO/pipe.o basis/Posix/IO/fsync.o basis/Posix/IO/fcntl-consts.o basis/Posix/IO/close.o basis/Posix/IO/FLock.o basis/Posix/IO/FLock-consts.o basis/Posix/IO/lseek.o basis/Posix/IO/lseek-consts.o basis/Posix/IO/fcntl3.o basis/Posix/IO/dup.o basis/Posix/IO/write.o basis/Posix/IO/fcntl2.o basis/Posix/TTY-consts.o basis/Posix/FileSys/Stat.o basis/Posix/FileSys/fpathconf.o basis/Posix/FileSys/FileSys-consts.o basis/Posix/FileSys/pathconf.o basis/Posix/FileSys/Dirstream.o basis/Posix/FileSys/rmdir.o basis/Posix/FileSys/symlink.o basis/Posix/FileSys/getcwd.o basis/Posix/FileSys/rename.o basis/Posix/FileSys/unlink.o basis/Posix/FileSys/chmod.o basis/Posix/FileSys/truncate.o basis/Posix/FileSys/open3.o basis/Posix/FileSys/chown.o basis/Posix/FileSys/mkdir.o basis/Posix/FileSys/mkfifo.o basis/Posix/FileSys/chdir.o basis/Posix/FileSys/Utimbuf.o basis/Posix/FileSys/ST.o basis/Posix/FileSys/readlink.o basis/Posix/FileSys/umask.o basis/Posix/FileSys/fchdir.o basis/Posix/FileSys/fchmod.o basis/Posix/FileSys/access.o basis/Posix/FileSys/fchown.o basis/Posix/FileSys/open2.o basis/Posix/FileSys/link.o basis/Posix/FileSys/ftruncate.o basis/Posix/TTY.o basis/System/CommandLine.o basis/System/Time.o basis/System/Date.o basis/System/OS/IO/poll.o basis/System/OS/IO/poll-consts.o basis/MLton/Syslog/Syslog.o basis/MLton/Syslog/Syslog-consts.o basis/MLton/Rlimit/rlimit.o basis/MLton/Rlimit/rlimit-consts.o basis/MLton/Process/spawne.o basis/MLton/Process/spawnp.o basis/MLton/Rusage/rusage.o basis/MLton/bug.o basis/MLton/Itimer/itimer-consts.o basis/MLton/Itimer/set.o
ar: platform/.o: No such file or directory
make[2]: *** [Makefile:383: libmlton.a] Error 1
make[2]: Leaving directory '/build/source/runtime'
make[1]: *** [Makefile:293: runtime] Error 2
make[1]: Leaving directory '/build/source'
make: *** [Makefile:101: all] Error 2
builder for '/nix/store/p0g9nrr0cmvy5r3ncpxqn6v12q9cnx16-mlton-HEAD.drv' failed with exit code 2
error: build of '/nix/store/jfql5gl9x2gk0nr0bpbqd6dfz98wij5r-mlton-20180207.drv', '/nix/store/p0g9nrr0cmvy5r3ncpxqn6v12q9cnx16-mlton-HEAD.drv' failed

@GrahamcOfBorg
Copy link

No attempt on aarch64-linux (full log)

The following builds were skipped because they don't evaluate on aarch64-linux: mlton, mltonHEAD

Partial log (click to expand)


a) For `nixos-rebuild` you can set
  { nixpkgs.config.allowUnsupportedSystem = true; }
in configuration.nix to override this.

b) For `nix-env`, `nix-build`, `nix-shell` or any other Nix command you can add
  { allowUnsupportedSystem = true; }
to ~/.config/nixpkgs/config.nix.


@GrahamcOfBorg
Copy link

Timed out, unknown build status on x86_64-darwin (full log)

Attempted: mlton, mltonHEAD

Partial log (click to expand)

testing klife_eq
testing mlton.overload
testing known-case0
testing mlton.share
testing known-case1
testing mlton.word
testing lambda-list-ref
building of '/nix/store/x22w5mw8l1m9dslgh9dfrg02n0s79sn9-mlton-20180207.drv' timed out after 1800 seconds
building of '/nix/store/zyfa5l0k5lcl684jnma0dk493xrsnd5s-mlton-HEAD.drv' timed out after 1800 seconds
error: build of '/nix/store/x22w5mw8l1m9dslgh9dfrg02n0s79sn9-mlton-20180207.drv', '/nix/store/zyfa5l0k5lcl684jnma0dk493xrsnd5s-mlton-HEAD.drv' failed

@ghost
Copy link
Author

ghost commented Aug 20, 2018

Ok, I see /usr/bin/env: bad interpreter: No such file or directory errors in the x86_64-linux build for files that have /usr/bin/env bash shebang lines. I should be able to fix that pretty easily. I'll test with sandboxing this time.

Looks like the x86_64-darwin build succeeded, but ran out of time when it was running tests. Not super surprising, building mlton is pretty intensive.

@jasoncarr0
Copy link
Contributor

jasoncarr0 commented Oct 11, 2018

Are you still working on fixing this? The /usr/bin/env bash lines should be able to be fixed by the same
find . -type f | grep -v -e '\.tgz''$' | xargs sed -i "s@/usr/bin/env bash@$(type -p bash)@" line that was in the older version. For the timeout, do you think it would be a good idea to skip tests? Or is anyone aware of a way to set the timeout higher?

@ghost
Copy link
Author

ghost commented Oct 12, 2018

Yeah I'm going to update this.

20130715.nix is exactly the same as the old default.nix other than
pulling the meta data out into its own file.
This works the same as the binary package in the old derivation, by
patching the release binary. The difference is that this derivation
is also exposed at the top level.
Updates from-git-source.nix to use the one-liner to fix up the bash
shebang lines.
This commit adds mltonHEAD.

Summary of all the changes in this branch:

* mlton20130715
  - for this one I just copy and pasted the old default.nix
  - I have tested some projects that compile with this version and don't
    compile with the newer version, so I think it makes sense to keep
    the old version

* mlton20180207Binary
  - This is used to build the source derivations

* mlton20180207
  - latest release

* mltonHEAD
  - latest commit to the master branch of the github repo at the time of
    creating this derivation
@ghost
Copy link
Author

ghost commented Oct 12, 2018

I remade the PR. Fixed merge conflicts (without reverting the other changes). Added the one-liner to fix the source files in the other derivation, which enabled it to build successfully (with tests) for me on a box with nix.useSandbox enabled. If it times out while running the tests again, I could push up a PR disabling the tests.

@matthewbauer matthewbauer merged commit 0881a55 into NixOS:master Oct 14, 2018
@matthewbauer
Copy link
Member

Thanks!

@ghost ghost deleted the srd-update-mlton-compiler branch October 14, 2018 22:13
@jasoncarr0
Copy link
Contributor

This was merged, but @srdqty can you actually list which projects don't compile with the new version but compiled with the old?

@ghost
Copy link
Author

ghost commented Oct 15, 2018

Sure. It was a personal project: https://github.com/srdqty/sexpr-pp

Seems that you cannot redefine the = operator in the new version. I'm not sure which case is correct according to the SML definition. This project wasn't really idiomatic code, so maybe it doesn't affect many projects.

λx. make
mlton src/sexpr-repl.mlb
Error: src/symbol-table/symbol.sig 8.5-8.5.
  Special identifier cannot be specified by val: =.
    in: val = : ((t * t) -> bool)
Error: src/symbol-table/symbol-table.fun 39.10-39.10.
  Special identifier cannot be redefined by fun: =.
    in: fun op = (a, b) = (eq (a, b))
Error: src/symbol-table/symbol.sig 8.5-8.5.
  Special identifier cannot be specified by val: =.
    in: val = : ((t * t) -> bool)
Error: src/lexical-context/mark/mark.sig 7.7-7.7.
  Special identifier cannot be specified by val: =.
    in: val = : ((t * t) -> bool)
Error: src/lexical-context/mark/mark.sig 7.7-7.7.
  Special identifier cannot be specified by val: =.
    in: val = : ((t * t) -> bool)
Error: src/lexical-context/mark/mark.fun 17.10-17.10.
  Special identifier cannot be redefined by fun: =.
    in: fun op = (m1, m2) = (eq (m1, m2))
Error: src/symbol-table/symbol.sig 8.5-8.5.
  Special identifier cannot be specified by val: =.
    in: val = : ((t * t) -> bool)
unhandled exception: Fail: compilation aborted: parseAndElaborate reported errors
make: *** [Makefile:5: sexpr-repl] Error 1

@jasoncarr0
Copy link
Contributor

So, it turns out that while that's supported by SMLNJ, it is expressly forbidden by the spec. http://mlton.org/SMLNJDeviations

What I'd like to eventually do is be able to get rid of 2013, so I was wondering about any deviations between the versions.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants