Pirates@Home logo

Pirates@Home

Berkeley Open Infrastructure
BOINC!
for Network Computing
Home Help Status Forums Glossary Account

cube 6.05 from source

log in

Advanced search

Message boards : Pirate Applications : cube 6.05 from source

Author Message
Profile 7ri9991 [MM]
Volunteer tester
Avatar
Send message
Joined: 3 Feb 09
United States
SETI.USA
Credit: 2,934.2
RAC: 0.00
Joined: Feb 3, 2009
Verified: Jan 16, 2010
Dubloons: 3
Pieces of Eight: 10
Punishment: Canon Fodder
Message 8829 - Posted: 20 Feb 2010 | 16:49:11 UTC
Last modified: 20 Feb 2010 | 16:56:22 UTC

I'm trying to compile a static app from source for a powerpc64-unknown-linux-gnu.

When I try to compile I get the following error message after it tried to compile buffon.C

make: *** No rule to make target `-Wl,-Bstatic', needed by `cube'. Stop.


Here is the Makefile after my edits.
# Makefile for the BOINC cube program
#
# Unpack this in boinc/apps/cube.d and say 'make cube' to make
# a BOINC application which demonstrates BOINC graphics.
#
# Can be built either using A) the directory in which BOINC was BUILT,
# or B) the location where BOINC was installed. Uncomment accordingly.
#
# Comments marked #MAC# show what needs to be changed for MacOS,
# but see the file Makefile.Mac for a working example.
#
# Eric Myers - 3 August 2004
# @(#) $Id: Makefile,v 1.51 2010/02/20 03:13:25 myers Exp $
#######################################################################

default: cube cube_graphics

# Version of app we are building (change as appropriate):
# (Major version of an app must match major version of BOINC core client!)

MAJOR_VERSION= 6
MINOR_VERSION= 05
BUILD_ARCH=powerpc64-unknown-linux-gnu
#MAC#BUILD_ARCH=powerpc-apple-darwin

BIN_FILENAME= cube_$(MAJOR_VERSION).$(MINOR_VERSION)_$(BUILD_ARCH)
GFX_FILENAME= cube_graphics_$(MAJOR_VERSION).$(MINOR_VERSION)_$(BUILD_ARCH)


# A) Use BOINC_BUILD to point to where you built BOINC
# Use this if it was not yet installed in BOINC_PREFIX
#BOINC_BUILD= /usr/local/src/boinc/server_stable
#BOINC_BUILD=/net/alvarez/usr04/boinc/server_stable
BOINC_BUILD= /home/greg/boinc


# B) Use BOINC_PREFIX to point to where you have installed BOINC
# There should be lib and include/BOINC directories under it.
BOINC_PREFIX=/usr

# compiler custom flags (if you need these, eg. to enable graphics )
# Linux graphics apps need -D_REENTRANT for separate compute/graphics threads
# Need USE_GLUT to be able to use GLUT text functions
# use NOLIB on Linux to prevent graphics thread via separate .so library

#DEFS= -DHAVE_DIRENT_H
#MAC#DEFS= -DBOINC_APP_GRAPHICS -D_THREAD_SAFE -DUSE_GLUT


DEFS= -DBOINC_APP_GRAPHICS -DHEARTS
# DEFS= -DBOINC_APP_GRAPHICS -DUSE_GLUT -D_REENTRANT -D__NO_CTYPE

##################
# Header files:

#A)
INCLUDES= -I$(BOINC_BUILD)/api -I$(BOINC_BUILD)/lib -I$(BOINC_BUILD)
#B)
# INCLUDES= -I$(BOINC_PREFIX)/include/boinc


##############
# Libraries:
#
# Flags to set static/dynamic loading of libraries for more portable apps
LDSTATIC= -Wl,-Bstatic
LDDYNAMIC= -Wl,-Bdynamic

# BOINC libraries, other stuff

#A)
LIBDIRS= -L. -L$(BOINC_BUILD)/api -L$(BOINC_BUILD)/lib
#B)
# LIBDIRS= -L$(BOINC_PREFIX)/lib

