Reputation: 651
I am using the HTParse.c module for one of my C projects. However when compiling with
gcc -o project project.c -lpthread
I receive the following compiler errors from within the header file:
In file included from Gserve.c:12:0:
/usr/local/include/w3c-libwww/HTParse.h:117:8: error: unknown type name ‘BOOL’
extern BOOL HTURL_isAbsolute (const char * url);
^
/usr/local/include/w3c-libwww/HTParse.h:192:8: error: unknown type name ‘BOOL’
extern BOOL HTCleanTelnetString (char * str);
^
I have read to include stdbool.h with C99 and that C90 does not support the boolean data type. Even after including this header, the errors persist. I have included these headers as follows:
#include<stdbool.h>
#include<w3c-libwww/HTParse.h>
Could something have gone wrong during the install of the library? I didn't see anything suspicious in the when making however I did notice some errors at the end of 'sudo make install'...
collect2: error: ld returned 1 exit status
Makefile:660: recipe for target 'libapp_2' failed
make[2]: *** [libapp_2] Error 1
make[2]: Leaving directory '/usr/local/src/w3c-libwww- 5.4.0/Library/Examples'
Makefile:174: recipe for target 'install-recursive' failed
make[1]: *** [install-recursive] Error 1
make[1]: Leaving directory '/usr/local/src/w3c-libwww-5.4.0/Library'
Makefile:263: recipe for target 'install-recursive' failed
make: *** [install-recursive] Error 1
I am using Ubuntu 15.10.
Do you guys have any Ideas for fixing this up?
Thanks Much!
Upvotes: 0
Views: 3047
Reputation: 61610
The cause of this compiler error is that w3c-libwww
defines BOOL
in the header wwwsys.h
, and you are not #include
ing it or any of
the other w3c-libwww
headers that already #include
s it. The library's
API boilerplate is meant to be declared by:
#include <w3c-libwww/WWWLib.h>
before anything else. Look at the provided Examples either via
the online documentation or in the Library/Examples
folder in the package.
Correcting this error, however, will not enable you to compile and link a program with the library because you have not succeeded in building and installing the library.
The failure that you noticed from sudo make install
means that you have not
installed the library. But the error in question:
collect2: error: ld returned 1 exit status
Makefile:660: recipe for target 'libapp_2' failed
is not an error of installing the library and its headers to their destination directories: it says that linkage of the library has failed.
make install
, therefore, has attempted to make
the library, as it will always do as long as library has
not yet been built, and that make
has failed because the library cannot be linked.
When I attempt myself to build the package,
on Ubuntu 15.10, ./configure
succeeds but make
fails with:
gcc -g -O2 -Wall -o .libs/libapp_2 libapp_2.o ../src/.libs/libwwwinit.so ../src/.libs/libwwwapp.so ../../Library/src/.libs/libwwwxml.so ../../modules/expat/xmlparse/.libs/libxmlparse.so ../../modules/expat/xmltok/.libs/libxmltok.so ../src/.libs/libwwwhtml.so ../src/.libs/libwwwtelnet.so ../src/.libs/libwwwnews.so ../src/.libs/libwwwhttp.so ../src/.libs/libwwwmime.so ../src/.libs/libwwwgopher.so ../src/.libs/libwwwftp.so ../src/.libs/libwwwdir.so ../src/.libs/libwwwcache.so ../src/.libs/libwwwstream.so ../src/.libs/libwwwfile.so ../src/.libs/libwwwmux.so ../src/.libs/libwwwtrans.so ../src/.libs/libwwwcore.so ../src/.libs/libwwwutils.so -lm ../../modules/md5/.libs/libmd5.so -ldl -Wl,--rpath -Wl,/home/imk/develop/w3c/lib
../src/.libs/libwwwfile.so: undefined reference to `HTDir_addElement'
../src/.libs/libwwwfile.so: undefined reference to `HTDir_free'
../src/.libs/libwwwfile.so: undefined reference to `HTDir_new'
collect2: error: ld returned 1 exit status
Makefile:660: recipe for target 'libapp_2' failed
No doubt that is what you saw too. You must regard a linkage failure of a library or executable you are trying to build as not merely "suspicious" but entirely fatal. Until you link it, you have no library.
Bottom line: This (14 yearold) package is broken on Ubuntu 15.10. There doesn't seem to be a well-known fix. I suggest you cut your losses.
Upvotes: 1