After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 740004 - use pkg-config to check for version of libparted
use pkg-config to check for version of libparted
Status: RESOLVED FIXED
Product: gparted
Classification: Other
Component: application
GIT HEAD
Other Linux
: Normal normal
: ---
Assigned To: gparted maintainers alias
gparted maintainers alias
Depends on:
Blocks:
 
 
Reported: 2014-11-12 11:48 UTC by Andreas Müller
Modified: 2015-01-26 18:26 UTC
See Also:
GNOME target: ---
GNOME version: ---


Attachments
Use pkg-config check for libparted version first (v1) (5.54 KB, patch)
2014-11-15 17:45 UTC, Mike Fleetwood
none Details | Review
Use pkg-config check for libparted version first (v2) (5.55 KB, patch)
2014-11-19 13:28 UTC, Mike Fleetwood
none Details | Review

Description Andreas Müller 2014-11-12 11:48:33 UTC
running test programs causes headaches when cross-compiling
Comment 1 Mike Fleetwood 2014-11-12 14:09:26 UTC
Hi Andreas,

I an not familiar with the difficulties when cross-compiling.  I assume
you are talking about the checks in configure.ac?  I further assume that
just these compile checks are problematic:
* libparted ped_get_version() check
* availability of set_default_icon_name() check

Unfortunately not all distros provide a pkg-config file for parted/
libparted so we compile a test program to determine version and
therefore supported features.

As noted in the comment for the set_default_icon_name() availability
check, using the version reported by pkg-config leads to an incorrect
determination on RHEL/CentOS 5.

I welcome suggestions for how these checks could be accomplished in the
compiling locally case yet help in the cross-compiling case.

Thanks,
Mike
Comment 2 Andreas Müller 2014-11-13 13:37:42 UTC
Hi Mike,

> I an not familiar with the difficulties when cross-compiling.  I assume
> you are talking about the checks in configure.ac?  I further assume that
> just these compile checks are problematic:
> * libparted ped_get_version() check
Yes. Problem with cross compiling: Since the binaries build are for
different machines, you can run test applications only with quemu
quirks.
> * availability of set_default_icon_name() check
No

> Unfortunately not all distros provide a pkg-config file for parted/
> libparted so we compile a test program to determine version and
> therefore supported features.
I was not aware of that and understand now why this solution was selected.

> I welcome suggestions for how these checks could be accomplished in the
> compiling locally case yet help in the cross-compiling case.
>
Have no good solution for both cases (missing pc-files /
cross-building). So I suggests you forget this patch and I leave
it in my environment (yocto).

Andreas
Comment 3 Mike Fleetwood 2014-11-13 15:19:51 UTC
Hi Andreas,

It's mostly older distros which don't provide pkg-config files for
parted, where as newer ones do.

Would it be useful for your cross-compiling case if configure queried
pkg-config for libparted version and if that failed, falls back to
compiling a test program like it does now?

Mike
Comment 4 Andreas Müller 2014-11-13 15:56:09 UTC
Hi Mike,

Hey that would be cool. 

Ehm my time and autotools knowlegde are limited and so.. Could you do that?

Andreas
Comment 5 Curtis Gedak 2014-11-13 16:35:08 UTC
Hi Andreas,

Out of curiousity, what computer system are you cross-compiling for?

Curtis
Comment 6 Mike Fleetwood 2014-11-14 09:32:47 UTC
Hi Andreas,

I'm happy to write a fix, but I would need you to test it in your
cross-compile environment to confirm it works and is better.

Thanks,
Mike
Comment 7 Andreas Müller 2014-11-14 09:39:50 UTC
Hi Curtis,

all kind of ARM based boards:

Currently most time I spend on:
Gumstix overo https://store.gumstix.com/index.php/category/33/
Variscite VAR-SOM-MX6 http://www.variwiki.com/index.php?title=VAR-SOM-MX6

On my desktop or in some drawer
Beaglebone Black http://beagleboard.org/black
RaspberryPi http://www.raspberrypi.org/
Toradex Colibri T30 https://www.toradex.com/de/products/colibri-arm-computer-modules/nvidia-tegra-3-computer-module
Karo TX28 http://www.karo-electronics.de/tx28.html

And all started with
ICnova AP7000 Base (grasshopper) http://shop.in-circuit.de/products/Home/ICnova-CPU-Module/57/ICnova-AP7000-Base

Think that's the current collection :)

Andreas
Comment 8 Andreas Müller 2014-11-14 09:41:58 UTC
Hi Mike,

Thanks for taking care - and of course I'll test your changes and let you know.