LIBS= $(LIBDIRS) -lboinc_api -lboinc -static-libgcc
LIBS2= $(LDSTATIC) -L. -lstdc++ -lc -lm
#LIBS2= libstdc++.a libc.a

# This is what we need for BOINC v6
#
BOINC_GFX_LIBS= $(LIBDIRS) $(LDSTATIC) -lboinc_graphics2

# Unix graphics libraries, for OpenGL, GLU, GLUT, and X11 graphics
# (We also need JPEG libs because BOINC uses it, even though we don't)
# They are dynamic because each client host has the best version of the
# graphics libraries for it's own graphics card(s)
#
UNIX_GFX_LIBS= $(LDDYNAMIC) -L/usr/X11R6/lib -lglut -lGL -lGLU -ljpeg
-lX11 -lXmu -lXext -lXi -lSM -lICE

# And these are the graphics libraries for Mac OS X
#
MAC_GFX_LIBS= -ljpeg -lobjc -framework Cocoa -framework GLUT -framework OpenGL

# Unix or Mac?
#MAC#GLIBS= $(BOINC_GFX_LIBS) $(MAC_GFX_LIBS)
GLIBS= $(BOINC_GFX_LIBS) $(UNIX_GFX_LIBS)


##
# How to invoke the C++ compiler:

CXX = g++
CXXCPP = $(CXX) -E
CXXFLAGS =-g
LDFLAGS= -pthread -v -static-libgcc
#MAC#LDFLAGS=

CXXCOMPILE = $(CXX) -c $(DEFS) $(INCLUDES) $(CPPFLAGS) $(CXXFLAGS)
CXXLINK = g++ -o $@ $(CXXFLAGS) $(LDFLAGS)

.C.o:
$(CXXCOMPILE) -o $@ $<

##
# What we gotta make, and how to do it

OBJECTS= cube.o buffon.o
GRAPHICS= cube_gfx.o hearts.o


# In BOINC v6 the graphics are in a separate program,
# and the science app is in a separate program with no graphics
#
cube: $(OBJECTS) $(LIBS2)
$(CXX) -o $@ $+ $(CXXFLAGS) $(LDFLAGS) $(LIBS) $(LIBS2)
ln -f $@ $(BIN_FILENAME)

cube_graphics: graphics_app.o $(GRAPHICS) $(LIBS2)
$(CXXLINK) $+ $(GLIBS) $(LIBS) $(LIBS2)
ln -f $@ $(GFX_FILENAME)

##
# Object files

cube.o: cube.C buffon.h
cube_gfx.o: cube_gfx.C
tree.o: tree.C
hearts.o: hearts.c


# BOINC version 6: Generic main program for screensaver as a separate executable

graphics_app.C: ../graphics_app.C
cp ../graphics_app.C .

##
# Buffon MC simulation

buffon.C: ../buffon/buffon.C
cp $+ $@

buffon.h: ../buffon/buffon.h
cp $+ $@

buffon.o: buffon.C buffon.h

buffon: buffon.C buffon.h
-rm -f buffon.o
$(CXX) $(CXXFLAGS) -DBUFFON_STANDALONE $< -o $@

buffon_wu.xml: ../buffon/buffon_wu.xml
cp $+ $@


##
# The boinclet is a standalone test of the graphics thread
# (kinda like cube_graphics before BOINC 6). Use it to test
# graphics against GLUT without BOINC graphics libraries.

boinclet: boinclet.o $(GRAPHICS)
$(CXXLINK) $+ $(UNIX_GFX_LIBS) $(LIBDIRS) -lboinc
strip $@

boinclet.o: boinclet.C boinclet.h
$(CXXCOMPILE) -DUSE_GLUT $< -o $@

boinclet.C: ../boinclet/boinclet.C
cp ../boinclet/boinclet.C .

boinclet.h: ../boinclet/boinclet.h
cp ../boinclet/boinclet.h .


##
# Using static stdc++ library can make apps more portable
# (But no longer needed or useful on a Mac).

libstdc++.a:
ln -s ` $(CXX) --print-file-name=libstdc++.a `

