Fix configuration version mismatch when using custom install of libparted (#753525)

When configuring GParted build with a custom install of libparted the
configure script is using the wrong version number for the version of
libparted.  It uses the version of the system install of libparted,
rather that the version of the specified custom install of libparted.

For example configuring GParted build on CentOS 7 with system provided
libparted 3.1 and custom install of libparted 3.2 from GIT in
/tmp/parted-3.2-git:
    $ export CPPFLAGS=-I/tmp/parted-3.2-git/include
    $ export LDFLAGS=-L/tmp/parted-3.2-git/lib
    $ export LD_RUN_PATH=/tmp/parted-3.2-git/lib
    $ ./configure
    ...
    checking for libparted >= 1.7.1 (querying pkg-config)... 3.1
    checking for 2.0 <= libparted <= 3.0 (loop table creation doesn't delete old partitions)... (cached) no
    checking for libparted >= 2.2 (improved pt re-read)... (cached) yes
    checking for ped_file_system_resize in -lparted... no
    checking for ped_file_system_resize in -lparted-fs-resize... yes
    checking for libparted >= 3.2 (online resize)... (cached) no
    ...
    $ make
    $ ldd src/gpartedbin | fgrep libparted
        libparted-fs-resize.so.0 => /tmp/parted-3.2-git/lib/libparted-fs-resize.so.0 (0x00007f9a460ee000)
        libparted.so.2 => /tmp/parted-3.2-git/lib/libparted.so.2 (0x00007f9a45ea3000)
Configure script used version 3.1 as reported by pkg-config to make most
of the decisions (those version related checks with cached results) but
the executable was still linked with the custom libparted 3.2 install.

Temporarily rename the system libparted pkg-config file out of the way:
    # cd /usr/lib64/pkgconfig
    # mv libparted.pc libparted.pc-NOT
and reconfigure the GParted build:
    $ ./configure
    ...
    checking for libparted >= 1.7.1 (querying pkg-config)... not found
    checking for libparted >= 1.7.1 (querying libparted)... 3.2.25-5a92
    checking for 2.0 <= libparted <= 3.0 (loop table creation doesn't delete old partitions)... (cached) no
    checking for libparted >= 2.2 (improved pt re-read)... (cached) yes
    checking for ped_file_system_resize in -lparted... no
    checking for ped_file_system_resize in -lparted-fs-resize... yes
    checking for libparted >= 3.2 (online resize)... (cached) yes
    ...
Now configure is having to compile a program with the custom install of
libparted and gets the correct version.

Restore libparted pkg-config file:
    # mv libparted.pc-NOT libparted.pc
and this time set environment variable PKG_CONFIG_PATH to inform
pkg-config of the additional directory to search for .pc files before
the default system location:
    $ export PKG_CONFIG_PATH=/tmp/parted-3.2-git/lib/pkgconfig
    $ ./configure
    ...
    checking for libparted >= 1.7.1 (querying pkg-config)... 3.2.25-5a92
    checking for 2.0 <= libparted <= 3.0 (loop table creation doesn't delete old partitions)... (cached) no
    checking for libparted >= 2.2 (improved pt re-read)... (cached) yes
    checking for ped_file_system_resize in -lparted... no
    checking for ped_file_system_resize in -lparted-fs-resize... yes
    checking for libparted >= 3.2 (online resize)... (cached) yes
    ...
Now configure is getting the correct version of the custom install of
libparted when querying pkg-config and thus making the correct
decisions.

Update the README file to reflect the need to also set the
PKG_CONFIG_PATH environment variable when building GParted with a custom
install of libparted.

Bug 753525 - Configuration issues when using non-system location or
             non-released versions of libparted
This commit is contained in:
Mike Fleetwood 2015-08-11 18:18:54 +01:00 committed by Curtis Gedak
parent 39feac8dd3
commit 050366f691
1 changed files with 1 additions and 0 deletions

1
README
View File

@ -159,6 +159,7 @@ c. Building using a Specific (lib)parted Version
export CPPFLAGS=-I/usr/local/include
export LDFLAGS=-L/usr/local/lib
export LD_RUN_PATH=/usr/local/lib
export PKG_CONFIG_PATH=/usr/local/lib/pkgconfig
4) Build gparted using steps listed above in "Building from Source".