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

[request] Make it easier to produce nimrtl/nimhcr, reccomend in docs setting rpath to $ORIGIN for using nimrtl/nimhcr #11587

Open
3 tasks done
awr1 opened this issue Jun 25, 2019 · 8 comments

Comments

@awr1
Copy link
Contributor

awr1 commented Jun 25, 2019

In the docs it is shown that you can generate nimrtl using the following command nim c -d:release lib/nimrtl.nim, but this does not work in any arbitrary directory - you have to have the standard library folder on hand (or a copy of nimrtl.nim in your project that you build separately, which, to be fair, is very short as it includes the whole standard library directly).

So, some suggestions:

  • Make it easier to be able to just build nimrtl/nimhcr from anywhere, i.e. possibly add a new compiler switch?
  • Add nimhcr build instructions to the docs
  • Docs might do well to suggest setting rpath to $ORIGIN on *nix systems if nimrtl/nimhcr are not installed as system libraries (which I assume people probably aren't doing) and are to be bundled with the binary in the same folder. (This doesn't need to be done for Windows, b/c on Windows DLL loading searches the app dir by default)
@awr1 awr1 changed the title [request] Make it easier to produce nimrtl/nimhcr, reccomend in docs setting rpath to $ORIGIN [request] Make it easier to produce nimrtl/nimhcr, reccomend in docs setting rpath to $ORIGIN for using nimrtl/nimhcr Jun 25, 2019
@alaviss
Copy link
Collaborator

alaviss commented Jun 26, 2019

We can also just enforce the building of nimrtl/nimhcr as part of the distribution. On *nix packages can install nimrtl/nimhcr to /usr/lib, allowing it to be shared with all nim projects.

@awr1
Copy link
Contributor Author

awr1 commented Jun 27, 2019

@alaviss

  • If we install to system lib directories on *nix, where does that leave Windows?
  • Doesn't that mean we would require sudo privileges for installing Nim? If we did end up doing this, wouldn't it be best to just symlink from /usr/lib to a local Nim install? Would make choosenim's job easier

@alaviss
Copy link
Collaborator

alaviss commented Jun 27, 2019

If we install to system lib directories on *nix, where does that leave Windows?

We'll need a way to easily generate them for windows, but that's already possible, maybe just some magic to have them generated when hcr is enabled:

nim c --outdir:%CD% \path\to\nimhcr.nim
nim c --outdir:%CD% \path\to\nimrtl.nim

In that case then rpath $ORIGIN could also be used on Linux.

Doesn't that mean we would require sudo privileges for installing Nim?

Well, I was focusing on packages provided by distributions, not via choosenim, sorry for not making that clearer.

For universal behavior then maybe rpath magic can be used on Linux. That'd work no matter how an user install nim on their machine.

@awr1
Copy link
Contributor Author

awr1 commented Jul 10, 2019

ultimtately I was thinking of either something like:

  • --inStd, which changes the input parent directory to the Nim stdlib path, which could then be followed be lib/nimrtl.nim or lib/nimhcr.nim. Ideally we should like to keep the output relative to whatever current directory we are in the shell.
  • nim c --genRtl and nim c --genHcr, with no input source argument needed.

@Araq
Copy link
Member

Araq commented Jul 15, 2019

Add nimhcr build instructions to the docs

Yes.

Docs might do well to suggest setting rpath to $ORIGIN on *nix systems if nimrtl/nimhcr are not installed as system libraries (which I assume people probably aren't doing) and are to be bundled with the binary in the same folder. (This doesn't need to be done for Windows, b/c on Windows DLL loading searches the app dir by default)

Yes, please.

@oakes
Copy link

oakes commented Jan 15, 2020

Is the plan to eventually include nimrtl and nimhcr in the distribution or will they always need to be compiled separately?

@Araq
Copy link
Member

Araq commented Jan 15, 2020

They are part of the distribution, but how to set them up remains unclear. Will investigate.

@oakes
Copy link

oakes commented Jan 22, 2020

Thanks @Araq , i saw that they were in the distribution in source form but couldn't find them in binary form. I tried building them myself but no luck so far.

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.

6 participants