<div dir="ltr"><br><div class="gmail_extra"><br><br><div class="gmail_quote">2013/4/5  <span dir="ltr">&lt;<a href="mailto:clinton@elemtech.com" target="_blank">clinton@elemtech.com</a>&gt;</span><br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div><div style="font-size:12pt;font-family:times new roman,new york,times,serif"><div>I&#39;m trying to build an i686 RPM package on a x86_64 Linux machine.</div><div><br></div><div><span style="font-size:12pt">I have a set(CPACK_RPM_PACKAGE_ARCHITECTURE i686)</span></div>
<div><span style="font-size:12pt">but I get an error at CPack time:</span></div><div><span style="font-size:12pt">error: No compatible architectures found for build</span></div><div><br></div><div><span style="font-size:12pt">I can get it to work if I also use setarch when calling rpmbuild giving it the CPack generated RPM spec file, like so:</span></div>
<div><span style="font-size:12pt">setarch i686 rpmbuild --bb --define &quot;_topdir $PWD&quot; --buildroot $PWD/&lt;mypath&gt;   SPECS/myspec.spec</span></div><div><span style="font-size:12pt"><br></span></div><div><div><span style="font-size:12pt"><br>
</span></div><div><span style="font-size:12pt">Doing the equivalent for a Debian package seemed to work by simply setting</span></div><div><span style="font-size:12pt">set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)</span></div>
</div><div><span style="font-size:12pt"><br></span></div><div><span style="font-size:12pt">Is there some way to make this work automatically within cpack?</span></div></div></div></blockquote><div> <br></div><div>CPack wasn&#39;t design for &quot;cross-packaging&quot; so any usage like this may fail<br>
</div><div>at some point.<br></div><div><br></div><div>the <span style="font-size:12pt">CPACK_RPM_PACKAGE_ARCHITECTURE was tested only<br></span></div><div><span style="font-size:12pt">for the &quot;noarch&quot; case where the developper knows he can force noarch<br>
</span></div><div><span style="font-size:12pt">because the package contains no arch-dependent part i.e.:<br></span></div><div><span style="font-size:12pt">an RPM containing only script or data file etc...<br><br></span><span style="font-size:12pt"><span style="font-size:12pt">That&#39;s basically what the doc says:<br>
cpack --help-variable CPACK_RPM_PACKAGE_ARCHITECTURE<br><br></span></span></div><div><span style="font-size:12pt"><span style="font-size:12pt">Now,<br></span></span></div><div><span style="font-size:12pt">setarch &lt;ARCH&gt; </span><span style="font-size:12pt">rpmbuild etc... seems the appropriate way to proceed.<br>
</span></div><div><span style="font-size:12pt">however the (setarch) doc seems to say that you need to use --target=&lt;arch&gt; as well:<br></span></div><div><span style="font-size:12pt">i.e.<br></span></div><div><br><span style="font-size:12pt">setarch i686 rpmbuild --target=i686 --bb --define &quot;_topdir $PWD&quot; --buildroot $PWD/&lt;mypath&gt;   SPECS/myspec.spec</span></div>
<div><span style="font-size:12pt"><br></span></div><div><span style="font-size:12pt">Adding this way of work to CPackRPM.cmake should be quite easy.<br><br></span></div><div><span style="font-size:12pt">It would simply be necessary to check whether if CPACK_RPM_PACKAGE_ARCHITECTURE<br>
</span></div><div><span style="font-size:12pt">has been set or not and differentiate the noarch case from the<br></span></div><div><span style="font-size:12pt">&quot;arch specific but not native&quot; case.<br><br></span></div>
<div><span style="font-size:12pt">I guess this still leave the door open for error if non-native libraries your<br>package depends upon are installed in a non-unified way<br>on various native arch.<br><br></span></div><div>
<span style="font-size:12pt">This is solved on &quot;Debian MultiArch&quot; see:<br><a href="http://wiki.debian.org/Multiarch">http://wiki.debian.org/Multiarch</a><br><br></span></div><div><span style="font-size:12pt">For RPM-based distros I don&#39;t really know.<br>
<br></span></div><div><span style="font-size:12pt">Basically you may be able to build an i686 RPM package on a x86_64 host<br></span></div><div><span style="font-size:12pt">but may be in the end this package would not be installable on a i686 host,<br>
</span></div><div><span style="font-size:12pt">or this may work on some distros and fails on others...<br></span></div><div><span style="font-size:12pt"><br></span></div><div><span style="font-size:12pt">I think you get what I mean.<br>
<br></span></div></div>-- <br>Erk<br>Le gouvernement représentatif n&#39;est pas la démocratie -- <a href="http://www.le-message.org" target="_blank">http://www.le-message.org</a>
</div></div>