Linux/macOS Installation Notes
=============================

General: oxconsole installation
--------------------------------

Only 64-bit Linux and macOS are supported; the macOS version of the Ox compiler 
is universal (both Intel and Apple silicon), but OxEdit and OxMetrics are Apple 
silicon only.

macOS
-----------------
a) Use the installer package (.pkg.zip), Ox is installed to
   /Applications/OxMetrics10/ox
b) Also see general notes below.

   
Linux RedHat/Fedora/openSUSE/CentOS etc.
----------------------------------------
- OxMetrics as well as Ox Console are installed in /usr/share/OxMetrics10
- the oxl command is asymbolic link in /usr/bin to /usr/share/OxMetrics10/ox/oxl
  while /usr/share/OxMetrics10/ox/oxl.sh is a shell script that calls the Ox executable.

a) Use rpm package oxconsole10-0-6.x86_64.rpm (or more recent) if possible.
   Below I just write ox*.rpm
b) install Ox as: 
       sudo rpm -ivh ox*.rpm
   or upgrade Ox as: 
       sudo rpm -Uvh ox*.rpm
b) When upgrading, the installation may warn that /usr/oxl
   already exists. To avoid this, uninstall the old Ox first, or
   rename the file to /usr/oxl_old.

   
Linux Debian/Ubuntu/Mint etc.
-----------------------------
a) Use Debian package oxconsole10_0-6_amd64.deb (or more recent) if possible.
   Below I just write ox*.deb
   (Use alien to convert the rpm to a deb package when no deb package is provided.)
d) Then install the package as:
        sudo apt install ox*.deb
    or when using dpkg:
		sudo dpkg -i ox*.deb
e) In some cases, there may be some overlap in the files that the installers include.
   In that case, add the --force-overwrite to the installation command.

Linux compatibility notes
-------------------------
Ox 9.1 has a reduced dependency on recent linux versions in comparison to Ox 9.06:
the minimum libc6 version is 2.15 (Ox and OxEdit), and libstdc++6 is 5.2 (OxEdit).
We have tested 
- Ox 9.1 (oxl and oxedit) install on Kubuntu 22.04 and 20.04 without warnings
- Ox 9.1 reports missing libs on Kubuntu 18.04 to 16.04. To force installation:
	sudo dpkg --force-depends --install ./oxconsole_9.10-0_amd64.deb
	Then:
	- Kubuntu 18.04: complains about missing libpython3.8 (only needed for oxpython).
	  Both oxl and oxedit work.
	- Kubuntu 16.04: complains about libfontconfig1 (>=2.12.6 but have 2.11.94) and
	    missing libpython3.8 (only needed for oxpython) and libcurl4 (needed for oxurl).
	  Both oxl and oxedit work.
	- Kubuntu 14.04: complains a lot.
	  Only oxl works, not oxedit.
This also applies to the version 10. OxEdit and OxMetrics have newer dependencies.

Linux/macOS installation remarks (some differ between shells)
------------------------------------------------------
(0) Dynamic link libraries have the .so extension under Linux.
    macOS distinguishes with between dynamic-link
	libraries that are dynamically linked at startup (.dylib), and
	modules that can be loaded programmatically when the program is
	running (bundles, Ox uses the .so extension for these).

(1) Ox is dynamically linked:
    libox.so.10.0.0    is the (dynamically linked) Ox library for linux
    libox.dylib.10.0.0 is the (dynamically linked) Ox library for macOS
    oxl                (or oxl.bin) is the executable which links to it.

(2) version numbers:
    In (e.g.) libox.so.10.2.0: 10 is the major, and 2.0 the minor
    version number. The executable only looks for a file matching
    the major version number (libox.so.10).
    A symbolic link is required to resolve the search:
        rm libox.so.10
        ln -s libox.so.10.2.0 libox.so.10
	Under macOS it is called libox.9102.0.dylib.
        
(3) library search paths:
    LD_LIBRARY_PATH is used to search for the library file when
    the file is in a non-standard location. This must be set to
    the directory where libox.so.9 is, unless it has been moved to
    standard directory which is searched by default.
    (macOS uses DYLD_LIBRARY_PATH or DYLD_FALLBACK_LIBRARY_PATH.)

    Check the man pages of the loader (rld,ld,loader) if you have
    problems. 

(4) The installers create 
        /usr/bin/oxl
        /usr/bin/ox10
    as shortcuts to the the installed oxl binary.

(5) Ox uses the OX10PATH variable to to find include files. The default
    corresponds to, on macOS:
		OXHOME="/Applications/OxMetrics10"
	if [ -d "$HOME/OxMetrics10" ]
	then
		OX10PATH="$OX10PATH:$HOME/OxMetrics10/ox/include:$HOME/OxMetrics10/apps:
		  $HOME/OxMetrics10/ox/:$OXHOME/ox/include:$OXHOME/apps:$OXHOME/ox"
	else
		OX10PATH="$OX10PATH:$OXHOME/ox/include:$OXHOME/apps:$OXHOME/ox"
	fi
    Note that setting environment variables is shell specific, see below.

(6) The threes example shows how to create and call a dynamic link
    library. Run  make -f threes.mak  to compile threes.so
    (the header file oxexport.h and dependencies must be in the search
    path). On some platforms there may be unresolved messages from the
    linker, which may be ignored.
    Then run
        oxl threes
    to see if it works.
    The dynamic linker must be able to find threes.so, also see the help system.


NB1 Setting environment variables:
    For bash shells:
    to show contents of LD_LIBRARY_PATH environment variable:
        echo $LD_LIBRARY_PATH
    to set to a directory, e.g. to:
        LD_LIBRARY_PATH="$HOME/ox/bin"; export LD_LIBRARY_PATH
    to append the ox/bin directory:
        LD_LIBRARY_PATH="$LD_LIBRARY_PATH:$HOME/ox/bin"; export LD_LIBRARY_PATH
    to set the OX10PATH variable:
        OX10PATH="$HOME/ox/include:$HOME/ox"; export OX10PATH

    Other shells may use setenv/printenv:
    to show contents of LD_LIBRARY_PATH environment variable:
        printenv $LD_LIBRARY_PATH
    to set to a directory, e.g. to:
        setenv LD_LIBRARY_PATH "$HOME/ox/bin"
    to set the OX10PATH variable:
        setenv OX10PATH "$HOME/ox/include:$HOME/ox"

NB2 File mode, it might be necessary to set the file mode to
    executable, for example:
        chmod +x oxl

NB3 When developing DLLs for Ox, the ldd command can sometimes
    help with to find out why a DLL does not link.
    
NB4 Use: find / -name xxx
    to search for xxx from the root.