LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   DBUS -> Expat.h is missing (https://www.linuxquestions.org/questions/linux-general-1/dbus-expat-h-is-missing-915329/)

lfs_mm 11-24-2011 08:13 AM

DBUS -> Expat.h is missing
 
Hello

I try to compile the dbus 1.4.16 and i get the following error during the configuration:

Code:

checking for accept4... yes
checking abstract socket namespace... no
checking for pkg-config... (cached) /usr/local/bin/pkg-config
checking pkg-config is at least version 0.9.0... yes
checking for XML_ParserCreate_MM in -lexpat... no
configure: error: Could not find expat.h, check config.log for failed attempts

I installed expat successfully. The libraries are installed at the following directory:

Code:

/usr/local/lib/libexpat.so.1
/usr/local/lib/libexpat.so.1.5.2
/usr/local/lib/libexpat.so.0
/usr/local/lib/libexpat.so

the include path for expat.h is at:

Code:

/usr/local/include/expat.h
The library path is in the ld.so.conf file. I run ldconfig several times. The ld cache shows me that the libraries should be found.

I tried to run the configure with the following commands:
Code:

./configure --libdir=/usr/local/lib --includedir=/usr/local/include
but this has no effects. Can anybody give me further advices? Suggestions?

Greetings

jhwilliams 11-25-2011 12:58 AM

Quote:

Originally Posted by lfs_mm (Post 4532776)
check config.log for failed attempts

What does config.log say?

lfs_mm 11-25-2011 02:08 AM

The config.log has following entries:

Code:

.....
|
|  ;
|  return 0;
| }
configure:19074: result: no
configure:19160: checking for pkg-config
configure:19193: result: no
configure:19231: checking for XML_ParserCreate_MM in -lexpat
configure:19256: gcc -o conftest -g -O2  conftest.c -lexpat  >&5
/tools/bin/ld: cannot find -lexpat
collect2: ld returned 1 exit status
configure:19256: $? = 1
configure: failed program was:
| /* confdefs.h */
| #define PACKAGE_NAME "dbus"
| #define PACKAGE_TARNAME "dbus"
| #define PACKAGE_VERSION "1.4.16"
| #define PACKAGE_STRING "dbus 1.4.16"
| #define PACKAGE_BUGREPORT "https://bugs.freedesktop.org/enter_bug.cgi?product=dbus"
| #define PACKAGE_URL ""
| #define PACKAGE "dbus"
| #define VERSION "1.4.16"

.....

checking sys/syslimits.h presence... no
checking for sys/syslimits.h... no
checking whether MSG_NOSIGNAL is declared... yes
checking for ISO C99 varargs macros in C... yes
checking for GNUC varargs macros... yes
checking for struct cmsgcred... no
checking for getpeerucred... no
checking for getpeereid... no
checking for pipe2... yes
checking for accept4... yes
checking abstract socket namespace... no
checking for pkg-config... no
checking for XML_ParserCreate_MM in -lexpat... no
configure: error: Could not find expat.h, check config.log for failed attempts
/sources/avahi/dbus-1.4.16 # vi config.log
|  listen_fd = socket (PF_UNIX, SOCK_STREAM, 0);
|
|  if (listen_fd < 0)
|    {
|      fprintf (stderr, "socket() failed: %s\n", strerror (errno));
|      exit (1);
|    }
|
|  memset (&addr, '\0', sizeof (addr));
|  addr.sun_family = AF_UNIX;
|  strcpy (addr.sun_path, "X/tmp/dbus-fake-socket-path-used-in-configure-test");
|  /* SUN_LEN uses strlen() so need to calculate it before adding \0 at the
|    * beginning.
|    */
|  slen = SUN_LEN(&addr);
|  addr.sun_path[0] = '\0'; /* this is what makes it abstract */
|
|  if (bind (listen_fd, (struct sockaddr*) &addr, slen) < 0)
|    {
|        fprintf (stderr, "Abstract socket namespace bind() failed: %s\n",
|                strerror (errno));
|        exit (1);
|    }
|  else
|    exit (0);
|
|  ;
|  return 0;
| }
configure:19074: result: no
configure:19160: checking for pkg-config
configure:19193: result: no
configure:19231: checking for XML_ParserCreate_MM in -lexpat
| extern "C"
| #endif
| char XML_ParserCreate_MM ();
| int
| main ()
| {
| return XML_ParserCreate_MM ();
|  ;
|  return 0;
| }
configure:19265: result: no
configure:19372: error: Could not find expat.h, check config.log for failed attempts

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=i686-pc-linux-gnu
ac_cv_c_bigendian=no
ac_cv_c_compiler_gnu=yes
ac_cv_c_inline=inline
ac_cv_cxx_compiler_gnu=yes
ac_cv_env_CCC_set=
- config.log 2445/2984 81%
| extern "C"
| #endif
| char XML_ParserCreate_MM ();
| int
| main ()
| {
| return XML_ParserCreate_MM ();
|  ;
|  return 0;
| }
configure:19265: result: no
configure:19372: error: Could not find expat.h, check config.log for failed attempts

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=i686-pc-linux-gnu
ac_cv_c_bigendian=no
ac_cv_c_compiler_gnu=yes
ac_cv_c_inline=inline
ac_cv_cxx_compiler_gnu=yes
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
- config.log 2445/2984 81%
| extern "C"
| #endif
| char XML_ParserCreate_MM ();
| int
| main ()
| {
| return XML_ParserCreate_MM ();
|  ;
|  return 0;
| }
configure:19265: result: no
configure:19372: error: Could not find expat.h, check config.log for failed attempts

