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

ATS2: add support for Darwin platform with a GCC toolchain #89283

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

@avanov
Copy link

@avanov avanov commented Jun 1, 2020

Motivation for this change

Current master branch doesn't contain a derivation for the current stable ATS2 (0.4.0), and MacOS is exempt from supported platforms

Things done
  • ATS2 version is upgraded to 0.4.0
  • ATS2-Contrib and ATS2 tarballs have appropriate sha256 checksums
  • metadata now contains platforms.darwin - this is possible through explicit passing of gccStdenv to the derivation on Darwin.
  • as I use Jetbrains' IDEs heavily, a corresponding gitignore entry was added.
  • Tested using sandboxing (nix.useSandbox on NixOS, or option sandbox in nix.conf on non-NixOS linux)
  • 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 nixpkgs-review --run "nixpkgs-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)
  • Ensured that relevant documentation is up to date
  • Fits CONTRIBUTING.md.
.gitignore Outdated Show resolved Hide resolved
@avanov avanov changed the title ATS2 0.4.0 and support for MacOS builds ats2: 0.3.13 -> 0.4.0 Sep 3, 2020
@raboof
Copy link
Member

@raboof raboof commented Nov 27, 2020

Looks like ats2 has been upgraded to 0.4.1 since in 8a3ae55.

darwin is still not added as a platform, though - perhaps it would be best to close this PR and open a new one for that?

@bbarker
Copy link
Contributor

@bbarker bbarker commented Nov 27, 2020

@avanov
Copy link
Author

@avanov avanov commented Dec 9, 2020

@raboof let's not close this one, I can rebase it on the current master, and change the commit message that we're introducing darwin support for the derivation, without changing the current version.

@avanov avanov force-pushed the ATS2-0.4.0-darwin branch from ad015b0 to 22d41c2 Dec 9, 2020
@avanov avanov changed the title ats2: 0.3.13 -> 0.4.0 ATS2: add support for Darwin platform with a GCC toolchain Dec 9, 2020
@ofborg ofborg bot requested a review from ttuegel Dec 9, 2020
@avanov avanov requested a review from raboof Dec 9, 2020
@avanov
Copy link
Author

@avanov avanov commented Dec 9, 2020

I've rebased the branch. The gcc stdenv is needed for this reason (output from an attempt to build with the default stdenv on macos big sur, I wonder why the make expects gcc, seems like a hardcoded value in the build script of the distribution? make -j4 -C src/CBOOT patsopt CCOMP=gcc GCFLAG= LDFLAGS=):

these derivations will be built:
  /nix/store/cq5d00rhyycycrhizrk78g0sa69qmq36-ats2-0.4.1.drv
