2013/4/5 <[email protected]>

> I'm trying to build an i686 RPM package on a x86_64 Linux machine.
>
> I have a set(CPACK_RPM_PACKAGE_ARCHITECTURE i686)
> but I get an error at CPack time:
> error: No compatible architectures found for build
>
> I can get it to work if I also use setarch when calling rpmbuild giving it
> the CPack generated RPM spec file, like so:
> setarch i686 rpmbuild --bb --define "_topdir $PWD" --buildroot
> $PWD/<mypath>   SPECS/myspec.spec
>
>
> Doing the equivalent for a Debian package seemed to work by simply setting
> set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE i386)
>
> Is there some way to make this work automatically within cpack?
>

CPack wasn't design for "cross-packaging" so any usage like this may fail
at some point.

the CPACK_RPM_PACKAGE_ARCHITECTURE was tested only
for the "noarch" case where the developper knows he can force noarch
because the package contains no arch-dependent part i.e.:
an RPM containing only script or data file etc...

That's basically what the doc says:
cpack --help-variable CPACK_RPM_PACKAGE_ARCHITECTURE

Now,
setarch <ARCH> rpmbuild etc... seems the appropriate way to proceed.
however the (setarch) doc seems to say that you need to use --target=<arch>
as well:
i.e.

setarch i686 rpmbuild --target=i686 --bb --define "_topdir $PWD"
--buildroot $PWD/<mypath>   SPECS/myspec.spec

Adding this way of work to CPackRPM.cmake should be quite easy.

It would simply be necessary to check whether if
CPACK_RPM_PACKAGE_ARCHITECTURE
has been set or not and differentiate the noarch case from the
"arch specific but not native" case.

I guess this still leave the door open for error if non-native libraries
your
package depends upon are installed in a non-unified way
on various native arch.

This is solved on "Debian MultiArch" see:
http://wiki.debian.org/Multiarch

For RPM-based distros I don't really know.

Basically you may be able to build an i686 RPM package on a x86_64 host
but may be in the end this package would not be installable on a i686 host,
or this may work on some distros and fails on others...

I think you get what I mean.

-- 
Erk
Le gouvernement représentatif n'est pas la démocratie --
http://www.le-message.org
--

Powered by www.kitware.com

Visit other Kitware open-source projects at 
http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the CMake FAQ at: 
http://www.cmake.org/Wiki/CMake_FAQ

Follow this link to subscribe/unsubscribe:
http://www.cmake.org/mailman/listinfo/cmake

Reply via email to