Help! Libraries needed by program who access the database

Message boards : API : Help! Libraries needed by program who access the database
Message board moderation

To post messages, you must log in.

AuthorMessage
Jules

Send message
Joined: 26 Apr 07
Posts: 4
Message 9909 - Posted: 26 Apr 2007, 17:03:32 UTC

Hi, i'm trying to compile a program to monitorize when certain workunits have been executed, based on the code stored on "boinc/tools"poll_wu.C".

The Makefile that i'm, using has this:

##- Header files:
INCLUDES =-I. -I$(BOINC_BUILD) \
-I$(BOINC_BUILD)/api \
-I$(BOINC_BUILD)/lib \
-I$(BOINC_BUILD)/db \
-I$(BOINC_BUILD)/sched \
-I$(BOINC_BUILD)/tools \
-I/usr/include/mysql

##- Libraries:
LIBDIRS = -L. -L$(BOINC_BUILD)/lib \
-L$(BOINC_BUILD)/api \
-L$(BOINC_BUILD)/db \
-L$(BOINC_BUILD)/sched \

LIBS = -lm $(LIBDIRS) -lboinc_api -lboinc \


But "make" still complaints about:

"undefined reference to" DB_WORKUNIT, DB_RESULT, SHED_CONFIG, boinc_db, DB_BASE, DB_CONN, mysql_store_result, mysql_fetch_row, and mysql_free_result.

What am i missing? Thanks.

ID: 9909 · Report as offensive
Nicolas

Send message
Joined: 19 Jan 07
Posts: 1179
Argentina
Message 9913 - Posted: 26 Apr 2007, 19:59:53 UTC

What files are you #include'ing on your program?
ID: 9913 · Report as offensive
Jules

Send message
Joined: 26 Apr 07
Posts: 4
Message 9914 - Posted: 26 Apr 2007, 21:24:36 UTC

This ones (like they are on "boinc/tools/poll_wu.C"):

#include "config.h"
#include "boinc_db.h"
#include <iostream>
#include <string>
#include "sched_config.h"

My "make" ouput:

boinc:~/nfs/genetico/tspga_dinam# make
g++ -static -pthread tspga.o Individual.o Population.o Problem.o LocalSearch.o EvolutionStrategy.o TwoOpt.o NullLocalSearch.o Workunits.o -lm -L. -L/mnt/boinc/boinc_actual/lib -L/mnt/boinc/boinc_actual/api -L/mnt/boinc/boinc_actual/db -L/mnt/boinc/boinc_actual/sched -lboinc_api -lboinc -o tspga
Workunits.o: In function `check_workunit_status(std::basic_string<char, std::char_traits<char>, std::allocator<char> >)':
/root/nfs/genetico/tspga_dinam/Workunits.C:28: referencia a `DB_WORKUNIT::DB_WORKUNIT(DB_CONN*)' sin definir
/root/nfs/genetico/tspga_dinam/Workunits.C:29: referencia a `DB_RESULT::DB_RESULT(DB_CONN*)' sin definir
/root/nfs/genetico/tspga_dinam/Workunits.C:42: referencia a `SCHED_CONFIG::parse_file(char const*)' sin definir
/root/nfs/genetico/tspga_dinam/Workunits.C:47: referencia a `boinc_db' sin definir
/root/nfs/genetico/tspga_dinam/Workunits.C:47: referencia a `DB_CONN::open(char*, char*, char*, char*)' sin definir
/root/nfs/genetico/tspga_dinam/Workunits.C:54: referencia a `DB_BASE::lookup(char const*)' sin definir
/root/nfs/genetico/tspga_dinam/Workunits.C:70: referencia a `boinc_db' sin definir
/root/nfs/genetico/tspga_dinam/Workunits.C:70: referencia a `DB_CONN::do_query(char const*)' sin definir
/root/nfs/genetico/tspga_dinam/Workunits.C:73: referencia a `boinc_db' sin definir
/root/nfs/genetico/tspga_dinam/Workunits.C:73: referencia a `DB_CONN::close()' sin definir
/root/nfs/genetico/tspga_dinam/Workunits.C:95: referencia a `boinc_db' sin definir
/root/nfs/genetico/tspga_dinam/Workunits.C:95: referencia a `DB_CONN::close()' sin definir
/root/nfs/genetico/tspga_dinam/Workunits.C:76: referencia a `boinc_db' sin definir
/root/nfs/genetico/tspga_dinam/Workunits.C:76: referencia a `mysql_store_result' sin definir
/root/nfs/genetico/tspga_dinam/Workunits.C:81: referencia a `mysql_fetch_row' sin definir
/root/nfs/genetico/tspga_dinam/Workunits.C:82: referencia a `DB_RESULT::db_parse(char**&)' sin definir
/root/nfs/genetico/tspga_dinam/Workunits.C:88: referencia a `mysql_free_result' sin definir
/root/nfs/genetico/tspga_dinam/Workunits.C:78: referencia a `boinc_db' sin definir
/root/nfs/genetico/tspga_dinam/Workunits.C:78: referencia a `DB_CONN::close()' sin definir
Workunits.o: In function `~DB_BASE':
/mnt/boinc/boinc_actual/db/db_base.h:90: referencia a `vtable for DB_BASE' sin definir
/mnt/boinc/boinc_actual/db/db_base.h:90: referencia a `vtable for DB_BASE' sin definir
collect2: ld returned 1 exit status
make: *** [tspga] Error 1
boinc:~/nfs/genetico/tspga_dinam#
ID: 9914 · Report as offensive
Nicolas

Send message
Joined: 19 Jan 07
Posts: 1179
Argentina
Message 9923 - Posted: 27 Apr 2007, 3:45:55 UTC

Oh right, the error is on the linking phase, not on compiling. I thought the compiler was complaining about stuff not declared, and you were missing boinc_db.h.

I'll have a look tomorrow at what -lthing you are missing (it's past midnight here).

PS: nunca me acostumbraría a ver algo como "referencia sin definir". Programas gráficos traducidos ningún problema, pero errores de compilador hmm... :)
ID: 9923 · Report as offensive
Jules

Send message
Joined: 26 Apr 07
Posts: 4
Message 9946 - Posted: 30 Apr 2007, 7:59:55 UTC

Any luck?. I still not found the solution.
ID: 9946 · Report as offensive
Jules

Send message
Joined: 26 Apr 07
Posts: 4
Message 9950 - Posted: 30 Apr 2007, 17:04:07 UTC

Ok, found it!

The missing libraries was libsched.a and libmysqlclient.a, so makefile finally looks like this:

##- Header files:
INCLUDES =-I. -I$(BOINC_BUILD)
-I$(BOINC_BUILD)/api
-I$(BOINC_BUILD)/lib
-I$(BOINC_BUILD)/db
-I$(BOINC_BUILD)/sched
-I$(BOINC_BUILD)/tools
-I/usr/include/mysql

##- Libraries:
LIBDIRS = -L. -L$(BOINC_BUILD)/lib
-L$(BOINC_BUILD)/api
-L$(BOINC_BUILD)/sched
-L/usr/lib/mysql

LIBS = -lm $(LIBDIRS) -lsched -lboinc_api -lboinc -lmysqlclient


Also realised that order matters, in other words, "-lsched" must be in first place.

ID: 9950 · Report as offensive

Message boards : API : Help! Libraries needed by program who access the database

Copyright © 2024 University of California.
Permission is granted to copy, distribute and/or modify this document under the terms of the GNU Free Documentation License, Version 1.2 or any later version published by the Free Software Foundation.