Fix subsequent cmake runs when using multi-arch

Bug #1472314 reported by Rohan Garg
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
cmake (Ubuntu)
Expired
Medium
Unassigned

Bug Description

Running cmake a second time on a project when using multi-arch seems to be broken without this patch in Ubuntu.

NB: This is a patch to a patch :)

Tags: patch
Revision history for this message
Rohan Garg (rohangarg) wrote :
description: updated
Revision history for this message
Dimitri John Ledkov (xnox) wrote :

How to reproduce this? and what do you mean by running a second time?

Cause, mutliarch file only kicks in when environmental variables are set correctly pointing at cross-arch build/host combination and otherwise does nothing and defaults to a normal native compilation.

Imho this patch should not be required, and multiarch file should not be used as a normal cmake toolchain file.

tags: added: patch
Revision history for this message
Aleix Pol (aleixpol-kde) wrote :

log that reproduces the error:
mkdir build; cd build; cmake ..; cmake ..

The second time that it's configured cmake doesn't need to detect the platform anymore so CMakeDetermineSystem.cmake isn't called anymore as it calls the Platform file directly.

Revision history for this message
Aleix Pol (aleixpol-kde) wrote :

Ping?

Mathew Hodson (mhodson)
Changed in cmake (Ubuntu):
importance: Undecided → Medium
Revision history for this message
Michael Terry (mterry) wrote :

So I am also unsure of what exactly your scenario is (what the reproduction steps are).

Without any environment variables, cross compiling isn't used, so this bug isn't hit. It's only when you set environment variables to use cross compilers that you might hit this scenario. But if you look at, for example, dpkg-cross(1), it recommends setting:

        export CC=$(DEB_HOST_GNU_TYPE)-gcc
        export CXX=$(DEB_HOST_GNU_TYPE)-g++
        export CMAKE_TOOLCHAIN_FILE=/etc/dpkg-cross/cmake/CMakeCross.txt

Thus manually setting CMAKE_TOOLCHAIN_FILE seems to be a standard part of the documentation. What steps are you using to cross compile?

Changed in cmake (Ubuntu):
status: New → Incomplete
Revision history for this message
Dimitri John Ledkov (xnox) wrote : Re: [Bug 1472314] Re: Fix subsequent cmake runs when using multi-arch

On 22 December 2015 at 17:05, Michael Terry <email address hidden> wrote:
> So I am also unsure of what exactly your scenario is (what the
> reproduction steps are).
>
> Without any environment variables, cross compiling isn't used, so this
> bug isn't hit. It's only when you set environment variables to use
> cross compilers that you might hit this scenario. But if you look at,
> for example, dpkg-cross(1), it recommends setting:
>
> export CC=$(DEB_HOST_GNU_TYPE)-gcc
> export CXX=$(DEB_HOST_GNU_TYPE)-g++
> export CMAKE_TOOLCHAIN_FILE=/etc/dpkg-cross/cmake/CMakeCross.txt
>
> Thus manually setting CMAKE_TOOLCHAIN_FILE seems to be a standard part
> of the documentation. What steps are you using to cross compile?

that's for debian.

i've patched ubuntu cmake toolchain files to be sensitive to
DEB_HOST|BUILD_ARCH and thus not requiring any special variables to be
exported. This enabled cross-compilation of most cmake projects and
debian packages out of the box on ubuntu, e.g. in chroots such as
prepared with mk-sbuild and/or click chroot without any modifications
to build rules.

As per debian policy, one should be able to build projects twice in a
row, if and only if a full clean is done in between. e.g.
./debian/rules build clean build -> should work, and it does work with
these patches.

I'm not sure what bug is hit and why. Because one should purge all of
build dir to get cmake caches to its senses =0

--
Regards,

Dimitri.

Revision history for this message
Sebastien Bacher (seb128) wrote :

unsubscribing sponsors while it's needing info, subscribe ubuntu-sponsors back once there is something ready for review

Revision history for this message
Launchpad Janitor (janitor) wrote :

[Expired for cmake (Ubuntu) because there has been no activity for 60 days.]

Changed in cmake (Ubuntu):
status: Incomplete → Expired
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.