<!-- 
RSS generated by JIRA (8.3.4#803005-sha1:1f96e09b3c60279a408a2ae47be3c745f571388b) at Sat Feb 10 16:39:26 JST 2024

It is possible to restrict the fields that are returned in this document by specifying the 'field' parameter in your request.
For example, to request only the issue key and summary append 'field=key&field=summary' to the URL of your request.
-->
<rss version="0.92" >
<channel>
    <title>PFS-JIRA</title>
    <link>https://pfspipe.ipmu.jp/jira</link>
    <description>This file is an XML representation of an issue</description>
    <language>en-us</language>    <build-info>
        <version>8.3.4</version>
        <build-number>803005</build-number>
        <build-date>13-09-2019</build-date>
    </build-info>


<item>
            <title>[INSTRM-1785] Fix conda gcc linking of external libraries.</title>
                <link>https://pfspipe.ipmu.jp/jira/browse/INSTRM-1785</link>
                <project id="10300" key="INSTRM">Instrument control development</project>
                    <description>&lt;p&gt;The agcc actor requires building a cython module for the external FLI camera library. That library uses the external libusb-1.0.so to actually connect to the device.&lt;/p&gt;

&lt;p&gt;With rubin3-ics, the extension .so is built but does not then load libusb. &lt;/p&gt;

&lt;p&gt;Bad:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;(conda-ics) pfs-data@AGCC-OptiPlex-755:ics_agccActor-pfsdata$ ldd fli_camera.cpython-38-x86_64-linux-gnu.so
	linux-vdso.so.1 =&amp;gt;  (0x00007ffd177d8000)
	libc.so.6 =&amp;gt; /lib/x86_64-linux-gnu/libc.so.6 (0x00007f9688095000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f968845e000)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;Good:&lt;/p&gt;

&lt;div class=&quot;preformatted panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;preformattedContent panelContent&quot;&gt;
&lt;pre&gt;(conda-ics) pfs-data@AGCC-OptiPlex-755:ics_agccActor-pfsdata$ ldd fli_camera.cpython-38-x86_64-linux-gnu.so
	linux-vdso.so.1 =&amp;gt;  (0x00007ffcde7f6000)
	libusb-1.0.so.0 =&amp;gt; /software/conda/envs/rubin3_ics/lib/libusb-1.0.so.0 (0x00007f2fc1bad000)
	libc.so.6 =&amp;gt; /lib/x86_64-linux-gnu/libc.so.6 (0x00007f2fc165d000)
	libudev.so.1 =&amp;gt; /software/conda/envs/rubin3_ics/lib/./libudev.so.1 (0x00007f2fc1b60000)
	libatomic.so.1 =&amp;gt; /software/conda/envs/rubin3_ics/lib/./libatomic.so.1 (0x00007f2fc1b54000)
	libpthread.so.0 =&amp;gt; /lib/x86_64-linux-gnu/libpthread.so.0 (0x00007f2fc143f000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f2fc1a26000)
	librt.so.1 =&amp;gt; /lib/x86_64-linux-gnu/librt.so.1 (0x00007f2fc1237000)
&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;

&lt;p&gt;rubin3-ics switched from using the system compilers to using the conda compiler packages. These are set up by &lt;tt&gt;/software/conda/envs/rubin3_ics/etc/conda/activate.d/activate-gcc_linux-64.sh&lt;/tt&gt;&lt;/p&gt;

&lt;p&gt;One flag which conda adds is &lt;tt&gt;&lt;del&gt;Wl,&lt;/del&gt;&lt;del&gt;as-needed&lt;/tt&gt;, and that is what causes the external libraries to be trimmed. I have not figured if that is really correct, nor how to bypass it. You can add &lt;tt&gt;-Wl,&lt;/del&gt;-no-as-needed&lt;/tt&gt; to the &lt;tt&gt;extra_ld_args&lt;/tt&gt; Extension arguments, but that is added too late in the gcc call: that argument needs to come &lt;b&gt;before&lt;/b&gt; the listings of the object files and libraries. So the distutils quick fix does not work here, and I have not found a better one.&lt;/p&gt;

&lt;p&gt;This cannot be right. Surely many Extensions out there require external libraries. So I am missing something. &lt;/p&gt;

&lt;p&gt;If this is right, we can simply edit the &lt;tt&gt;/software/conda/envs/rubin3_ics/etc/conda/activate.d/activate-gcc_linux-64.sh&lt;/tt&gt; file. Yuck.&lt;/p&gt;</description>
                <environment></environment>
        <key id="23107">INSTRM-1785</key>
            <summary>Fix conda gcc linking of external libraries.</summary>
                <type id="1" iconUrl="https://pfspipe.ipmu.jp/jira/secure/viewavatar?size=xsmall&amp;avatarId=10503&amp;avatarType=issuetype">Bug</type>
                                            <priority id="10000" iconUrl="https://pfspipe.ipmu.jp/jira/images/icons/priorities/medium.svg">Normal</priority>
                        <status id="10100" iconUrl="https://pfspipe.ipmu.jp/jira/images/icons/statuses/generic.png" description="No further work should be done on this.">Won&apos;t Fix</status>
                    <statusCategory id="3" key="done" colorName="green"/>
                                    <resolution id="2">Won&apos;t Fix</resolution>
                                        <assignee username="-1">Unassigned</assignee>
                                    <reporter username="cloomis">cloomis</reporter>
                        <labels>
                    </labels>
                <created>Fri, 11 Nov 2022 14:10:09 +0000</created>
                <updated>Mon, 14 Nov 2022 23:16:43 +0000</updated>
                            <resolved>Fri, 11 Nov 2022 17:20:44 +0000</resolved>
                                                                        <due></due>
                            <votes>0</votes>
                                    <watches>2</watches>
                                                                <comments>
                            <comment id="31788" author="cloomis" created="Fri, 11 Nov 2022 17:20:44 +0000"  >&lt;p&gt;Mistaken. The issue for the agccActor was that with `--as-needed`, the order of libraries matters (again), as it should. Fix pushed there.&lt;/p&gt;

&lt;p&gt;FWIW or for reference, the following page was the most helpful one I found: &lt;a href=&quot;https://wiki.gentoo.org/wiki/Project:Quality_Assurance/As-needed&quot; class=&quot;external-link&quot; rel=&quot;nofollow&quot;&gt;https://wiki.gentoo.org/wiki/Project:Quality_Assurance/As-needed&lt;/a&gt;&lt;/p&gt;</comment>
                            <comment id="31799" author="chyan" created="Mon, 14 Nov 2022 19:02:32 +0000"  >&lt;p&gt;Actually, I found a possible fix.  By removing the default  &lt;del&gt;Wl,&lt;/del&gt;-as-needed  from  LDFLAGS, I can compile flight_camera package without problem.&lt;/p&gt;


&lt;div class=&quot;code panel&quot; style=&quot;border-width: 1px;&quot;&gt;&lt;div class=&quot;codeContent panelContent&quot;&gt;
&lt;pre class=&quot;code-java&quot;&gt;
from distutils.extension &lt;span class=&quot;code-keyword&quot;&gt;import&lt;/span&gt; Extension
from Cython.Distutils &lt;span class=&quot;code-keyword&quot;&gt;import&lt;/span&gt; build_ext
&lt;span class=&quot;code-keyword&quot;&gt;import&lt;/span&gt; sdss3tools
&lt;span class=&quot;code-keyword&quot;&gt;import&lt;/span&gt; os
&lt;span class=&quot;code-keyword&quot;&gt;import&lt;/span&gt; numpy

os.environ[&lt;span class=&quot;code-quote&quot;&gt;&apos;LDFLAGS&apos;&lt;/span&gt;]=&lt;span class=&quot;code-quote&quot;&gt;&quot;-Wl,-O2 -Wl,--sort-common -Wl,-z,relro -Wl,&quot;&lt;/span&gt;\
    &lt;span class=&quot;code-quote&quot;&gt;&quot;-z,now -Wl,--disable-&lt;span class=&quot;code-keyword&quot;&gt;new&lt;/span&gt;-dtags -Wl,--gc-sections -Wl,--allow-shlib-undefined &quot;&lt;/span&gt;\
    &lt;span class=&quot;code-quote&quot;&gt;&quot;-Wl,-rpath,/software/conda/envs/rubin3_ics/lib &quot;&lt;/span&gt;\
    &lt;span class=&quot;code-quote&quot;&gt;&quot;-Wl,-rpath-link,/software/conda/envs/rubin3_ics/lib -L/software/conda/envs/rubin3_ics/lib&quot;&lt;/span&gt;

FLI_module = Extension(
    &lt;span class=&quot;code-quote&quot;&gt;&quot;fli_camera&quot;&lt;/span&gt;,
    [&lt;span class=&quot;code-quote&quot;&gt;&quot;python/agccActor/fli/fli_camera.pyx&quot;&lt;/span&gt;],
    library_dirs = [&lt;span class=&quot;code-quote&quot;&gt;&quot;c/libfli-1.999.1-180223&quot;&lt;/span&gt;],
    libraries = [&lt;span class=&quot;code-quote&quot;&gt;&quot;usb-1.0&quot;&lt;/span&gt;,&lt;span class=&quot;code-quote&quot;&gt;&quot;fli&quot;&lt;/span&gt;],
    include_dirs = [&lt;span class=&quot;code-quote&quot;&gt;&quot;c/libfli-1.999.1-180223&quot;&lt;/span&gt;,
                    &lt;span class=&quot;code-quote&quot;&gt;&quot;python/agccActor/fli&quot;&lt;/span&gt;,
                    numpy.get_include()],
)

sdss3tools.setup(
    name = &lt;span class=&quot;code-quote&quot;&gt;&quot;agcc&quot;&lt;/span&gt;,
    description = &lt;span class=&quot;code-quote&quot;&gt;&quot;Subaru PFI AGCC actor.&quot;&lt;/span&gt;,
    cmdclass = {&lt;span class=&quot;code-quote&quot;&gt;&quot;build_ext&quot;&lt;/span&gt;: build_ext},
    ext_modules = [FLI_module]
)


&lt;/pre&gt;
&lt;/div&gt;&lt;/div&gt;</comment>
                            <comment id="31801" author="cloomis" created="Mon, 14 Nov 2022 23:16:43 +0000"  >&lt;p&gt;It turns out the &lt;b&gt;only&lt;/b&gt; problem was the order of the libraries. If you change that line to &lt;tt&gt;libraries = &lt;span class=&quot;error&quot;&gt;&amp;#91;&amp;quot;fli&amp;quot;,&amp;quot;usb-1.0&amp;quot;&amp;#93;&lt;/span&gt;&lt;/tt&gt; the linking works without any other changes &amp;#8211; that change was pushed when I closed the ticket. The &lt;tt&gt;--as-needed&lt;/tt&gt; change just made that order important. Fooled me.&lt;/p&gt;</comment>
                    </comments>
                <issuelinks>
                            <issuelinktype id="10003">
                    <name>Relates</name>
                                                                <inwardlinks description="relates to">
                                        <issuelink>
            <issuekey id="22803">INSTRM-1615</issuekey>
        </issuelink>
                            </inwardlinks>
                                    </issuelinktype>
                    </issuelinks>
                <attachments>
                    </attachments>
                <subtasks>
                    </subtasks>
                <customfields>
                                                <customfield id="customfield_10500" key="com.atlassian.jira.plugins.jira-development-integration-plugin:devsummary">
                        <customfieldname>Development</customfieldname>
                        <customfieldvalues>
                            
                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                            <customfield id="customfield_10010" key="com.pyxis.greenhopper.jira:gh-lexo-rank">
                        <customfieldname>Rank</customfieldname>
                        <customfieldvalues>
                            <customfieldvalue>0|zzsvgv:</customfieldvalue>

                        </customfieldvalues>
                    </customfield>
                                                                                                                                                                                                                                        </customfields>
    </item>
</channel>
</rss>