Andreas
Comment 9 Curtis Gedak 2014-11-14 16:19:34 UTC
Thanks Andreas for the prompt response.  It would appear that you have quite the collection of development boards.  :-)

There are Debian packages of GParted for many different architectures.
https://packages.debian.org/search?keywords=gparted

What I don't know is if all of these packages are compiled on the native architectures.  Perhaps there is a guide or how-to on the Internet with tips for developers and cross compiling....
Comment 10 Mike Fleetwood 2014-11-15 17:45:20 UTC
Created attachment 290764 [details] [review]
Use pkg-config check for libparted version first (v1)

Hi Andreas,

Here's the patch which makes configure query libparted version via
pkg-config first and via test program to query libparted directly
second.

To test you you'll have to fetch GParted git repo and use git am to
apply the patch.  (Follow step 7 "Final review, apply, compile and test"
from http://gparted.org/git.php#create-patch).

Thanks,
Mike
Comment 11 Curtis Gedak 2014-11-15 18:16:57 UTC
Hi Mike,

Thanks for developing this patch set.

Often I run and test with a more recent unpackaged libparted version than what the distro has packaged.  As such I tested what would happen when a distro libparted package is installed, and there is also a locally compiled and linked newer libparted in /usr/local.  Basically I tested building using a specific libparted version.

Building using a Specific (lib)parted Version
https://git.gnome.org/browse/gparted/tree/README?id=GPARTED_0_20_0#n145

The result was that all worked as expected with this patch set.  When the appropriate environment variables are set, GParted will compile and link with the specific version.  :-)

I guess the real test will be if this works for Andreas.

Curtis
Comment 12 Mike Fleetwood 2014-11-15 19:34:20 UTC
Hi Curtis,

It's good to know that it works with locally installed libparted too.
This was a test I hadn't even though of.


Now ./configure reports either this:

    checking for libparted >= 1.7.1 (querying pkg-config)... 2.4

or:

    checking for libparted >= 1.7.1 (querying pkg-config)... not found
    checking for libparted >= 1.7.1 (querying libparted)... 1.8.1

depending on whether a libparted.pc pkg-config file exits or not.


So far I've tested all the paths through the new config code:
    pkg-config reports new enough
    pkg-config reports too old
    no pkg-config file
        libparted new enough
        libparted too old
        query libparted program fails to compile
        query libparted program error exits
And performed "make distcheck" on:
  CentOS 5, 6, 7


After Andreas reports, I plan to do "make distcheck" tests on all the
other distro I have too.


Thanks,
Mike
Comment 13 Andreas Müller 2014-11-17 10:47:09 UTC
Hi Mike,

Tested and happy!

configure:16954: checking for libparted >= 1.7.1 (querying pkg-config)
configure:16959: $PKG_CONFIG --exists --print-errors "libparted"
configure:16962: $? = 0
configure:16967: result: 3.1

and after update of parted to 3.2 (to see if it does not detect my host's parted)

configure:16954: checking for libparted >= 1.7.1 (querying pkg-config)
configure:16959: $PKG_CONFIG --exists --print-errors "libparted"
configure:16962: $? = 0
configure:16967: result: 3.2


Thanks very much

Andreas
Comment 14 Mike Fleetwood 2014-11-19 13:28:04 UTC
Created attachment 290994 [details] [review]
Use pkg-config check for libparted version first (v2)

Hi Curtis,

I have now also successfully run "make distcheck" on the following
additional distributions:
Debian 6,
Fedora 14, 20, 21, Rawhide (22)
Kubuntu 12.04 LTS, Xubuntu 14.04 LTS

Changed the bug description slightly to reflect that the request was to
use pkg-config to query the version of libparted and not gparted.
Updated patch to match.

Thanks,
Mike
Comment 15 Curtis Gedak 2014-11-20 22:19:22 UTC
Great work on this patch set Mike.  I retested the development scenario I mentioned in comment #11 and all went well.  :-)

The patch set in comment #14 has been committed to the GNOME repository for inclusion in the next release of GParted.

The relevant git commits can be viewed at the following links:

Use pkg-config Autoconf check for libparted version first (#740004)
https://git.gnome.org/browse/gparted/commit/?id=9c7cb6f4965349a2fec0ec16056beff6b8c5d3ce

Avoid splitting Autoconf check message for libparted version (#740004)
https://git.gnome.org/browse/gparted/commit/?id=5a93a9c432e9fe62ac4df16d96aeb9def81bfd6a
Comment 16 Curtis Gedak 2015-01-26 18:26:28 UTC
This enhancement was included in the GParted 0.21.0 release on January 26, 2015.