mirage / checkseum

MIT License
15 stars 13 forks source link

Build error with esy #52

Closed mseri closed 3 years ago

mseri commented 3 years ago

looks like there are still some issues with esy, at least when esy is used for cross compilation. I attach here the logs for refernce (form https://github.com/mseri/doi2bib/runs/2255652909?check_suite_focus=true)

error: build failed with exit code: 1
  build log:
    # esy-build-package: building: @_linux.musl.x86_64/_opam_checkseum@path:.mocks/6ca89b3d/esy.json
    # esy-build-package: pwd: /home/runner/.esy/3/b/__linux.musl.x86__64__s____opam__checkseum-fadeaa0e
    # esy-build-package: running: 'cp' '-r' '-p' '/home/runner/.esy/source/i/opam__s__checkseum__opam__c__0.3.1__803db346/.' '/home/runner/.esy/3/b/__linux.musl.x86__64__s____opam__checkseum-fadeaa0e'
    # esy-build-package: running: 'mv' '/home/runner/.esy/3___________________________________________________________________/s/__linux.musl.x86__64__s____opam__checkseum-fadeaa0e' '_____install_____'
    # esy-build-package: running: 'mkdir' '-p' '/home/runner/.esy/3___________________________________________________________________/s/__linux.musl.x86__64__s____opam__checkseum-fadeaa0e/_esy'
    # esy-build-package: running: 'mv' '_____install_____' '/home/runner/.esy/3___________________________________________________________________/s/__linux.musl.x86__64__s____opam__checkseum-fadeaa0e/linux.musl.x86_64-sysroot'
    # esy-build-package: running: 'dune' 'build' '-p' 'checkseum' '-j' '4' '-x' 'linux.musl.x86_64' '@install'
            make freestanding/libcheckseum_freestanding_stubs.a [default.linux.musl.x86_64]
    make: opam: Command not found
    touch libcheckseum_freestanding_stubs.a
    # esy-build-package: running: './install/install.ml'
    Exception:
    Unix.Unix_error(Unix.ENOENT, "chmod", "_build/default/META.checkseum")
    error: command failed: './install/install.ml' (exited with 2)
    esy-build-package: exiting with errors above...

  building @_linux.musl.x86_64/_opam_checkseum@path:.mocks/6ca89b3d/esy.json
esy: exiting due to errors above
Error: Process completed with exit code 1.

I still have to investigate this properly, I will send a PR if I figure it out but I am very unexperienced with esy.

mseri commented 3 years ago

I think what is going on is that the DUNE_BUILD_DIR variable in the cross-compilation builds is not set globally, so the script does not know that it needs to check in _build/linux.musl.x86_64/META.checkseum. It is puzzling that there is not a better way here, either using dune which knows where to look or at least being able to query the right path.

Why cannot one ask dune itself to execute ./install/install.ml and maybe passing the right information?

dinosaure commented 3 years ago

Seems highly related to #48 (and fixed before). I'm not an user of esy so it's hard for me to understand the whole workflow.

The trick about install/install.ml is explained here: #46. It's completely unusual bit nobody found a solution 😕 .

mseri commented 3 years ago

Yes I had looked at that at first. I have a fork with a hack to use the correct build folder but even that fails without the file. I think then the other issue is that install.ml requires also opam to be installed, which is not the case in the cross compilation environment created by esy. If I come up with something decent I’ll send a PR

dinosaure commented 3 years ago

@mseri the problem is still accurate? I will cut a release for the big endian support. It can be a good opportunity to fix this issue.

mseri commented 3 years ago

My workaround is here: https://github.com/mseri/doi2bib/blob/main/.github/workflows/workflow.yml#L161 Let me try a second what happens without it

mseri commented 3 years ago

Yes, it is still a problem:

     # esy-build-package: running: 'mv' '_____install_____' '/home/runner/.esy/3__________________________________________________________________/s/__linux.musl.x86__64__s____opam__checkseum-b6dc16f4/linux.musl.x86_64-sysroot'
    # esy-build-package: running: 'dune' 'build' '-p' 'checkseum' '-j' '4' '-x' 'linux.musl.x86_64' '@install'
            make freestanding/libcheckseum_freestanding_stubs.a [default.linux.musl.x86_64]
    make: opam: Command not found
    touch libcheckseum_freestanding_stubs.a
    # esy-build-package: running: './install/install.ml'
    Exception:
    Unix.Unix_error(Unix.ENOENT, "chmod", "_build/default/META.checkseum")
    error: command failed: './install/install.ml' (exited with 2)
    esy-build-package: exiting with errors above...

From: https://github.com/mseri/doi2bib/pull/11/checks?check_run_id=3191007237

dinosaure commented 3 years ago

Can you integrate this patch: https://github.com/mirage/checkseum/pull/53? It seems a possible solution according your error.

mseri commented 3 years ago

Seems to be still failing:

    # esy-build-package: running: 'dune' 'build' '-p' 'checkseum' '-j' '4' '-x' 'linux.musl.x86_64' '@install'
            make freestanding/libcheckseum_freestanding_stubs.a [default.linux.musl.x86_64]
    make: command: Command not found
    touch libcheckseum_freestanding_stubs.a
    # esy-build-package: running: './install/install.ml'
    Exception:
    Unix.Unix_error(Unix.ENOENT, "chmod", "_build/default/META.checkseum")
    error: command failed: './install/install.ml' (exited with 2)
    esy-build-package: exiting with errors above...
mseri commented 3 years ago

The full log is here if you need: https://github.com/mseri/doi2bib/runs/3191847441

dinosaure commented 3 years ago

Fixed by #56