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

Support Freebsd? #1113

Open
syaiful6 opened this issue Jun 1, 2020 · 9 comments · May be fixed by #1114
Open

Support Freebsd? #1113

syaiful6 opened this issue Jun 1, 2020 · 9 comments · May be fixed by #1114

Comments

@syaiful6
Copy link

syaiful6 commented Jun 1, 2020

esy version: latestOperationg System: FreeBSD

Issue:

When trying to install esy, it fail in FreeBSD, i though it will try to install/build from source, but it didn't. I try to patch, but not able to fix it yet.

Actual behavior:

can install in FreeBSD. Fail without trying to build from source.

Tried.

  • npm install -g --ignore-scripts esy
  • build esy-solve-cudf with opam and dune: dune build && node postinstall.js. It success
  • tried to build esy with opam and dune, this time it fail. Dune tell me it need "rely" package, but when i install with opam install rely, it complain can't find that package.

Ocaml version:
4.05.0
4.08.0 (tried this version as well).

I will happy to contribute and make it work in FreeBSD. Please give me instruction how to do it. I expect it will work on FreeBSD, as I able to install bs-platform in my FreeBSD computer.

@syaiful6
Copy link
Author

syaiful6 commented Jun 3, 2020

Actually, i am able to build esy in FreeBSD by manually fixing the build. Right now, i am able to use esy command line and build the example project described in esy documentation.

But i am not sure how to contribute, so esy can be installed by other folks in FreeBSD.

@EduardoRFS
Copy link
Collaborator

@syaiful6 A good start would be to have it available in the CI, I don't expect it to be a any maintenance burden, publishing it is another problem, but if it is building and published it's already half of the problem

https://github.com/esy/esy/blob/master/.ci/build-release.yml

@ManasJayanth
Copy link
Member

@syaiful6 Once esy is buildable via opam, we need to build the esy sourcetree with that binary.

The binary you see on npm are built via esy itself. They are different are bit different from the binary built via opam. So it would be recommended that you build the source tree via the opam built binary and run esy npm-release on it. This would create an _release folder. We have to make sure we can get to this stage.

Now, as you say, you had to make some patches to the source, raise a PR making sure all the above steps build. It doesn't have to be perfect, we can work on it together over at the PR. At the PR, we can add an additional FreeBSD image on to the pipeline setup and get it to build there (as Edurado suggested)

The steps just described, would have to be a separate one time pipeline. Once a version of FreeBSD binary is on NPM (hope we dont hit limits there), we can deactivate and retain it the repo for future reference.

cc @EduardoRFS

@ManasJayanth
Copy link
Member

Feel free to share the chain of commands you had to run to build esy with opam. That will help us come up with the one-time pipeline that looks like esy (with opam) -> esy -> (with esy) -> npm publishable artifacts

@syaiful6
Copy link
Author

syaiful6 commented Jun 4, 2020

thanks @prometheansacrifice @EduardoRFS , first we need to make esy-solve-cudf to support FreeBSD, as we depends on it? that project is buildable via opam. If needed I can provide the executable as initial support, then we remove that.

esy is different story, it can't be buildable directly via dune/opam (i tried that), as it have rely dependency, this package not available in opam. So, what I did is use linux executable (fortunately, FreeBSD can execute that -- but don't use to build other project (revery etc) as it mistakenly think it run on linux), and then I use it to install the dependency and build with that. After it build, i copy that to platform-freebsd in global node_modules and edit postinstall.js to copy freebsd platform as well.

esy-node_modules

change for postinstall.js

switch (platform) {
  case 'win32':
    if (arch() !== 'x64') {
      console.warn('error: x86 is currently not supported on Windows');
      process.exit(1);
    }

    copyPlatformBinaries('win32');

    console.log('Installing native compiler toolchain for Windows...');
    cp.execSync(`npm install esy-bash@0.3.19 --prefix "${__dirname}"`);
    console.log('Native compiler toolchain installed successfully.');
    break;
  case 'linux':
  case 'darwin':
  case 'freebsd':
    copyPlatformBinaries(platform);
    break;
  default:
    console.warn('error: no release built for the ' + platform + ' platform');
    process.exit(1);
}

@ulrikstrid
Copy link
Contributor

You can depend on rely by pinning it in opam so if that's the only blocker to have it built we're in a good spot.
I guess we also have to check for freebsd in the code where we do other platform stuff.

@syaiful6
Copy link
Author

syaiful6 commented Jun 5, 2020

thanks for tip @ulrikstrid!

@prometheansacrifice @EduardoRFS now, i can make it build using dune/opam, by pinning:

other package also need to install with the version listed in esy.json. What's next to be done?

Screenshot at 2020-06-05 08-46-14

@syaiful6 syaiful6 linked a pull request Jun 5, 2020 that will close this issue
@ManasJayanth
Copy link
Member

Update

Esy is now full buildable with opam. This will make it easier to package it for BSDs provided they have opam.

CI logs: https://dev.azure.com/esy-dev/esy/_build/results?buildId=3274&view=logs&jobId=04a664a5-cc8b-573b-9b7e-c652326f1d1f

Docker file with steps to build with opam: https://github.com/esy/esy/blob/master/Dockerfile

@marcinkoziej
Copy link

marcinkoziej commented Aug 22, 2021

I am trying to build recent esy using opam on FreeBSD 12, however, I am stuck at:

Missing dependency:
 - cudf >= 0.9+dune

Any hints what are the "+dune" versions and where to get them?

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

Successfully merging a pull request may close this issue.

5 participants