Message boards : Server programs : Can't build sample_work_generator
Message board moderation
Author | Message |
---|---|
Send message Joined: 17 Feb 11 Posts: 5 |
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. |
Send message Joined: 17 Feb 11 Posts: 5 |
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? |
Send message Joined: 2 Jun 11 Posts: 4 |
Hi, Could you share your MakeFile, I can't build my own work generator Thanks. |
Send message Joined: 2 Jun 11 Posts: 4 |
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) |
Copyright © 2025 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.