libc.a:
ln -s ` $(CXX) --print-file-name=libc.a `


##
# For testing dynamics loading. Must have . in LD_LIBRARY_PATH

ldd: cube cube_graphics
export LD_LIBRARY_PATH=.:${LD_LIBRARY_PATH}; ldd -v cube
export LD_LIBRARY_PATH=.:${LD_LIBRARY_PATH}; ldd -v cube_graphics

needed: cube cube_graphics
objdump -p cube | grep NEEDED
objdump -p cube_graphics | grep NEEDED


##
# Add the application to the BOINC project, using the add_app.sh
# script, naming any extra files that should be included
# TODO: modify script to look for .so files

add_app:
add_app.sh $(SO_FILENAME)

##
# You can run the app "standalone" if you create an output file
# called "out.txt" first:

out:
rm -f out.txt stderr.txt buffon_ckpt gfx_inited boinc_finish_called
touch out.txt

test: out cube cube_graphics
cube_graphics & cube ; kill %1
@grep "Blow me down!" out.txt && echo " Success! "|| echo "Failed! "


##
# Cleaning removes the executable and object, also the long named
# executable, and any files left from running standalone

clean:
rm -f cube cube.so buffon boinclet cube_nolib cube_graphics
rm -f *.o
rm -f $(BIN_FILENAME) $(BIN_FILENAME).gz $(BIN_FILENAME).sig
rm -f $(GFX_FILENAME) $(GFX_FILENAME).gz $(GFX_FILENAME).sig
rm -f boinc_finish_called boinc_lockfile init_data.xml
rm -f stderr.txt stderrgfx.txt gfx_info
rm -f ckpt_state buffon_ckpt gfx_inited
rm -f cube_?.??_$(BUILD_ARCH) cube_?.??_$(BUILD_ARCH).so
cat /dev/null > out.txt

veryclean: clean
rm -f out.txt out a.out
rm -f cube_*_i686-*-linux-*
rm -f cube_*_windows_*
rm -f cube_*_powerpc-apple-*
rm -f cube_*_i686-apple-darwin
rm -f libstdc++.a libc.a


distclean: veryclean
rm -f *~
rm -f buffon.C buffon.h
rm -f boinclet.C boinclet.h
rm -f graphics_app.C
##

Should I just give up on a static app or am I using a wrong option? It looks like it's trying to compile the includes.

Profile Wormholio
Captain
Avatar
Send message
Joined: 6 Jun 04
United States
Away
Credit: 4,065.6
RAC: 0.00
Joined: Jun 6, 2004
Verified: Mar 13, 2008
Dubloons: 3
Pieces of Eight: 10
Punishment: Aztec curse
Message 8830 - Posted: 21 Feb 2010 | 13:38:03 UTC - in response to Message 8829.

trigggl wrote:
I'm trying to compile a static app from source for a powerpc64-unknown-linux-gnu.

When I try to compile I get the following error message after it tried to compile buffon.C
make: *** No rule to make target `-Wl,-Bstatic', needed by `cube'. Stop.


I saw this too.
The problem is that LIBS2 is being treated in one place as a list of file dependencies, and in another as a list of instructions. Try just the version that reads

LIBS2= libstdc++.a libc.a

The other was left over from when I was sorting out what gets linked statically and what gets linked dynamically (which is a little complicated).

I'll also note here for the log that for this run I learned that you don't need the extra static linking to libstdc++.a anbd libstdc.a on MacOSX because it's linked that way be default. (But I know you are on powerpc linux not darwin.)

The reason for the complexity is that on the one hand linking statically may make the executable more portable, but you want to link dynamically against the graphics libraries because they are different on each machine.

Let me know how this works. I think it's great that you are interested in this at such detail.
____________
-- Eric Myers

"Education is not the filling of a pail, but the lighting of a fire." -- William Butler Yeats

Post to thread

Message boards : Pirate Applications : cube 6.05 from source

Home Help Status Forums Glossary Account


Return to Pirates@Home main page


Copyright © 2017 Capt. Jack Sparrow