thrift-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tanner Swett <swe...@mail.gvsu.edu>
Subject Re: Undefined reference errors when attempting to link with Thrift
Date Thu, 19 Jul 2012 16:35:22 GMT
On Wed, Jul 18, 2012 at 9:24 PM, Prasanna Ponnada <ponnada@gmail.com> wrote:
> On a system with pkg-config, something like this for glib would do:
> root@htgt:~# pkg-config --cflags thrift_c_glib
> -I/usr/local/include/thrift -I/usr/include/glib-2.0
> -I/usr/lib/x86_64-linux-gnu/glib-2.0/include
> root@htgt:~# pkg-config --libs thrift_c_glib
> -L/usr/local/lib -lthrift_c_glib -lgobject-2.0 -lglib-2.0

Thank you for your help so far, Prasanna. I still haven't been able to
get my application to build. Here are the details of what I've done so
far:

Running these commands, either as myself or as root, said, "No package
'thrift_c_glib' found". I found thrift_c_glib.pc, and ran the command
"export PKG_CONFIG_PATH='/home/tswett/thrift-0.8.0/lib/c_glib/'".
pkg-config complained that the package glib-2.0 was not found, so I
installed glib2-devel using YUM. After that, I was able to get the
flags I wanted:

[tswett@appa ~]$ pkg-config --cflags thrift_c_glib
-I/usr/local/include/thrift -I/usr/include/glib-2.0
-I/usr/lib64/glib-2.0/include
[tswett@appa ~]$ pkg-config --libs thrift_c_glib
-L/usr/local/lib -lthrift_c_glib -lgobject-2.0 -lglib-2.0

Running pkg-config using sudo gave me the error "No package
'thrift_c_glib' found" again; presumably, sudo doesn't preserve
environment variables.

Running ./build again with the new flags added gave me this error:

/usr/bin/ld: cannot find -lthrift_c_glib
collect2: ld returned 1 exit status

I looked at http://wiki.apache.org/thrift/ThriftInstallation again and
discovered that there's a directory called thrift-0.8.0/lib/c_glib. I
assumed at that point that I was supposed to build and install the
contents of this directory. Attempting to run make gave me these
errors: http://pastie.org/4284583 In short, thrift.h was attempting to
#include <glib.h>, but the full path to glib.h is
/usr/include/glib-2.0/glib.h. So, I ran "export
C_INCLUDE_PATH='/usr/include/glib-2.0'" and tried running make again.
This time, I got a whole mess of errors: http://pastie.org/4284602

Like before, I ran 'export
C_INCLUDE_PATH="$C_INCLUDE_PATH:/usr/lib64/glib-2.0/include"' and
tried running make again. This time, it successfully built the
contents of thrift-0.8.0/lib/c_glib, so I ran sudo make install.

Finally, I ran ./build again and got almost exactly the same error as
I did originally: http://pastie.org/4284628

On a hunch, I searched thrift-0.8.0 for files with TNonblockingServer
in the name, and found a file called
libthriftnb_la-TNonblockingServer.o in thrift-0.8.0/lib/cpp. I also
looked in /usr/local/lib, and saw that there was a file called
libthriftnb.so. I vaguely remembered being told that this file was
important, but I also specifically remembered this file not existing.
So, I added -lthriftnb to ./build and ran it again. I got a new set of
errors, and the old ones had gone, but I don't know whether or not
this meant the old ones were fixed: http://pastie.org/4284660

I ran make in thrift-0.8.0/lib/cpp, and it appeared to do nothing
before exiting ("entering directory", then "nothing to be done", then
"leaving directory"). I then ran sudo make install, which may have
done something. Running ./build again gave the same errors as last
time.

The new contents of ./build were, at that point: g++ -Wall -o
parcv_server -DHAVE_NETINET_IN_H -DHAVE_INTTYPES_H
-I/usr/local/include/thrift -I/usr/include/glib-2.0
-I/usr/lib64/glib-2.0/include -L/usr/local/lib -lopencv_core
-lopencv_contrib -lthrift -lthrift_c_glib -lgobject-2.0 -lglib-2.0
-lthriftnb parcv_constants.cpp parcv_server.cpp parcv_types.cpp
ParCV.cpp

Reading http://stackoverflow.com/questions/6900839/error-when-trying-to-compile-webdis
made me suspect that I was putting the -l flags in the wrong order,
and I vaguely remembered something about -lthriftnb having to go in a
certain place. I tried moving it immediately before -lthrift, and
immediately after; all of these gave the same set of errors.

So, I'm currently stumped.

Tanner

Mime
View raw message