Menu

#179 cross-building support

autogen
closed
None
1
2020-09-14
2016-08-06
No

Hello,
find attached two patches by Helmut Grohe to improve cross-building support:
05_cross_pkg_config.diff: Invoke the triplet prefixed pkg-config. Otherwise pkg-config examines the build architecture which usually doesn't have the relevant dependencies installed or whose flags is different.
04_crossbuild.diff Do not run host arch executables during cross build. When cross building autogen, one has to install autogen for the build architecture, because it uses itself during build.

cu Andreas

1 Attachments

Discussion

  • Andreas Metzler

    Andreas Metzler - 2016-08-06

    second patch

     
  • Bruce Korb

    Bruce Korb - 2016-08-08
    • status: open --> accepted
    • assigned_to: Bruce Korb
     
  • Bruce Korb

    Bruce Korb - 2016-08-08

    The first patch neglects to define PKG_CONFIG, in case it is not pre-defined. I'll fix that and roll a release in a few days. Thanks!

     
  • Bruce Korb

    Bruce Korb - 2016-08-29

    This patch incorporates the 04 patch and a rework of the 05 patch. Basically:

    --- a/config/misc.def
    +++ b/config/misc.def
    @@ -340,7 +340,12 @@ test = {

    do-always = <<- END_ALWAYS
    GUILE_FLAGS
    - [ag_gv=gdir=\pkg-config --cflags-only-I \ + [test -x "${PKG_CONFIG}" || {
    + test -z "${PKG_CONFIG}" && PKG_CONFIG=pkg-config
    + f=command -v ${PKG_CONFIG}
    + test -x "${f}" && PKG_CONFIG="$f"
    + }
    + ag_gv=gdir=\${PKG_CONFIG} --cflags-only-I \ guile-${GUILE_EFFECTIVE_VERSION} | \ sed 's/-I //;s/ -I.*/ /g'`
    test -z "$gdir" && gdir=/usr/include

    I think that goes through the make-sure-it-works-right well enough to be platform independent. I will start running the new code through its paces. Thank you!

     
    • Andreas Metzler

      Andreas Metzler - 2016-08-29

      On 2016-08-29 Bruce Korb bkorb@users.sf.net wrote:

      This patch incorporates the 04 patch and a rework of the 05 patch. Basically:

      --- a/config/misc.def
      +++ b/config/misc.def
      @@ -340,7 +340,12 @@ test = {

      do-always = <<- END_ALWAYS
      GUILE_FLAGS
      - [ag_gv=gdir=\pkg-config --cflags-only-I \ + [test -x "${PKG_CONFIG}" || {
      + test -z "${PKG_CONFIG}" && PKG_CONFIG=pkg-config
      + f=command -v ${PKG_CONFIG}
      + test -x "${f}" && PKG_CONFIG="$f"
      + }
      + ag_gv=gdir=\${PKG_CONFIG} --cflags-only-I \ guile-${GUILE_EFFECTIVE_VERSION} | \ sed 's/-I //;s/ -I.*/ /g'`
      test -z "$gdir" && gdir=/usr/include

      I think that goes through the make-sure-it-works-right well enough to be platform independent. I will start running the new code through its paces. Thank you!

      Hello,

      this seems to miss the point of the patch. It is not about finding a
      executable pkg-config but correct results in cross-building szenario.
      Afaiu for cross-building /usr/bin/pkg-config produces incorrect results,
      since it looks at the host-system's pc files. Whereas
      /usr/bin/host-triplet_pkg-config checks the pc files for host-triplet.

      https://autotools.io/pkgconfig/cross-compiling.html

      ${PKG_CONFIG} should be set by PKG_PROG_PKG_CONFIG.

      cu Andreas

      What a good friend you are to him, Dr. Maturin. His other friends are so grateful to you.'I sew his ears on from time to time, sure'

       
  • Bruce Korb

    Bruce Korb - 2016-08-29

    I think it should do the same as your original patch, with the exception that it expands out the program name to a full path name. IF PKG_CONFIG is set to a program name (say, for example, "host-triplet_pkg-config"), THEN it should expand to the output of "command -v host-triplet_pkg-config". If PKG_CONFIG is already a full path, running it through "command -v" is a no-op.

    ${PKG_CONFIG} should be set by PKG_PROG_PKG_CONFIG.

    then the suggested patch should include adding PKG_PROG_PKG_CONFIG invocation and instructions on how to find the autoconf macro. I'd have no idea. Some distros (perhaps BSD ones) are vehemently opposed to pkg-config at all. Personally, I still prefer applying a glue layer to all targets that does all this backfill stuff. No glue layer? Then it doesn't build. Has the glue layer? Then the build just assumes a lot of stuff. That should be the direction, but likely not today.

     
    • Andreas Metzler

      Andreas Metzler - 2016-08-30

      On 2016-08-30 Bruce Korb bkorb@users.sf.net wrote:

      I think it should do the same as your original patch, with the
      exception that it expands out the program name to a full path name.
      IF PKG_CONFIG is set to a program name (say, for example,
      "host-triplet_pkg-config"), THEN it should expand to the output of
      "command -v host-triplet_pkg-config". If PKG_CONFIG is already a full
      path, running it through "command -v" is a no-op.
      [...]

      I see. Thanks for the explanation.

      cu Andreas

       
  • Andreas Metzler

    Andreas Metzler - 2016-09-03

    Looks like the part of the patch that changes config/ag_macros.m4 was not included in 5.18.12. Perhaps you forgot regenenerate it from the changed config/misc.def?

    cu Andreas

     
  • Bruce Korb

    Bruce Korb - 2017-09-11

    Reminder to self: take a closer look

     
  • Bruce Korb

    Bruce Korb - 2017-10-19
    • status: accepted --> pending
     
  • Bruce Korb

    Bruce Korb - 2020-09-14
    • status: pending --> closed
     
  • Bruce Korb

    Bruce Korb - 2020-09-14

    fixed

     

Log in to post a comment.