<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Approximatrix Forums — SF/Linux static linking difficulty]]></title>
		<link>http://forums.approximatrix.com/viewtopic.php?id=582</link>
		<atom:link href="http://forums.approximatrix.com/extern.php?action=feed&amp;tid=582&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in SF/Linux static linking difficulty.]]></description>
		<lastBuildDate>Tue, 09 Aug 2016 17:04:23 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: SF/Linux static linking difficulty]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=2646#p2646</link>
			<description><![CDATA[<p>John,</p><p>I wouldn&#039;t go so far as to say you&#039;ve &quot;backed the wrong horse&quot; with Linux Mint.&nbsp; It&#039;s a relatively popular distribution.&nbsp; The issue really surrounds how each project packages their compiler and related libraries.&nbsp; There&#039;s good reasons not to support static linking, but it does make moving an executable between systems problematic (Simply Fortran for GNU/Linux, for example, is quite tedious to build for all its supported configurations). Additionally, while Debian and Ubuntu do provide static versions of their C and Fortran runtime libraries, OpenSUSE requires a specific package to be installed that isn&#039;t present by default.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Tue, 09 Aug 2016 17:04:23 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=2646#p2646</guid>
		</item>
		<item>
			<title><![CDATA[Re: SF/Linux static linking difficulty]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=2645#p2645</link>
			<description><![CDATA[<p>That is very interesting, Jeff, thank you.</p><p>Pretty disappointing about Linux Mint, though, because it means I&#039;ve backed the wrong horse, and should have put my money on (or rather. all the time I have spent in installing and sculpting, into) <br />Open SUSE, instead of Linux Mint.</p><p>Oh well. at some point when I have many hours to waste, I can start again with the OS, &#039;OS&#039;.<br />Until then, I&#039;ll take your advice and just build dynamically linked projects.</p><p>In case anyone needs help in how to do that:</p><p>Add the following line to the end of the text file, /etc/ld.so.conf file:<br />&nbsp; &nbsp; &nbsp;/usr/local/dislin<br />&nbsp; &nbsp; (don&#039;t add &quot;include /usr/local/dislin&quot;)<br />Rebuild the shared object files cache:<br />&nbsp; &nbsp;sudo ldconfig</p><p>In SF, Options -&gt; Project -&gt; Linking<br />&nbsp; &nbsp;un-tick &#039;All static&#039;<br />&nbsp; &nbsp;Then, build.</p><p>---<br />John</p>]]></description>
			<author><![CDATA[null@example.com (JohnWasilewski)]]></author>
			<pubDate>Tue, 09 Aug 2016 14:23:10 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=2645#p2645</guid>
		</item>
		<item>
			<title><![CDATA[Re: SF/Linux static linking difficulty]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=2641#p2641</link>
			<description><![CDATA[<p>John,</p><p>OpenSUSE actually allows and provides explicitly static versions of the glibc libraries for static linking, and Simply Fortran requires them by default.&nbsp; Other platforms are quite a bit more vague, but it seems to work on Debian and Ubuntu.&nbsp; Again, I don&#039;t know the specifics of Linux Mint&#039;s libraries and configurations.&nbsp; I would strongly suggest, though, that you just not use static linking.&nbsp; It appears that Linux Mint is not supplying many statically link-able libraries at all.</p><p>The <a href="http://www.musl-libc.org/">musl libc</a> is designed with static linking in mind, but it certainly will not fix the errors you&#039;re seeing above.&nbsp; It provides all the normal C runtime library functions.&nbsp; However, you&#039;d have to recompile the Fortran runtime libraries to make use of musl.&nbsp; It would not be pleasant.&nbsp; </p><p>I would symbolically link dislin&#039;s runtime libraries somewhere sensible, like <em>/usr/lib</em> or <em>/usr/local/lib</em>, and simply stick to dynamic linking.&nbsp; If you do eventually want a statically linked version, you&#039;ll have to compile it on something that supports all the underlying libraries in static form, such as Debian, Ubuntu, or OpenSUSE.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Sun, 07 Aug 2016 13:36:04 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=2641#p2641</guid>
		</item>
		<item>
			<title><![CDATA[Re: SF/Linux static linking difficulty]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=2639#p2639</link>
			<description><![CDATA[<p>Here are just a few of the many screenfuls of errors when I try STATIC linking:</p><br /><p>Generating Instruct64<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXm.a(Xmos.o): In function `XmeGetHomeDirName&#039;:<br />(.text+0xb0e): warning: Using &#039;getpwnam_r&#039; in statically linked applications requires at runtime the shared libraries from the glibc version used for linking<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXm.a(Xmos.o): In function `XmeGetHomeDirName&#039;:<br />(.text+0xb59): warning: Using &#039;getpwuid_r&#039; in statically linked applications requires at runtime the shared libraries from the glibc version used for linking<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libX11.a(xim_trans.o): In function `_XimXTransSocketINETConnect&#039;:<br />(.text+0xf07): warning: Using &#039;getaddrinfo&#039; in statically linked applications requires at runtime the shared libraries from the glibc version used for linking<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXm.a(Label.o): In function `Redisplay&#039;:<br />(.text+0xef8): undefined reference to `XftDrawSetClip&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXm.a(LabelG.o): In function `_XmRedisplayLabG&#039;:<br />(.text+0x3543): undefined reference to `XftDrawSetClip&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXm.a(XmString.o): In function `ComputeMetrics&#039;:<br /> :<br /> :<br /> :<br />(.text+0xc1af): undefined reference to `XftTextExtents16&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXm.a(XmString.o): In function `SubStringPosition&#039;:<br />(.text+0xc243): undefined reference to `XftTextExtents16&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXm.a(XmString.o): In function `_render&#039;:<br />(.text+0xe2c5): undefined reference to `XftDrawSetClip&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXm.a(TextF.o): In function `FindPixelLength.part.6&#039;:<br />(.text+0x1dbe): undefined reference to `XftTextExtentsUtf8&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXm.a(TextF.o): In function `FindPixelLength.part.6&#039;:<br />(.text+0x1f15): undefined reference to `XftTextExtentsUtf8&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXm.a(TextF.o): In function `FindPixelLength.part.6&#039;:<br />(.text+0x1fa5): undefined reference to `XftTextExtentsUtf8&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXm.a(TextF.o): In function `PrintableString&#039;:<br /> :<br /> :<br /> :<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXm.a(EditresCom.o): In function `DoGetGeometry&#039;:<br />(.text+0x1fbf): undefined reference to `_XEditResPutString8&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXm.a(EditresCom.o): In function `DoGetGeometry&#039;:<br />(.text+0x1fe9): undefined reference to `_XEditResPutWidgetInfo&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXm.a(EditresCom.o): In function `DoSetValues&#039;:<br />(.text+0x2126): undefined reference to `_XEditResPut16&#039;<br /> :<br /> :<br /> :<br />(.text+0x22f6): undefined reference to `_XEditResResetStream&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXm.a(EditresCom.o): In function `_XmEditResCheckMessages&#039;:<br />(.text+0x2305): undefined reference to `_XEditResPut8&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXm.a(Jpeg.o): In function `load_jpeg&#039;:<br />(.text+0x6c): undefined reference to `jpeg_std_error&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXm.a(Jpeg.o): In function `load_jpeg&#039;:<br /> :<br /> :<br /> :<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXt.a(Threads.o): In function `AppUnlock&#039;:<br />(.text+0x2fd): undefined reference to `pthread_mutex_unlock&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXt.a(Threads.o): In function `AppUnlock&#039;:<br />(.text+0x313): undefined reference to `pthread_mutex_unlock&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXt.a(Threads.o): In function `AppLock&#039;:<br />(.text+0x371): undefined reference to `pthread_mutex_unlock&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXt.a(Threads.o): In function `ProcessUnlock&#039;:<br />(.text+0x3c1): undefined reference to `pthread_mutex_unlock&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libXt.a(Threads.o):(.text+0x3d6): more undefined references to `pthread_mutex_unlock&#039; follow<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libX11.a(ClDisplay.o): In function `XCloseDisplay&#039;:<br />(.text+0xd3): undefined reference to `xcb_disconnect&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libX11.a(CrGlCur.o): In function `open_library&#039;:<br />(.text+0x32): undefined reference to `dlopen&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libX11.a(CrGlCur.o): In function `fetch_symbol&#039;:<br />(.text+0x61): undefined reference to `dlsym&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libX11.a(CrGlCur.o): In function `fetch_symbol&#039;:<br />(.text+0x85): undefined reference to `dlsym&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libX11.a(OpenDis.o): In function `OutOfMemory&#039;:<br />(.text+0x444): undefined reference to `xcb_disconnect&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/libX11.a(OpenDis.o): In function `XOpenDisplay&#039;:<br />(.text+0x87c): undefined reference to `xcb_get_setup&#039;<br /> :<br /> :<br /> :<br />/usr/lib/gcc/x86_64-linux-gnu/5/libgfortran.a(unit.o): In function `close_unit_1&#039;:<br />(.text.close_unit_1+0x11a): undefined reference to `pthread_mutex_destroy&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/libgfortran.a(unit.o): In function `_gfortrani_close_units&#039;:<br /> :<br /> :<br /> :<br />(.text._gfortrani_find_file+0x8a): undefined reference to `pthread_mutex_unlock&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/libgfortran.a(unix.o): In function `_gfortrani_find_file&#039;:<br />(.text._gfortrani_find_file+0x92): undefined reference to `pthread_mutex_lock&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/libgfortran.a(unix.o): In function `_gfortrani_find_file&#039;:<br /> :<br /> :<br /> :<br />/usr/lib/gcc/x86_64-linux-gnu/5/libgfortran.a(random.o): In function `_gfortrani_random_seed_i8&#039;:<br />(.text._gfortrani_random_seed_i8+0x132): undefined reference to `pthread_mutex_unlock&#039;<br /> :<br /> :<br /> :<br />/usr/lib/gcc/x86_64-linux-gnu/5/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `_Unwind_Find_FDE&#039;:<br />(.text+0x19c6): undefined reference to `pthread_mutex_lock&#039;<br />/usr/lib/gcc/x86_64-linux-gnu/5/libgcc_eh.a(unwind-dw2-fde-dip.o): In function `_Unwind_Find_FDE&#039;:</p>]]></description>
			<author><![CDATA[null@example.com (JohnWasilewski)]]></author>
			<pubDate>Sat, 06 Aug 2016 15:30:16 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=2639#p2639</guid>
		</item>
		<item>
			<title><![CDATA[Re: SF/Linux static linking difficulty]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=2638#p2638</link>
			<description><![CDATA[<p>Since you replied, Jeff, I&#039;ve added a bit more to my original post, if you&#039;d care to re-read it.<br />My aim is to provide a standalone executable, becauseI think it rather inelegant to have to supply various .so libraries plus instructions on where to put them, and how to edit system files before running ldconfig, to add them to the cache.<br />Is this really what one has to do with Linux?&nbsp; Is it really impractical to create statically-linked standalone executables?<br />--- <br />John</p>]]></description>
			<author><![CDATA[null@example.com (JohnWasilewski)]]></author>
			<pubDate>Sat, 06 Aug 2016 15:22:19 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=2638#p2638</guid>
		</item>
		<item>
			<title><![CDATA[Re: SF/Linux static linking difficulty]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=2637#p2637</link>
			<description><![CDATA[<p>John,</p><p>Can you post the actual error?&nbsp; </p><p>Static linking as an option should probably be off by default on the Linux version.&nbsp; Most Linux distributions don&#039;t even provide the static libraries for the Fortran and C runtime libraries by default.&nbsp; I have no idea what Linux Mint provides. </p><p>I would strongly recommend disabling static linking on Linux for your projects.&nbsp; There is very little reason to use it on those systems.&nbsp; It becomes necessary on Windows because the paths to the compiler runtime shared libraries are problematic.</p>]]></description>
			<author><![CDATA[null@example.com (jeff)]]></author>
			<pubDate>Sat, 06 Aug 2016 15:16:12 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=2637#p2637</guid>
		</item>
		<item>
			<title><![CDATA[SF/Linux static linking difficulty]]></title>
			<link>http://forums.approximatrix.com/viewtopic.php?pid=2636#p2636</link>
			<description><![CDATA[<p>With:<br />&nbsp; Linux Mint 18<br />&nbsp; 64-bit<br />&nbsp; SF 2.9</p><p>I have a large program, which compiles and links, apparently successfully.</p><p>It I try </p><p><strong><span class="bbu">DYNAMIC LINKING</span></strong></p><p><strong>(1) <span style="color:red">linking with Options &gt; Project &gt; Linker</span> : </strong><br />&nbsp; &nbsp; &nbsp;[ ]&nbsp; All static<br />&nbsp; &nbsp; &nbsp;[ ]&nbsp; Static Fortran runtime<br />&nbsp; &nbsp; &nbsp;[ ]&nbsp; Static C runtime<br />&nbsp; &nbsp; &nbsp;[ ]&nbsp; Static C++ runtime</p><p>&nbsp; [x] Build import library</p><p>or</p><p><strong>(2) <span style="color:red">linking with Options &gt; Project &gt; Linker</span> : </strong><br />&nbsp; &nbsp; &nbsp;[ ]&nbsp; All static<br />&nbsp; &nbsp; &nbsp;[x]&nbsp; Static Fortran runtime<br />&nbsp; &nbsp; &nbsp;[ ]&nbsp; Static C runtime<br />&nbsp; &nbsp; &nbsp;[ ]&nbsp; Static C++ runtime</p><p>&nbsp; [ ] Build import library</p><p>..then linking succeeds both times, but I can&#039;t run the executable.&nbsp; The console reports an error when loading shared object files, specificaly that it can&#039;t find <strong>libdislin.so.10</strong>.&nbsp; &nbsp; &nbsp;<br />I believe I can fix this by using ldconfig to add shared library libdislin.so.10 to the cached list of shared object files.<br />This is not what I&#039;m asking about.</p><p><strong><span class="bbu">STATIC LINKING</span></strong></p><p><strong>(3) <span style="color:red">linking with Options &gt; Project &gt; Linker</span> : </strong><br />&nbsp; &nbsp; &nbsp;[x]&nbsp; All static<br />&nbsp; &nbsp; &nbsp;[ ]&nbsp; Static Fortran runtime<br />&nbsp; &nbsp; &nbsp;[ ]&nbsp; Static C runtime<br />&nbsp; &nbsp; &nbsp;[ ]&nbsp; Static C++ runtime</p><p>&nbsp; [ ] Build import library</p><p>..then linking fails, giving a three warnings about statically linked applications requiring at runtime the shared libraries from the glibc version used for linking, plus a large number of errors due to undefined references.</p><p>I have searched briefly for information about this.&nbsp; Here is some of what I&#039;ve found:</p><p> - <em>glibc uses libnss to support a number of different providers for address <br />&nbsp; &nbsp;resolution services. Unfortunately, you cannot statically link libnss, as exactly <br />&nbsp; &nbsp;what providers it loads depends on the local system&#039;s configuration</em></p><p> - there is <em>a solution: you can use musl library to replace glibc. To use musl, <br />&nbsp; &nbsp;you can either install it and build your software using musl-gcc, or you can <br />&nbsp; &nbsp;use a Linux distribution that uses musl, e.g. Alpine Linux.c</em>.</p><p> - a lot of stuff about hoiw to solve static linking, which I did not understand.</p><p>Any suggestions, anyone?<br />--- <br />John</p>]]></description>
			<author><![CDATA[null@example.com (JohnWasilewski)]]></author>
			<pubDate>Sat, 06 Aug 2016 14:30:34 +0000</pubDate>
			<guid>http://forums.approximatrix.com/viewtopic.php?pid=2636#p2636</guid>
		</item>
	</channel>
</rss>
