Skip to contentSkip to conversation

imagemagick: Ignore host's xml2-config

PATCH New Markos Chandras 2 participants 7 messages Mar 13, 2012

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 imagemagick: Ignore host's xml2-config

If $(HOST_DIR)/usr/bin is in the user's $PATH, and host-libxml2 is installed, the configure script will find xml2-config in $(HOST_DIR)/usr/bin and the xml2-config --prefix will return the $(HOST_DIR)/usr. This is bad because imagemagick will append -L$(HOST_DIR)/usr/lib to LDFLAGS and it will try to link against the host's libraries instead of those located in the staging directory.

---
It is pretty common for people to add $(HOST_DIR)/usr/bin to their $PATH (also uggested in buildroot documentation:
http://buildroot.uclibc.org/buildroot.html#using_toolchain)
in order to use their cross-toolchain utilities so this problem may be exposed to a significant number of people. The configure script is modified to ensure that the xml2-config utility that was found in $PATH is located in the sysroot directory. This will prevent host's libraries to be appended to imagemagick's LDFLAGS. This patch depends on the one added in commit 06ef58efc45dabf078c93358a6ce37f178ae8df5 and it needs to be applied after that.

---
 .../imagemagick-6.6.7-6-xml2-config-path.patch     |   26 ++++++++++++++++++++
 1 files changed, 26 insertions(+), 0 deletions(-)
 create mode 100644 package/imagemagick/imagemagick-6.6.7-6-xml2-config-path.patch
package/imagemagick/imagemagick-6.6.7-6-xml2-config-path.patch new file +26 -0
new file mode 100644
index 0000000..f2a0d34
@@ -0,0 +1,26 @@
+Index: imagemagick-6.6.7-6/configure.ac
+===================================================================
+--- imagemagick-6.6.7-6.orig/configure.ac
++++ imagemagick-6.6.7-6/configure.ac
+@@ -2589,12 +2589,15 @@ if test "$with_xml" != 'no'; then
+         # the shared library installed under /usr/lib, whereas the package
+         # installs itself under $prefix/libxml and $prefix/lib.
+         xml2_prefix=`xml2-config --prefix`
+-        if test -d "${xml2_prefix}/include/libxml2"; then
+-            CPPFLAGS="$CPPFLAGS -I${xml2_prefix}/include/libxml2"
+-        fi
+-        if test "${xml2_prefix}" != '/usr'; then
+-            LDFLAGS="$LDFLAGS -L${xml2_prefix}/lib"
+-        fi
++	# Make sure we didn't pick the host's xml2-config
++	if `echo ${xml2_prefix} | grep sysroot > /dev/null 2>&1`; then
++	        if test -d "${xml2_prefix}/include/libxml2"; then
++        	    CPPFLAGS="$CPPFLAGS -I${xml2_prefix}/include/libxml2"
++	        fi
++        	if test "${xml2_prefix}" != '/usr'; then
++	            LDFLAGS="$LDFLAGS -L${xml2_prefix}/lib"
++        	fi
++	fi
+     fi
+     failed=0
+     passed=0
Signature · 1 line
1.7.1
#1 lore raw

PATCH 1/1 imagemagick: Ignore host's xml2-config

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Markos" == Markos Chandras <[email protected]> writes:

Markos> If $(HOST_DIR)/usr/bin is in the user's $PATH, and host-libxml2 is Markos> installed, the configure script will find xml2-config in Markos> $(HOST_DIR)/usr/bin and the xml2-config --prefix will return the Markos> $(HOST_DIR)/usr. This is bad because imagemagick will append Markos> -L$(HOST_DIR)/usr/lib to LDFLAGS and it will try to link against Markos> the host's libraries instead of those located in the staging directory.

Hmm, is this still a problem? We already have a libxml2 patch for imagemagick to ensure it picks up the target one, and we explicitly pass --without-xml if we're not building libxml2 for the target.

Are you testing against buildroot git? From the the patch file name I would guess not. Could you retry with latest git and let me know if it is still needed?

Signature · 1 line
Bye, Peter Korsgaard
#2 lore raw

PATCH 1/1 imagemagick: Ignore host's xml2-config

Quoted 9 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Markos" == Markos Chandras <[email protected]> writes:

Markos> If $(HOST_DIR)/usr/bin is in the user's $PATH, and host-libxml2 is Markos> installed, the configure script will find xml2-config in Markos> $(HOST_DIR)/usr/bin and the xml2-config --prefix will return the Markos> $(HOST_DIR)/usr. This is bad because imagemagick will append Markos> -L$(HOST_DIR)/usr/lib to LDFLAGS and it will try to link against Markos> the host's libraries instead of those located in the staging directory.

Quoted 8 lines

Hmm, is this still a problem? We already have a libxml2 patch for imagemagick to ensure it picks up the target one, and we explicitly pass --without-xml if we're not building libxml2 for the target.

Are you testing against buildroot git? From the the patch file name I would guess not. Could you retry with latest git and let me know if it is still needed?

Are you referring to the imagemagick-6.6.4-8-use-xml2-config.patch? If yes, this does not fix the problem because AC_CHECK_PROG() searches for programmes in the $PATH and if $(HOST_DIR)/usr/bin/xml2-config is in the path, it will find that and set xml2_config variable to $(HOST_DIR)/usr which in turn sets LDFLAGS to -L{xml2_config}/lib

Signature · 1 line
markos
#3 lore raw

PATCH 1/1 imagemagick: Ignore host's xml2-config

Quoted 20 lines · Markos Chandras
Quoted 9 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Markos" == Markos Chandras <[email protected]> writes:

Markos> If $(HOST_DIR)/usr/bin is in the user's $PATH, and host-libxml2 is Markos> installed, the configure script will find xml2-config in Markos> $(HOST_DIR)/usr/bin and the xml2-config --prefix will return the Markos> $(HOST_DIR)/usr. This is bad because imagemagick will append Markos> -L$(HOST_DIR)/usr/lib to LDFLAGS and it will try to link against Markos> the host's libraries instead of those located in the staging directory.

Quoted 8 lines

Hmm, is this still a problem? We already have a libxml2 patch for imagemagick to ensure it picks up the target one, and we explicitly pass --without-xml if we're not building libxml2 for the target.

Are you testing against buildroot git? From the the patch file name I would guess not. Could you retry with latest git and let me know if it is still needed?

Quoted 6 lines

Are you referring to the imagemagick-6.6.4-8-use-xml2-config.patch? If yes, this does not fix the problem because AC_CHECK_PROG() searches for programmes in the $PATH and if $(HOST_DIR)/usr/bin/xml2-config is in the path, it will find that and set xml2_config variable to $(HOST_DIR)/usr which in turn sets LDFLAGS to -L{xml2_config}/lib

Hmm I think you are right. The imagemagick-6.6.4-8-use-xml2-config.patch did not apply to my tree. Let me do some further testing and I will reply back

Signature · 1 line
markos
#4 lore raw

PATCH 1/1 imagemagick: Ignore host's xml2-config

Quoted 29 lines · Markos Chandras
Quoted 20 lines · Markos Chandras
Quoted 9 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Markos" == Markos Chandras <[email protected]> writes:

Markos> If $(HOST_DIR)/usr/bin is in the user's $PATH, and host-libxml2 is Markos> installed, the configure script will find xml2-config in Markos> $(HOST_DIR)/usr/bin and the xml2-config --prefix will return the Markos> $(HOST_DIR)/usr. This is bad because imagemagick will append Markos> -L$(HOST_DIR)/usr/lib to LDFLAGS and it will try to link against Markos> the host's libraries instead of those located in the staging directory.

Quoted 8 lines

Hmm, is this still a problem? We already have a libxml2 patch for imagemagick to ensure it picks up the target one, and we explicitly pass --without-xml if we're not building libxml2 for the target.

Are you testing against buildroot git? From the the patch file name I would guess not. Could you retry with latest git and let me know if it is still needed?

Quoted 6 lines

Are you referring to the imagemagick-6.6.4-8-use-xml2-config.patch? If yes, this does not fix the problem because AC_CHECK_PROG() searches for programmes in the $PATH and if $(HOST_DIR)/usr/bin/xml2-config is in the path, it will find that and set xml2_config variable to $(HOST_DIR)/usr which in turn sets LDFLAGS to -L{xml2_config}/lib

Quoted 4 lines

Hmm I think you are right. The imagemagick-6.6.4-8-use-xml2-config.patch did not apply to my tree. Let me do some further testing and I will reply back

Yes, for whatever reason the buildroot infrastructure ignored that patch and never got applied. I guess my tree was broken somehow. Apologies for the noise. Please ignore my patch.

Signature · 1 line
markos
#5 lore raw

PATCH 1/1 imagemagick: Ignore host's xml2-config

Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Markos" == Markos Chandras <[email protected]> writes:

Hi,

Markos> Yes, for whatever reason the buildroot infrastructure ignored Markos> that patch and never got applied. I guess my tree was broken Markos> somehow. Apologies for the noise. Please ignore my patch.

The patch logic is somewhat complicated (and we're cleaning it up) - If any patches match <package>-<version>-*.patch, then all other patches are ignored.

Signature · 1 line
Bye, Peter Korsgaard
#6 lore raw

PATCH 1/1 imagemagick: Ignore host's xml2-config

Quoted 4 lines · Peter Korsgaard
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Markos" == Markos Chandras <[email protected]> writes:

Hi,

Quoted 8 lines

Markos> Yes, for whatever reason the buildroot infrastructure ignored Markos> that patch and never got applied. I guess my tree was broken Markos> somehow. Apologies for the noise. Please ignore my patch.

The patch logic is somewhat complicated (and we're cleaning it up) - If any patches match <package>-<version>-*.patch, then all other patches are ignored.

Yeah I noticed that a bit late after spending some time reading the package/Makefile.package.in file. Thanks for clarifying this.

Signature · 1 line
markos