building '/nix/store/cq5d00rhyycycrhizrk78g0sa69qmq36-ats2-0.4.1.drv'...
unpacking sources
unpacking source archive /nix/store/4l1r96ilp1icnly1gnc77hx4y1qz32xj-ATS2-Postiats-gmp-0.4.1.tgz
source root is ATS2-Postiats-gmp-0.4.1
setting SOURCE_DATE_EPOCH to timestamp 1596421339 of file ATS2-Postiats-gmp-0.4.1/utils/myatscc/node_modules/atscntrb-hx-parcomb/package.json
patching sources
configuring
configure flags: --prefix=/nix/store/na64byw8hdal3yhl554wd65dmnvvv8hj-ats2-0.4.1
checking for gcc... clang
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether clang accepts -g... yes
checking for clang option to accept ISO C89... none needed
checking for a BSD-compatible install... /nix/store/nx7ppsj5gimsar4v1hxzsbzyvyl1w5js-coreutils-8.32/bin/install -c
checking for a thread-safe mkdir -p... /nix/store/nx7ppsj5gimsar4v1hxzsbzyvyl1w5js-coreutils-8.32/bin/mkdir -p
checking whether ln -s works... yes
checking how to run the C preprocessor... clang -E
checking for grep that handles long lines and -e... /nix/store/xybak912ykzhd2myns1vpziyaq7v66lw-gnugrep-3.6/bin/grep
checking for egrep... /nix/store/xybak912ykzhd2myns1vpziyaq7v66lw-gnugrep-3.6/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking gmp.h usability... yes
checking gmp.h presence... yes
checking for gmp.h... yes
checking size of void*... 8
checking for posix_memalign... yes
checking for memalign... no
configure: creating ./config.status
config.status: creating config.mk
config.status: creating bin/patscc_env.sh
config.status: creating bin/myatscc_env.sh
config.status: creating bin/patsopt_env.sh
config.status: creating config.h
building
build flags: SHELL=/nix/store/pmmh1dl7kmxi2xpagknl9qqa4wr7vv9c-bash-4.4-p23/bin/bash
\
make -j4 -C src/CBOOT patsopt \
CCOMP=gcc GCFLAG= LDFLAGS= 
make[1]: Entering directory '/private/var/folders/7s/_k9r0mwd15b4pr4h78v5x2km0000gn/T/nix-build-ats2-0.4.1.drv-0/ATS2-Postiats-gmp-0.4.1/src/CBOOT'
gcc -O2 -I. -I./ccomp/runtime -c -o pats_main_dats.o pats_main_dats.c
gcc -O2 -I. -I./ccomp/runtime -c -o pats_error_sats.o pats_error_sats.c
gcc -O2 -I. -I./ccomp/runtime -c -o pats_intinf_sats.o pats_intinf_sats.c
gcc -O2 -I. -I./ccomp/runtime -c -o pats_counter_sats.o pats_counter_sats.c
/nix/store/pmmh1dl7kmxi2xpagknl9qqa4wr7vv9c-bash-4.4-p23/bin/bash: gcc: command not found
make[1]: *** [Makefile:352: pats_main_dats.o] Error 127
make[1]: *** Waiting for unfinished jobs....
/nix/store/pmmh1dl7kmxi2xpagknl9qqa4wr7vv9c-bash-4.4-p23/bin/bash: gcc: command not found
make[1]: *** [Makefile:351: pats_error_sats.o] Error 127
/nix/store/pmmh1dl7kmxi2xpagknl9qqa4wr7vv9c-bash-4.4-p23/bin/bash: gcc: command not found
make[1]: *** [Makefile:351: pats_intinf_sats.o] Error 127
/nix/store/pmmh1dl7kmxi2xpagknl9qqa4wr7vv9c-bash-4.4-p23/bin/bash: gcc: command not found
make[1]: *** [Makefile:351: pats_counter_sats.o] Error 127
make[1]: Leaving directory '/private/var/folders/7s/_k9r0mwd15b4pr4h78v5x2km0000gn/T/nix-build-ats2-0.4.1.drv-0/ATS2-Postiats-gmp-0.4.1/src/CBOOT'
make: *** [Makefile:79: src2_patsopt] Error 2
builder for '/nix/store/cq5d00rhyycycrhizrk78g0sa69qmq36-ats2-0.4.1.drv' failed with exit code 2
error: build of '/nix/store/cq5d00rhyycycrhizrk78g0sa69qmq36-ats2-0.4.1.drv' failed

With the gcc stdenv the build succeeds:

$ which patscc
/nix/store/bla85ask8zcrnygv95hw67z2wsryqr8w-ats2-0.4.1/bin/patscc

$ patscc
ATS/Postiats version 0.4.1 with Copyright (c) 2011-2020 Hongwei Xi

@avanov avanov force-pushed the ATS2-0.4.0-darwin branch from 5691adf to baa6d46 Dec 9, 2020
raboof
raboof approved these changes Dec 10, 2020
Copy link
Member

@raboof raboof left a comment

would be nice to avoid that direct dependency on gcc (can we create a PR/issue about that upstream and reference it here?), but that can be a future improvement - LGTM!

@avanov
Copy link
Author

@avanov avanov commented Dec 12, 2020

I've filed a ticket on ATS2 repository (the link), however I'm not sure if that's the only location where GCC is hardcoded.

@avanov
Copy link
Author

@avanov avanov commented Dec 12, 2020

@thoughtpolice @ttuegel @bbarker is there anything else that needs to be done before we could merge this PR? I'm happy to wait for a patch for 0.4.2 if there's a known release date.

@ttuegel
Copy link
Member

@ttuegel ttuegel commented Dec 12, 2020

It looks like upstream has some suggestion about how to build with Clang? Let's see if that works, it would be nice to use the platform-native stdenv where it can be supported.

@avanov I don't really use ATS lately, but as far as I'm concerned, you can add yourself to the maintainers if you would like.

@avanov
Copy link
Author

@avanov avanov commented Dec 13, 2020

let's wait until githwxi/ATS-Postiats#258 is done, and then we could test both 0.4.2 and the native stdenv.

@@ -842,6 +842,12 @@
githubId = 354741;
name = "Austin Butler";
};
avanov = {
Copy link
Member

@SuperSandro2000 SuperSandro2000 Mar 21, 2021

Please put this into a separate commit with the message maintainers: add avanov.

@@ -51,7 +51,7 @@ stdenv.mkDerivation rec {
description = "Functional programming language with dependent types";
homepage = "http://www.ats-lang.org";
license = licenses.gpl3Plus;
platforms = platforms.linux;
maintainers = with maintainers; [ thoughtpolice ttuegel bbarker ];
platforms = platforms.linux ++ platforms.darwin;
Copy link
Member

@SuperSandro2000 SuperSandro2000 Mar 21, 2021

Suggested change
platforms = platforms.linux ++ platforms.darwin;
platforms = platforms.unix;

@avanov avanov force-pushed the ATS2-0.4.0-darwin branch from 0dcb827 to 35bb5cc May 6, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment