News:

alphaMELTS 1.9 is available at the download and information site.
alphaMELTS 2 standalone & for MATLAB/Python are available on request
(see the Version 2 tab on the download site for more details).
For news of all MELTS software see the MELTS Facebook page.

Main Menu

[FAQ] Rhyolite-MELTS error: "Illegal Instruction: 4" or "Segmentation fault: 11"

Started by Paula, November 21, 2017, 10:08:19 AM

Previous topic - Next topic

Paula

Update: this fix is confirmed to work on Sierra too. Thanks to jesnow for verifying!
Update: this fix is confirmed to work on High Sierra too. Thanks to Ken C for letting us know!

On El Capitan, Sierra or High Sierra you may get errors when you run either the 10.8+ or 10.12+ versions of Rhyolite-MELTS graphical user interface (GUI). We have been able to reproduce the errors on El Capitan and believe that it is due to a lack of backwards compatibility in Xquartz. Specifically, 'Illegal Instruction: 4' seems to occur only on machines with older hardware (2011 and earlier??). So please try the following fixes and let us know if they work, in which case we will update the OFM-Research support page.

  • We'll assume you have installed Xquartz, but if you get an error message when you try to start the rhyolite-MELTS GUI that includes...
    Quote
        dyld: Library not loaded: /opt/X11/lib/libXft.2.dylib
        Referenced from: path_to_MELTS/Melts-rhyolite-public
        Reason: image not found
        Trace/BPT trap: 5
    ... then you may need to log out and in before trying rhyolite-MELTS again.

  • If, having installed Xquartz, you get an error when starting the 10.8+ GUI that includes...
    Quote
        Warning: Fatal Error:
        XmGetDefaultDisplay cannot be used prior to VendorS.Initialize, returns NULL
        Segmentation fault: 11
    ... then try the 10.12+ version.

  • If, having installed Xquartz, you get an error when starting the 10.12+ GUI that includes...
    Quote
        Illegal Instruction: 4
    ... then try the 10.08+ version.

  • If you are experiencing problems with both the 10.08+ and 10.12+ versions then you can add the following to your .profile file (substitute the .bash_profile file if you have one; also see reply below)...
    Quote
        export DYLD_LIBRARY_PATH=/opt/X11/lib/flat_namespace:$DYLD_LIBRARY_PATH
    ... and then try the 10.08+ version.

How to edit .profile (or .bash_profile)

