<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Approximatrix Forums — DISLIN with SF on Raspberry Pi: full instructions: corrected 16-07-16]]></title>
		<link>http://forums.approximatrix.com/viewtopic.php?id=567</link>
		<atom:link href="http://forums.approximatrix.com/extern.php?action=feed&amp;tid=567&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in DISLIN with SF on Raspberry Pi: full instructions: corrected 16-07-16.]]></description>
		<lastBuildDate>Sat, 16 Jul 2016 20:17:36 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: DISLIN with SF on Raspberry Pi: full instructions: corrected 16-07-16]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=2605#p2605</link>
			<description><![CDATA[<p>I&#039;ve updated the instructions to install and use Dislin with the Pi.<br />There were some mistakes in it.&nbsp; I think it&#039;s now correct.<br />--- <br />J.</p>]]></description>
			<author><![CDATA[null@example.com (JohnWasilewski)]]></author>
			<pubDate>Sat, 16 Jul 2016 20:17:36 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=2605#p2605</guid>
		</item>
		<item>
			<title><![CDATA[DISLIN with SF on Raspberry Pi: full instructions: corrected 16-07-16]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=2569#p2569</link>
			<description><![CDATA[<p><strong>HOW TO MAKE DISLIN WORK WITH SF UNDER RASPBIAN ON THE RPi</strong><br />Last updated 16-07-16.</p><p><em>This post sets out in detail how to install DISLIN on a Raspberry Pi, and <br />then how to compile/build executables that make calls to DISLIN.</em></p><p><em>Although it assumes that the operating system is Raspbian, I&#039;d expect it to work equally<br />well with Ubuntu MATE, subject only to a v. slightly different procedure at step (4). </em></p><p><em>If any of this is unclear or does not work, please post comments telling me <br />how I need to correct or clarify it, and I&#039;ll try to keep it up to date</em>. </p><br /><p><strong><span style="color:red">DOWNLOADING DISLIN</span></strong><br />(1) Download the Rpi distribution from <br />&nbsp; &nbsp; &nbsp;<a href="http://www.dislin.de">www.dislin.de</a> <br />&nbsp; &nbsp; &nbsp; → Downloads<br />&nbsp; &nbsp; &nbsp; → Distributions<br />&nbsp; &nbsp; &nbsp; → Linux<br />&nbsp; &nbsp; &nbsp; → ARM<br />&nbsp; &nbsp; &nbsp; → dislin-10.6.linux.arm.tar.gz</p><p>&nbsp; &nbsp; &nbsp;OR from:<br />&nbsp; &nbsp; &nbsp;<a href="http://www.mps.mpg.de/dislin">http://www.mps.mpg.de/dislin</a> <br />&nbsp; &nbsp; &nbsp; → Downloads<br />&nbsp; &nbsp; &nbsp; → Distributions<br />&nbsp; &nbsp; &nbsp; → Linux<br />&nbsp; &nbsp; &nbsp; → ARM<br />&nbsp; &nbsp; &nbsp; → dislin-10.6.linux.arm.tar.gz</p><br /><p>(2) Unpack to some convenient folder.</p><br /><p><strong><span style="color:red">LINUX SETTINGS</span></strong><br />(3) Read the README file.<br />&nbsp; &nbsp; &nbsp; Do what the instructions say, especially this part: <em><br />&nbsp; &nbsp; &nbsp; &quot;f) To make DISLIN available for general use, write the <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; following commands to your .profile or to /etc/profile&quot;</em><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<strong>DISLIN=/usr/local/dislin</strong><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<strong>export DISLIN</strong><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<strong>PATH=${PATH}:${DISLIN}/bin</strong></p><p>&nbsp; &nbsp; &nbsp; &nbsp;NB <span class="bbu">Ignore</span> this note in the instructions:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <em>&quot;The environment variable DISLIN is not necessary if DISLIN<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;is installed in the default directory &#039;/usr/local/dislin&#039;. &quot;</em><br />&nbsp; &nbsp; &nbsp; &nbsp;It is NOT true that f) can be disregarded when DISLIN is installed in /usr/local/dislin.&nbsp; </p><br /><p><strong><span style="color:red">INSTALL</span></strong><br />(4) It is necessary to run the ./INSTALL script &#039;as root&#039; because Dislin is <br />&nbsp; &nbsp; &nbsp; going to be installed into a system directory.&nbsp; Snag is, if one types &#039;sudo ./INSTALL&#039; then<br />&nbsp; &nbsp; &nbsp; ./INSTALL will try to run as root, but the environment variable DISLIN is known only to the<br />&nbsp; &nbsp; &nbsp; &nbsp;user account, not the &#039;root&#039; account, and the install will fail.</p><p>&nbsp; &nbsp; &nbsp; Therefore, CHANGE TO the &#039;root&#039; account, teach &#039;root&#039; about the DISLIN<br />&nbsp; &nbsp; &nbsp; environment variable and the required PATH, and install from there:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<strong>sudo su</strong><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<strong>DISLIN=/usr/local/dislin</strong><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<strong>export DISLIN</strong><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<strong>PATH=${PATH}:${DISLIN}/bin</strong><br />&nbsp; &nbsp; &nbsp; ..and install:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<strong>./INSTALL</strong></p><br /><p>(5) Now teach Raspbian Linux where it can find the DISLIN shared object libraries.<br />&nbsp; &nbsp; &nbsp; To do this, one has to edit a system file and then rebuild <br />&nbsp; &nbsp; &nbsp; the cached list of shared object files. <br />&nbsp; &nbsp; &nbsp; <span class="bbu">Add the following line</span> to the end of your <em>/etc/ld.so.conf</em> file:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<strong>/usr/local/dislin</strong><br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;(don&#039;t add <span style="color:gray">&quot;include /usr/local/dislin&quot;</span>)<br />&nbsp; &nbsp; &nbsp; &nbsp;<span class="bbu">Rebuild shared object files cache</span>:<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;<strong>sudo ldconfig</strong></p><br /><p><strong><span style="color:red">LIBRARIES + FONTS </span></strong>(as <em>might</em> be needed)<br />(6) I was at first unsure whether these next commands were definitely necessary, to install <br />&nbsp; &nbsp; &nbsp;some libraries and fonts.&nbsp; After further testing, I&#039;m now sure they really are needed:<br />&nbsp; &nbsp; &nbsp; <strong>sudo apt-get install lesstif2</strong><br />&nbsp; &nbsp; &nbsp; <strong>sudo apt-get install libmotif4 libmotif4* libmotif-dev</strong><br />&nbsp; &nbsp; &nbsp; <strong>sudo apt-get install xfonts-75dpi xfonts-100dpi</strong></p><br /><p><strong><span style="color:red">COMPILE dislin.f90</span></strong><br />(7) Make sure that dislin.mod has been compiled with your currently-installed gFortran version:<br />&nbsp; &nbsp; &nbsp; <strong>cd /usr/local/dislin/gf/</strong><br />&nbsp; &nbsp; &nbsp; <strong>sudo gfortran -c dislin.f90</strong><br />&nbsp; &nbsp; &nbsp; This must be repeated whenever you update gFortran to a new version.<br />&nbsp; &nbsp; &nbsp; Each new version of Simply Fortran shows on the &#039;Help/About&#039; panel <br />&nbsp; &nbsp; &nbsp; which version of gFortran it is using.&nbsp; Watch out for when this changes, or for when <br />&nbsp; &nbsp; &nbsp; &#039;sudo apt-get update &amp;&amp; sudo apt-get upgrade&#039; updates gFortran to a new version.</p><br /><p><strong><span style="color:red">CODE WITH DISLIN CALLS, COMPILED/LINKED <br />FROM THE CLI </span></strong><br />(8) The example files provided with DISLIN can now be successfully <br />&nbsp; &nbsp; &nbsp; compiled and linked with commands from the CLI: <br />&nbsp; &nbsp; &nbsp; Copy the file <span class="bbu">/usr/local/dislin/examples/exa_f90.f90</span> to a work directory.<br />&nbsp; &nbsp; &nbsp; cd to that directory.<br />&nbsp; &nbsp; &nbsp; For readability, perhaps rename the file exa_f90.f90, to, egprog.f90<br />&nbsp; &nbsp; &nbsp; To compile:<br />&nbsp; &nbsp; &nbsp; <strong>gfortran -c egprog.f90 -I/usr/local/dislin/gf</strong></p><p>&nbsp; &nbsp; &nbsp; To link: <br />&nbsp; &nbsp; &nbsp; <strong>gfortran -o egprog egprog.o -L/usr/local/dislin/ -I/usr/local/dislin/gf -ldislin</strong></p><p>&nbsp; &nbsp; &nbsp; To compile-and-link: <br />&nbsp; &nbsp; &nbsp; <strong>gfortran -o egprog egprog.f90 -L/usr/local/dislin/ -I/usr/local/dislin/gf -ldislin</strong></p><p>&nbsp; &nbsp; &nbsp; Test run the executable:&nbsp; <strong>./egprog</strong>&nbsp; →&nbsp; it should run.</p><br /><p><strong><span style="color:red">CODE WITH DISLIN CALLS, COMPILED/LINKED <br />WITH SIMPLY FORTRAN </span></strong><br />(9) Create a new project, such as egprog.f90<br />&nbsp; &nbsp; &nbsp; Add the source file to it.<br />&nbsp; &nbsp; &nbsp; Make these settings in Project Options:<br />&nbsp; &nbsp; &nbsp; <span class="bbu">General tab</span>: enter a Target name.<br />&nbsp; &nbsp; &nbsp; <span class="bbu">Linker tab</span>: <span class="bbu">Static linking</span>: un-tick <strong>All-static</strong>.<br />&nbsp; &nbsp; &nbsp; <span class="bbu">Compiler flags tab</span>: <span class="bbu">Linker</span>: add <strong>-ldislin</strong><br />&nbsp; &nbsp; &nbsp; In the <span class="bbu">File locations tab</span>, in <span class="bbu">Search directories</span>:<br />&nbsp; &nbsp; &nbsp; &nbsp; - To the <span class="bbu">Modules/Include files</span> list, add <strong>/usr/local/dislin/gf</strong><br />&nbsp; &nbsp; &nbsp; &nbsp; - To the <span class="bbu">Libraries files list</span>, add <strong>/usr/local/dislin/gf</strong><br />&nbsp; &nbsp; &nbsp; Save-project.</p><p>SF should now compile and build example.<br />You can run it from Simply Fortran, or run it from the CLI with <strong>./egprog</strong>.<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; --------------------</p><br /><p><em>Postscript</em></p><p>(1) In the CLI commands to gFortran and the Simply Fortran settings that are both explained above, compiling and building projects that call DISLIN functions produce executables reliant on shared libraries.&nbsp; Using the Dislin example, Exa_F90.for (renamed in my explanations to egprog.f90, the resulting executable is around 43k.&nbsp; Step(4) enables Raspbian to run executables with Dislin CALLs.</p><p>(2) I cannot, yet, do the same, to produce <span class="bbu">stand-alone</span> executables.</p><p>(3) It seems I am short of just one static library, without which, I cannot do (2).&nbsp; The missing library is OpenGL.&nbsp; Without this, Simply Fortran is throwing a build error&nbsp; when linking the libraries.&nbsp; The SF Linker flag, -lGL, produces an error message, &quot;cannot fine libGL.a&quot;. </p><p>(4) Apparently, Raspbian does include OpenGL, but, as at 30-June-2016, it is still experimental.&nbsp; It is not accessible unless it has been enabled, with the Advanced tab of Raspbi-Config, which modifies /boot/config.txt. For me, selecting this option wrote the extra line,<br />dtoverlay=vc4-kms-v3d, and commented out my line, gpu_mem=256.&nbsp; It also prevented my RPi from booting, so I had to edit /boot/config.txt on the SD card with another laptop to put it back to how it was.&nbsp; I am hoping that OpenGL will be working fully before long. </p><p>See also:<br /><a href="http://www.linuxjournal.com/content/raspberry-pi-gets-opengl-support">http://www.linuxjournal.com/content/ras … gl-support</a><br /><a href="http://hackaday.com/2012/07/06/opengl-on-the-raspi/">http://hackaday.com/2012/07/06/opengl-on-the-raspi/</a><br /><a href="https://benosteen.wordpress.com/2012/04/27/using-opengl-es-2-0-on-the-raspberry-pi-without-x-windows/">https://benosteen.wordpress.com/2012/04 … x-windows/</a><br /><a href="https://www.raspberrypi.org/forums/viewtopic.php?f=28&amp;t=138798">https://www.raspberrypi.org/forums/view … p;t=138798</a></p><p>---<br />John</p>]]></description>
			<author><![CDATA[null@example.com (JohnWasilewski)]]></author>
			<pubDate>Thu, 30 Jun 2016 19:57:23 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=2569#p2569</guid>
		</item>
	</channel>
</rss>
