473,396 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

C compilation problem using autotools

I don't know much about autotools or Berkeley db (bdb) but they are
being used by a program I'm trying to compile and it's causing me
problems. The line which is the culprit is in a configure.ac file and it's:

AC_CHECK_LIB(db, db_create, ,AC_MSG_ERROR([Berkeley db library not found]))

This is what ends up causing the configure script to fail. The thing is,
I am pretty sure I have the newest bdb installed on my system. I am able
to compile the following bdb-dependent file, which I would think is a
sign that I have bdb installed:

#include <db.h>
int main() { db_create(0,0,0); }

So to test it out, I read an autotools tutorial and created a tiny
configure.ac file:

AC_INIT(dbtest.c)
AC_CHECK_LIB(db, db_create, ,AC_MSG_ERROR([Berkeley db library not found]))

This generates a configure file which fails with the following message:

checking for db_create in -ldb... no
configure: error: Berkeley db library not found

It's strange, like I both have bdb and don't have it, at the same time.
Anyone have any idea what's the matter?

Thanks in advance,
Lowell
Nov 14 '05 #1
2 1765
Lowell Kirsh wrote:
I don't know much about autotools or Berkeley db (bdb) but they are
being used by a program I'm trying to compile and it's causing me
problems. The line which is the culprit is in a configure.ac file and
it's:

AC_CHECK_LIB(db, db_create, ,AC_MSG_ERROR([Berkeley db library not
found]))

This is what ends up causing the configure script to fail. The thing is,
I am pretty sure I have the newest bdb installed on my system. I am able
to compile the following bdb-dependent file, which I would think is a
sign that I have bdb installed:

#include <db.h>
int main() { db_create(0,0,0); }


And what does autoconf do for a test? Anyhow, are you sure db_create is a
function and not a macro? Are there perhaps versioned symbols interfering?
How about not using AC_CHECK_LIB but AC_TRY_LINK with above snippet? Dow
do other projects figure out if BDB is available?

Apart from the possibility of a macro, all these are not strictly on-topic
here btw, and it seems you didn't even look at the logs, or?

Uli

Nov 14 '05 #2
Ulrich Eckhardt wrote:
And what does autoconf do for a test? I'm not sure what you mean by this?
Anyhow, are you sure db_create is a
function and not a macro? No, I think it is actually a macro. From /usr/include/db.h:
#define db_create db_create_4002
I've grepped for db_create_4002 but couldn't find its definition
anywhere. This kinda stuff is beyond the C I'm used to so I wasn't sure
what kind of magic was going on in the header file.
Are there perhaps versioned symbols interfering? I don't know what that means.
How about not using AC_CHECK_LIB but AC_TRY_LINK with above snippet? Dow
do other projects figure out if BDB is available? The reason I was using AC_CHECK_LIB was that was the function that was
used by this program I'm trying to compile.
I'm on a new system and have been installing everything with apt-get, so
I don't think I've had a chance to compile anything else yet that
depended on bdb.
Apart from the possibility of a macro, all these are not strictly on-topic
here btw, and it seems you didn't even look at the logs, or?


here's the relevant part of the log. The thing that I didn't get was why
that bit of code below doesn't #include <db.h> which would have allowed
i to succeed.
configure:2171: checking for db_create in -ldb
configure:2201: gcc -o conftest -g -O2 conftest.c -ldb >&5
/tmp/cc21eNUB.o(.text+0xa): In function `main':
/home/lkirsh/temp/dbtest/conftest.c:20: undefined reference to `db_create'
collect2: ld returned 1 exit status
configure:2207: $? = 1
configure: failed program was:
| /* confdefs.h. */
|
| #define PACKAGE_NAME ""
| #define PACKAGE_TARNAME ""
| #define PACKAGE_VERSION ""
| #define PACKAGE_STRING ""
| #define PACKAGE_BUGREPORT ""
| /* end confdefs.h. */
|
| /* Override any gcc2 internal prototype to avoid an error. */
| #ifdef __cplusplus
| extern "C"
| #endif
| /* We use char because int might match the return type of a gcc2
| builtin and then its argument prototype would still apply. */
| char db_create ();
| int
| main ()
| {
| db_create ();
| ;
| return 0;
| }
configure:2232: result: no
configure:2242: error: Berkeley db library not found
Nov 14 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

16
by: Henri Schomäcker | last post by:
Hi folks, I am developing a apache2 so module in c++. At the moment, I'm trying to get it to compile with automake & friends, but don't get it to work. I tried to modify the example in the...
0
by: wcsnyder | last post by:
For those who didn't catch this announcement on the moderated group, I am pleased to announce the initial release of RPSL (Rapid Prototyping Shared Library). RPSL is a set of bash scripts and...
10
by: Sune | last post by:
Hi, previously I used Eclipse CDT for compiling my files just to get started with C and leave C++ behind. Now it's time to get a little more serious so I've moved my files to a new workplace and...
6
by: Joachim | last post by:
I made some project changes (which seems it doesn't help if I undo) which have created compilation error: " Server Error in '/PCSWebApp1' Application....
1
by: Jonh Wendell | last post by:
Hi all! I need help with autotools stuff.. My directory structure: project_name src main.py others.py data ui.glade
1
by: B Thomas | last post by:
Hi, I need to compile enblend (http://enblend.sourceforge.net) such that libstdc++6 and libgcc are statically linked in but everything else maybe dynamically linked (as my system has gcc 3.3 and...
14
by: aaragon | last post by:
Hi everyone, I've been writing some code and so far I have all the code written in the .h files in order to avoid the linker errors. I'm using templates. I wanted to move the implementations to...
35
by: mwelsh1118 | last post by:
Why doesn't C# allow incremental compilation like Java? Specifically, in Java I can compile single .java files in isolation. The resulting individual .class files can be grouped into .jar files....
6
by: maxwell | last post by:
I'm trying to use the gpp utility (Gnu points to http://en.nothingisreal.com/wiki/GPP) to do conditional compilation in Python, and I'm running into a problem: the same '#' character introduces...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.