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

Enable x86_64-darwin for purs-bridge #33

Open
bladyjoker opened this issue Jun 22, 2022 · 6 comments
Open

Enable x86_64-darwin for purs-bridge #33

bladyjoker opened this issue Jun 22, 2022 · 6 comments

Comments

@bladyjoker
Copy link

By just adding the system haskell.nix complains...

bladyjoker@morphism:~/Desktop/purescript-bridge$ nix -L --show-trace build .#test-all."x86_64-darwin"                                                                                    
warning: Git tree '/home/bladyjoker/Desktop/purescript-bridge' is dirty                                                                                                                  
trace: To make project.plan-nix for purescript-bridge a fixed-output derivation but not materialized, set `plan-sha256` to the output of the 'calculateMaterializedSha' script in 'passth
ru'.                                                                                                                                                                                     
trace: To materialize project.plan-nix for purescript-bridge entirely, pass a writable path as the `materialized` argument and run the 'updateMaterialized' script in 'passthru'.        
trace: To make project.plan-nix for purescript-bridge a fixed-output derivation but not materialized, set `plan-sha256` to the output of the 'calculateMaterializedSha' script in 'passth
ru'.                                                                                                                                                                                     
trace: To materialize project.plan-nix for purescript-bridge entirely, pass a writable path as the `materialized` argument and run the 'updateMaterialized' script in 'passthru'.        
error: a 'x86_64-darwin' with features {} is required to build '/nix/store/99vgr29sm65al3r02g5dc96wn87qbib7-nix-tools-plan-to-nix-pkgs.drv', but I am a 'x86_64-linux' with features {ben
chmark, big-parallel, kvm, nixos-test}                                                                                                                                                   
                                                                                                                                                                                         
       … while realising the context of path '/nix/store/0f37nza2l31rqwfdzmqd4byvqj80j3vv-nix-tools-plan-to-nix-pkgs'                                                                    
                                                                                                                                                                                         
       at /nix/store/3j90lc9a7kaydiw6q7gfglzg2w40fs47-source/lib/import-and-filter-project.nix:18:13:                                                                                    
                                                                                                                                                                                         
           17|   projectSubDir'' = if projectSubDir == "" then "" else projectSubDir + "/"; # With trailing /                                                                            
           18|   project = import "${projectNix}${projectSubDir'}";                                                                                                                      
             |             ^                                                                                                                                                             
           19| in project // {                                                                                                                                                           

       … while evaluating anonymous lambda

       at /nix/store/3j90lc9a7kaydiw6q7gfglzg2w40fs47-source/lib/import-and-filter-project.nix:5:1:

            4| { pkgs, haskellLib }:
            5| { projectNix, sourceRepos, src }:
             | ^
            6| let

       … from call site

       at /nix/store/3j90lc9a7kaydiw6q7gfglzg2w40fs47-source/overlays/haskell.nix:501:27:

          500|               callProjectResults = callCabalProjectToNix args;
          501|               plan-pkgs = importAndFilterProject {
             |                           ^
          502|                 inherit (callProjectResults) projectNix sourceRepos src;

       … while evaluating the attribute 'hsPkgs'

       at /nix/store/3j90lc9a7kaydiw6q7gfglzg2w40fs47-source/overlays/haskell.nix:527:43:

          526|               project = addProjectAndPackageAttrs rec {
          527|                   inherit (pkg-set.config) hsPkgs;
             |                                           ^
          528|                   inherit pkg-set;

@chfanghr
Copy link

chfanghr commented Jun 22, 2022

It works on my machine for some reason (by reverting 0452ed8):

image

Update: make build-all and make test-all both work.

Update 2: we have some problems on M1 macOS - ghc is not cached. Maybe we can use binary cache from someone: input-output-hk/haskell.nix#1401 (comment)

Update 3: failed to build on M1

error: builder for '/nix/store/pjqqai59rz1fq7nh30x95d9p9xpgcrqg-scrypt-lib-scrypt-0.5.0.drv' failed with exit code 1;
       last 10 log lines:
       > /nix/store/hm2qzyqh6bh872rwlpjl4kw7a1nk173d-clang-wrapper-11.1.0/resource-root/include/mmintrin.h:525:12: error:
       >      error: invalid conversion between vector type '__m64' (vector of 1 'long long' value) and integer type 'int' of different size
       >         return (__m64)__builtin_ia32_psubw((__v4hi)__m1, (__v4hi)__m2);
       >                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
       >     |
       > 525 |     return (__m64)__builtin_ia32_psubw((__v4hi)__m1, (__v4hi)__m2);
       >     |            ^
       > fatal error: too many errors emitted, stopping now [-ferror-limit=]
       > 20 errors generated.
       > `cc' failed in phase `C Compiler'. (Exit code: 1)
       For full logs, run 'nix log /nix/store/pjqqai59rz1fq7nh30x95d9p9xpgcrqg-scrypt-lib-scrypt-0.5.0.drv'.
error: 1 dependencies of derivation '/nix/store/fj1spdbwjpgidxzvmbmbs5jwsxpmfm3p-ghc-shell-for-packages-env.drv' failed to build

@jhodgdev
Copy link

jhodgdev commented Jun 23, 2022

@bladyjoker any idea if this is going to be something simple to resolve?

@bladyjoker
Copy link
Author

@bladyjoker any idea if this is going to be something simple to resolve?

Can't say really. On my side I can enable x86_64-darwin and aarch64-darwin, however, that's the easy part, making sure that works is beyond this repo. M1 is a fairly untested ground, x86 Darwin should work tho.

@jhodgdev
Copy link

No worries, mate. We are brainstorming a work-around for our use-case 👍

@peterbecich
Copy link

A.f.a.i.k. haskell.nix requires one of these solutions to build for both Linux and Mac:

  • leave evalSystem blank; will build for both Linux and Mac; requires both builders?
  • hard-code x86_64-darwin, x86_64-linux, aarch64-darwin, etc. Flake works for that system only?
  • set evalSystem = builtins.currentSystem and use the --impure flag

I am writing this based upon my understanding of this comment (input-output-hk/haskell.nix#1401 (comment)) and some other troubleshooting.

I believe this question asks if flake-parts might be another solution: hercules-ci/flake-parts#84

@peterbecich
Copy link

I am trying to make the haskell.nix Flake work more easily between Mac and Linux: input-output-hk/haskell.nix#1825

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

No branches or pull requests

4 participants