Building Julia from source

Hi,
I have the following questions regarding building Julia from source:

1/ Is there a way to build a “light” version of Julia, for example without the documentation or even the REPL? If yes, how?

2/ Is there an option to add packages like DataFrames or CSV when building Julia to reduce functions compilations? If so how?
(I know I can use PackageCompiler to build sysimage, just want to known if the above is possible)

Thank you
Kind regards

Thoughts:

  1. I have no idea how to do that simply and easily as the REPL is tied extremely to Julia.

  2. Yes, you can do that using PackageCompiler (see example here: Creating a sysimage with OhMyREPL · PackageCompiler)

What’s your use case here?

Isn’t the REPL a standard library? If so, I think you can also filter out standard libraries when creating a custom sysimage. Again, not sure how useful Julia will be without the REPL though.

1 Like

I know I can do that PackageCompiler, my question is more how to do it when I build Julia from source.
No particular use case, it is just that it takes a lot of time to build Julia and I wanted to know if there is way to reduce that time by removing some part of the build process. Documentation and REPL are just example.

1 Like

I can run a script by doing the following:
julia my_script.jl
In that case I don’t need the REPL.

Oh got it. Sadly, I have no idea. :disappointed: Sorry! Are you trying to do some Julia development work?

I don’t think this currently exists, but probably wouldn’t be too hard to add.

Yes, trying :sweat_smile:

2 Likes

@Oscar_Smith , are you a core developer? I would be happy to add this functionality if you are happy to guide me.

1 Like

I suspect your work would be made mostly useless by

If I understand correctly that would made package like DataFrames and CSV load faster as well as remove the need for re-compilation because the code (functions and objects) would be cached? Is that correct? If so that would solve the issue in my second question, however I am not sure to understand how it would make building Julia from source faster?

I was wondering if someone would be able to provide further feedack or help on my questions?
Thank you

Is it like running c or cpp code in terminal basically?

gcc test.cpp

gcc is the compiler for C++.

But you want to run julia file. thus

julia test.jl

Same things to obtain same results, but different languages. Different computation time.

If you want a plot and computation, yes you don’t need REPL indeed, because you just need to make Plots / PyPlot / GLMakie showing the window like gnuplot show the plot of your code in other language. The details need hard work.

“without the documentation”

If you just make, the document will not be built.
The documentation will only be built when you execute make docs.

1 Like

Thank you @woclass, And what shoukd I do if I wanted to remove the REPL module from the build process or if I wanted to add a module to the build process?

I haven’t tried to add or remove the standard library, but you can take a look at this pr.

It looks like two main changes were made:

  • Remove the symbol in base/sysimg.jl
  • Remove the associated test

Thank you @woclass . That’s helpful!

Yes, add a base/userimg.jl System Image Building · The Julia Language

1 Like

Thank you @Elrod , so not sure to understand what goes inside that userimg.jl file.
For example let’s say I just created a module called ABC and I want to include it when building Julia from source. Then I should:

  • include my module ABC.jl in the directory base/
  • add a file called userimg.jl in that same folder
  • in the file userimg.jl write the following line of code `include(“ABC.jl”)
  • then build Julia from source by running make

Is that correct?

If so, what about including package CSV and DataFrames? Should I include them in the same base/ folder? What about their dependencies? Are these automatically taken into account?

I hadn’t tried that before, but sounds like it should work.

This I have done. Simply using CSV, DataFrames works.
You can do more than this, executing a few commands. However, there are a lot of things that won’t work (using OhMyREPL, for example, does not), so I suggest you start minimally.
Installing packages also will not work inside your userimg.jl, therefore they will already have to be installed.
Activating a project does work.
So make sure you have some project in which the packages you wish to use have already been installed for the Julia version you’re building, and then

using Pkg
Pkg.activate("/path/to/that/project")
using CSV, DataFrames, OtherPackage

should work.

If you’re using Julia’s master branch, I definitely suggest you checkout

which was linked by @giordano earlier.
The benefit putting a package in your userimg.jl has is that it almost eliminates using time, which that PR does not.

1 Like