The .profile and .bash_profile files are hidden, which can make them a bit difficult to edit on Mac. The following section works through how to do that. Things that you should type at the command line are in bold in quote boxes; names you should substitute are in italics and comments are preceded by ellipsis (...).

  • The first thing to check is whether you have .profile or .bash_profile. Open Terminal, if it not already open.
    Quote
    cd
    ... this just ensures that you are in your home directory
    ls -a
    ... 'ls' stands for 'list' and '-a' for 'all' so it shows all file in your home directory
    If you have either .profile or .bash_profile then skip to part 3; otherwise go to part 2.

  • If you have neither .profile or .bash_profile you can download the example profile file from the alphaMELTS GitList server. Right-click on 'Raw' and choose 'Save File As...' or similar. Then open Terminal:
    Quote
    cd path_to_the_downloaded_file
    ... the path will usually be 'Downloads' by default
    cat profile
    ... then press the 'tab' key, before hitting 'return', as your browser may have added '.txt' to the end of the filename
    This last command just prints the file we just downloaded, so we can check that it downloaded OK before using it. The output should look like this:
    Quote
    # ~/.profile: executed by the command interpreter for login shells.
    # This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
    # exists.

    # set PATH so it includes user's private bin if it exists
    if [ -d "$HOME/bin" ] ; then
        PATH="$HOME/bin:$PATH"
        export PATH
    fi

    # For the Rhyolite-MELTS graphical user interface on the Windows Subsystem for Linux with Xming
    if [[ $(uname -r) =~ Microsoft ]] ; then
       export DISPLAY=:0
    fi

    # For the Rhyolite-MELTS graphical user interface on Macs, using the 10.8+ or 10.12+ executable:
    # If you get "Segmentation fault: 11" (10.8+) or "Illegal instruction: 4" (10.12+)
    # then include the following and try the 10.8+ executable.
    if [[ $(uname) =~ Darwin ]] ; then
       export DYLD_LIBRARY_PATH=/opt/X11/lib/flat_namespace:$DYLD_LIBRARY_PATH
    fi
    If it does then type you can continue:
    Quote
    mv profile ~/.profile
    ... add '.txt' or press the tab key after the first 'profile', if needed, to complete the file name
    ... '~' is shorthand for your home space on Mac
    ... there should be no space before or after the'.'
    Now quit Terminal and reopen it (which forces the system to read '.profile'). Navigate to where the Melts-rhyolite-public executable is which needs to be the 10.8+ version. Type './Melts-rhyolite-public' and, hopefully, rhyolite-MELTS will start with no 'Illegal Instruction: 4' error.

    Note that it is not a good idea to double the click the executable because the output files will end up in your home space, and not in the folder where Melts-rhyolite-public is located. The .profile file that you downloaded allows you to easily set up rhyolite-MELTS so that you can open it from any folder. See the Where are my rhyolite-MELTS output files? post.

  • If '.bash_profile' exists you should edit that, otherwise edit '.profile'. Open the Terminal program, if not already open:
    Quote
    open .profile
    ... substitute '.bash_profile' if appropriate
    ... you should find that it opens in your default text editor
    open -a TextEdit .profile
    ... use this alternative command if your default text editor is not TextEdit, but you want to use it here
    Copy and paste (Apple Key + c, and Apple Key + v respectively) the necessary line(s) and add it to the bottom of the '.profile' file.
    Quote
    ... either ...
    if [[ $(uname) =~ Darwin ]] ; then
       export DYLD_LIBRARY_PATH=/opt/X11/lib/flat_namespace:$DYLD_LIBRARY_PATH
    fi

    ...or just...
       export DYLD_LIBRARY_PATH=/opt/X11/lib/flat_namespace:$DYLD_LIBRARY_PATH
    You can also, optionally, copy the block for setting the Path into .profile. This allows you to easily set up rhyolite-MELTS so that you can open it from any folder.
    Quote
    # set PATH so it includes user's private bin if it exists
    if [ -d "$HOME/bin" ] ; then
        PATH="$HOME/bin:$PATH"
        export PATH
    fi
    Save the file. Exit Terminal and reopen it. Navigate to where the Melts-rhyolite-public executable is which needs to be the 10.8+ version. Type './Melts-rhyolite-public' and, hopefully, rhyolite-MELTS will start with no 'Illegal Instruction: 4' error.

    Note that it is not a good idea to double the click the executable because the output files will end up in your home space, and not in the folder where Melts-rhyolite-public is located. See the Where are my rhyolite-MELTS output files? post.

If bash is not your default shell

If your machine is older, or if it is a university machine then you should check whether bash, or tcsh, is the default shell. One way to do this is the open the Terminal program and type 'echo $0' (that is 'zero', not uppercase 'o') at the command line. If it says '-tcsh' then you will need to type 'bash -l' and press enter (that is lowercase 'L', not 'one') each time you open Terminal, before starting rhyolite-MELTS.

Hope this helps!
Paula

Paula

Note that this fix only works if you start the rhyolite-MELTS executable from the system's Terminal program (the one located in /Applications) and not if you open it from Xquartz's Terminal program (xterm). The /Applications/Terminal.app program is also convenient, as you can use command-c and command-v to copy and paste etc. However, you can set it up to work from xterm, if you prefer.

When it opens, xterm does not read the '~/.profile' file, but it does read '~/.bashrc' (if it exists). Traditionally '.profile' was used for environment settings, such as setting the user's PATH variable, and '.bashrc' is used for terminal settings, such as aliases. But there is nothing to stop you putting the required line in '.bashrc':
Quote
export DYLD_LIBRARY_PATH=/opt/X11/lib/flat_namespace:$DYLD_LIBRARY_PATH

Alternatively, you can type the following, after opening xterm, and before starting rhyolite-MELTS:
Quote
source ~/.profile

Paula