Yang Hua
Yang Hua

Reputation: 41

How to install the RGL for the latest version of GF?

May I please ask you how to install the RGL for the latest version of GF on Mac OS system? I have tried to follow the GFSS2021 courses, but I didn't find the solution. Hi,Inariksit, I just tried these methods in Github, but I failed, I chose to run the setup.sh file in one of my desktop file in terminal, and I add the Languages.csv file to the same file, but I don't understand the error:

I have tried your method, adding the GF_LIB_PATH into the file of .bash_profile, but still I can't run the ConstructionChi.gf file. Could you please help me to see whether the way I add the path is correct?

enter image description here

Upvotes: 4

Views: 285

Answers (1)

inariksit
inariksit

Reputation: 1427

Here are complete steps how to install the RGL from source. It assumes that you have GF already installed

1. Choose a folder on your computer where you want the compiled RGL to be

The compiled RGL can be anywhere you want. Once you have chosen the path, you won't need to type it in the future.

Let's suppose for the sake of example, that the path is /Users/mlamp/rgl_compiled.

2. Set an environment variable called GF_LIB_PATH

I recommend setting up the environment variable GF_LIB_PATH instead of the other methods (e.g. passing a path to the installation script in a flag), because you will need to set up GF_LIB_PATH anyway, if you want to access the RGL from any directory in your computer.

2.1 Setting up an environment variable

In your home directory (where you are in the screenshot), do you have a file called .profile, .bash_profile, .bashrc, .zprofile, .zshrc or .zshenv? Or any other file whose name starts with a dot, and contains one or more lines that look like export SOMETHING_ALL_CAPS=/some/path/on/your/computer.

If you have already one of those files, just open it in a text editor and add the following line among the rest of the export FOO=bar lines:

$ export GF_LIB_PATH=/Users/mlamp/rgl_compiled

(Of course, using whatever path you actually want to use.)

If you don't have any of the files, you can create a file called .profile (the dot is important!) under your home directory, and put that line, export GF_LIB_PATH=/Users/mlamp/rgl_compiled, in there.

2.2 Activate the environment variable for the current session

Now if you only put that line in your .*profile file, it isn't running yet. Those files are doing their thing every time the system is started. To make sure it takes action now, you can either

  • also type export GF_LIB_PATH=/Users/mlamp/rgl_compiled on the command line and continue from there, or
  • close your terminal and open a new one.

After you've done one of these, proceed to the next step.

3. Install the RGL

Now you have set up your GF_LIB_PATH, so you can go back to the gf-rgl repository and install the RGL. If you have Make, the easiest way is this:

$ make install

I recommend using the Makefile: it's a wrapper for the 3 different installation methods, and it tries them all until one succeeds, so you don't have to know which one works for your computer. (But if you don't have Make, then you need to either get Make, or try the different scripts, Setup.sh or Setup.bat on Windows.)

4. Test if it worked

Now you can go to any other directory, and try to run GF. Try for example

$ gf alltenses/LangEng.gfo

If it succeeds, then it means that the $GF_LIB_PATH is working correctly. If it didn't succeed, the error messages you are getting are important diagnostic methods.

4.1 Wrong path

If you get an error that looks like follows:

Unable to find:
 /usr/local/share/x86_64-osx-ghc-8.6.5/gf-3.11.0/lib/alltenses/LangEng.gfo

This means that your system thinks that GF_LIB_PATH is /usr/local/share/x86_64-osx-ghc-8.6.5/gf-3.11.0/lib/ and not the path you (tried to) set up.

Some things to try from here:

  • Check if the GF_LIB_PATH is actually set or not, by doing this in your terminal (any directory):
$ echo $GF_LIB_PATH

If you get the wrong path, or get nothing, then this means you didn't succeed setting up the environment variable earlier. I'd suggest just to close all terminal windows and open a new terminal, and check again echo $GF_LIB_PATH. If this still doesn't work, could it be that the line is in the wrong file? For instance, if you have zshell but put it in a .bashrc file or something.

4.2 Right path but no files

If you get an error message that includes the path you have set up, then probably something went wrong with the RGL installation. You can inspect the contents of the path as follows:

$ ls $GF_LIB_PATH

You should see there a bunch of *.gfo files, or three directories by names alltenses, prelude and present, all three full of * .gfo files.

If this is not the case, go back to step 3, and report what you get for output.

Upvotes: 1

Related Questions