## ---------------- ##
## Cache variables. ##
## ---------------- ##

ac_cv_build=i686-pc-linux-gnu
ac_cv_c_bigendian=no
ac_cv_c_compiler_gnu=yes
ac_cv_c_inline=inline
ac_cv_cxx_compiler_gnu=yes
ac_cv_env_CCC_set=
ac_cv_env_CCC_value=
ac_cv_env_CC_set=
ac_cv_env_CC_value=
ac_cv_env_CFLAGS_set=
ac_cv_env_CFLAGS_value=
ac_cv_env_CPPFLAGS_set=
ac_cv_env_CPPFLAGS_value=
ac_cv_env_CPP_set=
ac_cv_env_CPP_value=
ac_cv_env_CXXCPP_set=
ac_cv_env_CXXCPP_value=
ac_cv_env_CXXFLAGS_set=
ac_cv_env_CXXFLAGS_value=
ac_cv_env_CXX_set=
ac_cv_env_CXX_value=
ac_cv_env_DBUS_GLIB_CFLAGS_set=
ac_cv_env_DBUS_GLIB_CFLAGS_value=
/sources/avahi/dbus-1.4.16 # vi config.log
| #define HAVE_GNUC_VARARGS 1
| #define HAVE_PIPE2 1
| #define HAVE_ACCEPT4 1
| /* end confdefs.h.  */
|
| /* Override any GCC internal prototype to avoid an error.
|    Use char because int might match the return type of a GCC
|    builtin and then its argument prototype would still apply.  */
| #ifdef __cplusplus
| extern "C"
| #endif
| char XML_ParserCreate_MM ();
| int
| main ()
| {
| return XML_ParserCreate_MM ();
|  ;
|  return 0;
| }
configure:19265: result: no
configure:19372: error: Could not find expat.h, check config.log for failed attempts

Does that help ? Suggestions?

lfs_mm 11-25-2011 02:47 AM

I think it is a general problem in my linux system that the expat library can not be found.
I did the following thing: In a test folder i created a dummy.c file with the following content:

Code:

#include "/usr/include/expat.h"

int main() {
        XML_Parser parser = XML_ParserCreate(NULL);
        return 0;
}

on the command line i tried the following:

Code:

/tests # gcc dummy.c -o dummy -lexpat
the output was the same as from dbus config log:

Code:

/tests # gcc dummy.c -o dummy -lexpat
/tools/bin/ld: cannot find -lexpat
collect2: ld returned 1 exit status

Why does the linker not found the library? When i do a "ld-config -p | grep 'expat'" i receive the following:
Code:

/tests # ldconfig -p | grep 'expat'
        libexpat.so.1 (libc6) => /usr/lib/libexpat.so.1
        libexpat.so (libc6) => /usr/lib/libexpat.so

Should this not solve the problem?? What am I doing wrong?

Greetings

lfs_mm 11-25-2011 03:02 AM

if i do

Code:

gcc dummy.c -o dummy -L/usr/local/lib -lexpat
then the compiler does not complain and the program was successfully compiled. What can I do about this problem? Why should the linker
not find -lexpat?

Greetings

jhwilliams 11-25-2011 03:36 AM

Instead of --libdir and --includedir, try passing in the paths as make variables, e.g.

Code:

./configure LDFLAGS='-L/usr/local/lib' CFLAGS='-I/usr/local/include'
Or variations thereon.

Actually, that won't fix your configure error...

In your dummy.c, you are able to find the header, in /usr/include/ (NOT /usr/local/include), because that's where it normally lives. What happens when you modify it to /usr/local/include/expat.h ?

However, you have a link-time error without -L, because the compiler is trying to find libexpat in the wrong directory. You can add /usr/local/lib to the config files in /etc/ld.so.conf.d/, if you want to include that path in the library search without an explicit -L flag.

lfs_mm 11-25-2011 03:44 AM

Thank you for your help. I could compile DBus successfully with the following commands:

Code:

export LDFLAGS=-Wl,-L/usr/local/lib,-lexpat
export CPPFLAGS=-I/usr/local/include
./configure
make
make install

It would be interesting why the compiler cannot explicitly find the -lexpat library. As I said, I have a entry in the ld.so.conf file for that and I run the ldconfig command. The ldconfig -p command shows also that the library is in the cache.
What other possibilities are there that the linker (ld) does find the library?

Greetings.

jhwilliams 11-25-2011 03:53 AM

Oh yes, sorry - you did say that earlier (wrt ldconfig.)

Very strange, I'm just not sure. Quite honestly, though, I've run into enough broken configure scripts before that don't respect all of the flags. I wouldn't be surprised if it's just that.

I'm glad the variable exports is a functional workaround for now, at least!

lfs_mm 11-25-2011 04:05 AM

Ok I ignore that at the moment. Maybe it is the toolchain I am using on my embedded device which is running on a ATOM (Intel) architecture. I used the LFS 6.7 Book to compile a fully functional Toolchain. Then i copied this toolchain on the embedded device to compile several diffrent programs. For a webinterface i needed the PHP Zend compiler. Now i need the AVAHI libraries for the mDNS and DNS-SD services. It was a little bit a pain in the *peep* until i figured out how to use the toolchain in a such way. I didn't want to compile the whole gcc & libc stuff again on the embedded device. So for now it is a quite good way with the Toolchain from CHAPTER 5 (LFS BOOK).

Thank you for your help

Greetings


All times are GMT -5. The time now is 09:58 PM.