Can't build sample_work_generator

Message boards : Server programs : Can't build sample_work_generator
Message board moderation

To post messages, you must log in.

AuthorMessage
Vadim Gusev

Send message
Joined: 17 Feb 11
Posts: 5
Russia
Message 37321 - Posted: 28 Mar 2011, 17:11:39 UTC

Hi, i'm trying to build sample_work_generator.cpp outside of boinc source code tree with my own Makefile.
Here is a list of my code tree:

apps  assimilator  libs  validator  workgen  Makefile  Makefile.incl


"libs" dir contains api, db, lib, sched and tools dirs from BOINC source code tree with compiled libraries.

Here is build log:

g++ sample_work_generator.cpp -pthread -Wall  -I ../libs/api-x86_64 -I ../libs/lib-x86_64  -I ../libs/db-x86_64
-I ../libs/tools-x86_64 -I ../libs/sched-x86_64 -I /usr/include/mysql/  ../libs/api-x86_64/libboinc_api.a
../libs/lib-x86_64/libboinc.a  ../libs/sched-x86_64/libsched.a ../libs/lib-x86_64/libboinc_crypt.a /usr/lib/libmysqlclient.a
-lz -lssl  -o sample_work_generator
../libs/sched-x86_64/libsched.a(libsched_la-boinc_db.o): In function `WORKUNIT::clear()':
/usr/include/bits/string3.h:86: multiple definition of `WORKUNIT::clear()'
../libs/lib-x86_64/libboinc.a(libboinc_la-gui_rpc_client_ops.o):/usr/include/bits/string3.h:107: first defined here
../libs/sched-x86_64/libsched.a(libsched_la-boinc_db.o): In function `RESULT::clear()':
/usr/include/bits/string3.h:86: multiple definition of `RESULT::clear()'
../libs/lib-x86_64/libboinc.a(libboinc_la-gui_rpc_client_ops.o):/usr/include/bits/string3.h:107: first defined here
../libs/sched-x86_64/libsched.a(libsched_la-boinc_db.o): In function `APP_VERSION::clear()':
/usr/include/bits/string3.h:86: multiple definition of `APP_VERSION::clear()'
../libs/lib-x86_64/libboinc.a(libboinc_la-gui_rpc_client_ops.o):/usr/include/bits/string3.h:107: first defined here
../libs/sched-x86_64/libsched.a(libsched_la-boinc_db.o): In function `APP::clear()':
/usr/include/bits/string3.h:86: multiple definition of `APP::clear()'
../libs/lib-x86_64/libboinc.a(libboinc_la-gui_rpc_client_ops.o):/usr/include/bits/string3.h:107: first defined here
collect2: ld returned 1 exit status


Obviously, neither string3.h:86 nor string3.h:107 contain that methods. I'm lost in finding reasons of such behavior. I've posted that problem in boinc_projects mailing list, but got no answers.

Thanks for help in advance.
ID: 37321 · Report as offensive
Vadim Gusev

Send message
Joined: 17 Feb 11
Posts: 5
Russia
Message 37333 - Posted: 30 Mar 2011, 14:54:06 UTC

I've solved problem, but i don't get one thing:
The solution for problem is to put libboinc.a after libsched.a in g++ command line, as it's done in boinc build system. But changing libs order doesn't change fact of having multiple definitions, it just change order, in which linker will meet them. Then how does library order solve the problem?
ID: 37333 · Report as offensive
loonis

Send message
Joined: 2 Jun 11
Posts: 4
France
Message 38123 - Posted: 2 Jun 2011, 8:58:01 UTC

Hi, Could you share your MakeFile, I can't build my own work generator

Thanks.
ID: 38123 · Report as offensive
loonis

Send message
Joined: 2 Jun 11
Posts: 4
France
Message 38129 - Posted: 2 Jun 2011, 12:28:54 UTC

I found the simplest Makefile I can create for a simple work generator, here it is for those who one day need it :

#!/usr/bin/make -f

BOINC_BUILD=/home/boincadm/boinc

CXX = g++
CXXFLAGS = -pthread -Wall

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:

LIBS = $(BOINC_BUILD)/sched/libsched.a $(BOINC_BUILD)/lib/libboinc.a $(BOINC_BUILD)/api/libboinc_api.a  /usr/lib/libmysqlclient.a -lz

SOURCES = $(my_sample_work_generator *.cpp)
APPS = $(SOURCES:.cpp=)

all: $(APPS)

%: %.cpp
	$(CXX) $^ $(INCLUDES) $(CXXFLAGS) $(LIBS) -o $@

%.o: %.cpp
	$(CXX) $(CXXFLAGS) $(INCLUDES) -c $<

clean:
	rm -rf *.o *~ $(APPS)
ID: 38129 · Report as offensive

Message boards : Server programs : Can't build sample_work_generator

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.