Compiling with Linux


(hunterthebest) #1

Hello Guys,

I got serveral problems when I try to compile etpub source with Debain x86. It gives to following error message :

Compile/src# scons
scons: Reading SConscript files ...
cpu: x86
Loading build configuration from site.conf:
WITH_LUA_SUPPORT='0'
JOBS='1'
TARGET_UI='0'
GAMERANGER='0'
CC='gcc'
CXX='g++'
BUILD='RELEASE'
TARGET_CGAME='0'
TARGET_GAME='1'
BUILD_ROOT='build'
dumpversion: 4.3.2
gcc major: 4
os: Linux
Unknown build configuration RELEASE 

If somebody can help me. Please reply on this post.
Should be awesome if u can:)


(Cambodunum) #2

… whats your problem
… maybe i can help ya
… greetz Cambo


(hunterthebest) #3

When I try to compile : I get error message

Compile/src# scons
scons: Reading SConscript files ...
cpu: x86
Loading build configuration from site.conf:
  WITH_LUA_SUPPORT='0'
  JOBS='1'
  TARGET_UI='0'
  GAMERANGER='0'
  CC='gcc'
  CXX='g++'
  BUILD='RELEASE'
  TARGET_CGAME='0'
  TARGET_GAME='1'
  BUILD_ROOT='build'
dumpversion: 4.3.2
gcc major: 4
os: Linux
Unknown build configuration RELEASE

(Scennative) #4

Hey, post plz the “SConstruct” and the “site.conf”


(hunterthebest) #5

SConstruct :

# -*- mode: python -*-
# ET build script
# TTimo <ttimo@idsoftware.com>
# http://scons.sourceforge.net

import sys, os, time, commands, re, pickle, StringIO, popen2, commands, pdb, zipfile, string, tempfile
import SCons

import scons_utils

conf_filename='site.conf'
# choose configuration variables which should be saved between runs
# ( we handle all those as strings )
serialized=[ 'CC', 'CXX', 'JOBS', 'BUILD', 'BUILD_ROOT', 'TARGET_CGAME', 'TARGET_GAME', 'TARGET_UI', 'GAMERANGER', 'WITH_LUA_SUPPORT' ]

# help -------------------------------------------

Help("""
Usage: scons [OPTIONS] [TARGET] [CONFIG]

[OPTIONS] and [TARGET] are covered in command line options, use scons -H

[CONFIG]: KEY="VALUE" [...]
a number of configuration options saved between runs in the """ + conf_filename + """ file
erase """ + conf_filename + """ to start with default settings again

CC (default gcc)
CXX (default g++)
	Specify C and C++ compilers (defaults gcc and g++)
	ex: CC="gcc-3.3"
	You can use ccache and distcc, for instance:
	CC="ccache distcc gcc" CXX="ccache distcc g++"

JOBS (default 1)
	Parallel build

BUILD (default debug)
	Use debug-all/debug/release to select build settings
	ex: BUILD="release"
	debug-all: no optimisations, debugging symbols
	debug: -O -g
	release: all optimisations, including CPU target etc.
	
DEDICATED (default 2)
	Control regular / dedicated type of build:
	0 - client
	1 - dedicated server
	2 - both

TARGET_GAME (default 1)
	Build game module

TARGET_CGAME (default 1)
	Build cgame module

TARGET_UI (default 1)
	Build ui module

WITH_LUA_SUPPORT (default 1)
	Build with Lua API support

BUILD_ROOT (default 'build')
	change the build root directory
	
NOCONF (default 0, not saved)
	ignore site configuration and use defaults + command line only

COPYBINS (default 0, not saved)
	copy the binaries in a ready-to-release format

BUILDMPBIN (default 0, not saved)
	build mp_bin.pk3 using bin/ directories and game binaries for all platforms

BUILDBUNDLE (default 0, not saved)
	create mac bundle files
"""
)

# end help ---------------------------------------

# sanity -----------------------------------------

EnsureSConsVersion( 0, 96 )

# end sanity -------------------------------------

# system detection -------------------------------

# CPU type
cpu = commands.getoutput('uname -m')
dll_cpu = '???' # grmbl, alternative naming for .so
exp = re.compile('.*i?86.*')
if exp.match(cpu):
	cpu = 'x86'
	dll_cpu = 'i386'
else:
	cpu = commands.getoutput('uname -p')
	if ( cpu == 'powerpc' ):
		cpu = 'ppc'
		dll_cpu = cpu
	else:
		cpu = 'cpu'
		dll_cpu = cpu
OS = commands.getoutput( 'uname -s' )

if( OS == 'Darwin' ):
	cpu = 'ppc'
	dll_cpu = cpu

print 'cpu: ' + cpu

# end system detection ---------------------------

# default settings -------------------------------

CC = 'gcc'
CXX = 'g++'
JOBS = '1'
BUILD = 'debug'
DEDICATED = '2'
TARGET_GAME = '1'
TARGET_CGAME = '1'
TARGET_UI = '1'
GAMERANGER = '0'
WITH_LUA_SUPPORT = '1'
BUILD_ROOT = 'build'
NOCONF = '0'
COPYBINS = '0'
BUILDMPBIN = '0'
BUILDBUNDLE = '0'

# end default settings ---------------------------

# site settings ----------------------------------

if ( not ARGUMENTS.has_key( 'NOCONF' ) or ARGUMENTS['NOCONF'] != '1' ):
	site_dict = {}
	if (os.path.exists(conf_filename)):
		site_file = open(conf_filename, 'r')
		p = pickle.Unpickler(site_file)
		site_dict = p.load()
		print 'Loading build configuration from ' + conf_filename + ':'
		for k, v in site_dict.items():
			exec_cmd = k + '=\'' + v + '\''
			print '  ' + exec_cmd
			exec(exec_cmd)
else:
	print 'Site settings ignored'

# end site settings ------------------------------

# command line settings --------------------------

for k in ARGUMENTS.keys():
	exec_cmd = k + '=\'' + ARGUMENTS[k] + '\''
	print 'Command line: ' + exec_cmd
	exec( exec_cmd )

# end command line settings ----------------------

# arch detection ---------------------------------

def gcc_major():
	major = os.popen( CC + ' -dumpversion' ).read().strip()
	print 'dumpversion: %s' % major
	major = re.sub('^([^.]+)\\..*$', '\\1', major)
	print 'gcc major: %s' % major
	return major

gcc_major_ver = gcc_major()
gcc3 = (gcc_major_ver != '2')

def gcc_is_mingw():
	mingw = os.popen( CC + ' -dumpmachine' ).read()
	return re.search('mingw', mingw) != None

if gcc_is_mingw():
	g_os = 'win32'
elif cpu == 'ppc':
	g_os = 'Darwin'
else:
	g_os = 'Linux'

print 'os: %s' % g_os

win32_build = ( g_os == 'win32' )

# end arch detection -----------------------------

# save site configuration ----------------------

if ( not ARGUMENTS.has_key( 'NOCONF' ) or ARGUMENTS['NOCONF'] != '1' ):
	for k in serialized:
		exec_cmd = 'site_dict[\'' + k + '\'] = ' + k
		exec(exec_cmd)

	site_file = open(conf_filename, 'w')
	p = pickle.Pickler(site_file)
	p.dump(site_dict)
	site_file.close()

# end save site configuration ------------------

# general configuration, target selection --------

if( win32_build ):
	g_build = BUILD_ROOT + '-mingw/' + BUILD
else:
	g_build = BUILD_ROOT + '/' + BUILD

SConsignFile( 'scons.signatures' )

SetOption('num_jobs', JOBS)

if ( OS == 'Linux' ):
	LINK = CC
else:
	LINK = CXX

# common flags
# BASE + GAME + OPT for game

BASECPPFLAGS = [ ]
CORECPPPATH = [ ]
CORELIBPATH = [ ]
CORECPPFLAGS = [ ]
GAMECPPFLAGS = [ ]
BASELINKFLAGS = [ ]
CORELINKFLAGS = [ ]

# for release build, further optimisations that may not work on all files
OPTCPPFLAGS = [ ]

# pheno: make sure to compile a 32 bit object on a compiler
#        configured to compile 64 bit objects by default
if( g_os == 'Linux' ):
	BASECPPFLAGS += [ '-m32' ]
	BASELINKFLAGS += [ '-m32' ]

if ( OS == 'Darwin' ):
	# taken from xcode's default project settings
	BASECPPFLAGS += [ '-D__MACOS__', '-Wno-long-double', '-arch', 'ppc', '-arch', 'i386', '-fasm-blocks', '-fpascal-strings', '-faltivec', '-Wno-unknown-pragmas' ]

BASECPPFLAGS.append( '-pipe' )
# warn all
BASECPPFLAGS.append( '-Wall' )
# don't wrap gcc messages
BASECPPFLAGS.append( '-fmessage-length=0' )

if ( BUILD == 'debug-all' ):
	BASECPPFLAGS.append( '-g' )
	BASECPPFLAGS.append( '-D_DEBUG' )
elif ( BUILD == 'debug' ):
	BASECPPFLAGS.append( '-g' )
	BASECPPFLAGS.append( '-O1' )
	BASECPPFLAGS.append( '-D_DEBUG' )
elif ( BUILD == 'release' ):
	BASECPPFLAGS.append( '-DNDEBUG' )
	if ( OS == 'Linux' ):
		# -fomit-frame-pointer: gcc manual indicates -O sets this implicitely,
		# only if that doesn't affect debugging
		# on Linux, this affects backtrace capability, so I'm assuming this is needed
		# -finline-functions: implicit at -O3
		# -fschedule-insns2: implicit at -O3
		# -funroll-loops ?
		# -mfpmath=sse -msse ?
		OPTCPPFLAGS = [ '-O3', '-march=i686', '-Winline', '-ffast-math', '-fomit-frame-pointer', '-finline-functions', '-fschedule-insns2' ]
	elif ( OS == 'Darwin' ):
		OPTCPPFLAGS = [ '-O3', '-falign-functions=16', '-falign-loops=16', '-finline' ]		
else:
	print 'Unknown build configuration ' + BUILD
	sys.exit(0)

# create the build environments
g_base_env = Environment( ENV = os.environ, CC = CC, CXX = CXX, LINK = LINK, CPPFLAGS = BASECPPFLAGS, LINKFLAGS = BASELINKFLAGS, CPPPATH = CORECPPPATH, LIBPATH = CORELIBPATH )
scons_utils.SetupUtils( g_base_env )

g_env = g_base_env.Copy()

g_env['CPPFLAGS'] += OPTCPPFLAGS
g_env['CPPFLAGS'] += CORECPPFLAGS
g_env['LINKFLAGS'] += CORELINKFLAGS

if ( OS == 'Darwin' ):
	# configure for dynamic bundle
	g_env['SHLINKFLAGS'] = '$LINKFLAGS -bundle -flat_namespace -undefined suppress -arch ppc -arch i386'
	g_env['SHLIBSUFFIX'] = '.so'

# maintain this dangerous optimization off at all times
g_env.Append( CPPFLAGS = '-fno-strict-aliasing' )

if ( int(JOBS) > 1 ):
	print 'Using buffered process output'
	scons_utils.SetupBufferedOutput( g_env )

# mark the globals

GLOBALS = 'g_env OS g_os win32_build BUILD gcc3 gcc_major_ver cpu GAMERANGER WITH_LUA_SUPPORT'

# end general configuration ----------------------

# win32 cross compilation ----------------------

if g_os == 'win32' and os.name != 'nt':
	# mingw doesn't define the cpu type, but our only target is x86
	g_env.Append( CPPDEFINES = '_M_IX86=400' )
	g_env.Append( LINKFLAGS = '-static-libgcc' )
	# scons doesn't support cross-compiling, so set these up manually
	g_env['STATIC_AND_SHARED_OBJECTS_ARE_THE_SAME']	= 1
	g_env['WIN32DEFSUFFIX'] = '.def'
	g_env['PROGSUFFIX'] = '.exe'
	g_env['SHLIBSUFFIX'] = '.dll'
	g_env['SHCCFLAGS'] = '$CCFLAGS'

# end win32 cross compilation ------------------

# targets ----------------------------------------

toplevel_targets = []

if ( TARGET_GAME == '1' ):
	Export( 'GLOBALS ' + GLOBALS )
	BuildDir( g_build + '/game', '.', duplicate = 0 )
	game = SConscript( g_build + '/game/SConscript.game' )
	if( win32_build == 1 ):
		toplevel_targets.append( InstallAs( '#qagame_mp_x86.dll', game ) )
	else:
		toplevel_targets.append( InstallAs( '#qagame.mp.%s.so' % dll_cpu, game ) )

if ( TARGET_CGAME == '1' ):
	Export( 'GLOBALS ' + GLOBALS )
	BuildDir( g_build + '/cgame', '.', duplicate = 0 )
	cgame = SConscript( g_build + '/cgame/SConscript.cgame' )
	if( win32_build == 1 ):
		toplevel_targets.append( InstallAs( '#cgame_mp_x86.dll', cgame ) )
	else:
		toplevel_targets.append( InstallAs( '#cgame.mp.%s.so' % dll_cpu, cgame ) )

if ( TARGET_UI == '1' ):
	Export( 'GLOBALS ' + GLOBALS )
	BuildDir( g_build + '/ui', '.', duplicate = 0 )
	ui = SConscript( g_build + '/ui/SConscript.ui' )
	if( win32_build == 1 ):
		toplevel_targets.append( InstallAs( '#ui_mp_x86.dll', ui ) )
	else:
		toplevel_targets.append( InstallAs( '#ui.mp.%s.so' % dll_cpu, ui ) )

class CopyBins(scons_utils.idSetupBase):
	def copy_bins( self, target, source, env ):
		for i in source:
			j = os.path.normpath( os.path.join( os.path.dirname( i.abspath ), '../bin', os.path.basename( i.abspath ) ) )
			self.SimpleCommand( 'cp ' + i.abspath + ' ' + j )
			if ( OS == 'Linux' ):
				self.SimpleCommand( 'strip ' + j )
			else:
				# see strip and otool man pages on mac
				self.SimpleCommand( 'strip -ur ' + j )

copybins_target = []
if ( COPYBINS != '0' ):
	copy = CopyBins()
	copybins_target.append( Command( 'copybins', toplevel_targets, Action( copy.copy_bins ) ) )

class MpBin(scons_utils.idSetupBase):
	def mp_bin( self, target, source, env ):
		temp_dir = tempfile.mkdtemp( prefix = 'mp_bin' )
		self.SimpleCommand( 'cp ../bin/ui* ' + temp_dir )
		self.SimpleCommand( 'cp ../bin/cgame* ' + temp_dir )
		# zip the mac bundles
		mac_bundle_dir = tempfile.mkdtemp( prefix = 'mp_mac' )
		self.SimpleCommand( 'cp -R "../bin/Wolfenstein ET.app/Contents/Resources/ui_mac.bundle" ' + mac_bundle_dir )
		self.SimpleCommand( 'cp -R "../bin/Wolfenstein ET.app/Contents/Resources/cgame_mac.bundle" ' + mac_bundle_dir )
		self.SimpleCommand( 'find %s -name \.svn | xargs rm -rf' % mac_bundle_dir )
		self.SimpleCommand( 'cd %s ; zip -r -D %s/ui_mac.zip ui_mac.bundle ; mv %s/ui_mac.zip %s/ui_mac' % ( mac_bundle_dir, temp_dir, temp_dir, temp_dir ) )
		self.SimpleCommand( 'cd %s ; zip -r -D %s/cgame_mac.zip cgame_mac.bundle ; mv %s/cgame_mac.zip %s/cgame_mac' % ( mac_bundle_dir, temp_dir, temp_dir, temp_dir ) )
		mp_bin_path = os.path.abspath( os.path.join ( os.getcwd(), '../etmain/mp_bin.pk3' ) )
		self.SimpleCommand( 'cd %s ; zip -r -D %s *' % ( temp_dir, mp_bin_path ) )

if ( BUILDMPBIN != '0' ):
	mp_bin = MpBin()
	mpbin_target = Command( 'mp_bin', toplevel_targets + copybins_target, Action( mp_bin.mp_bin ) )

class BuildBundle(scons_utils.idSetupBase):
	def make_bundle( self, target, source, env ):
		for i in source:
			self.SimpleCommand( './makebundle.sh %s' % i )

if ( BUILDBUNDLE != '0' ):
	build_bundle = BuildBundle()
	bundle_target = Command( 'build_bundle', toplevel_targets, Action( build_bundle.make_bundle ) )

# end targets ------------------------------------

site.config

(dp0
S'WITH_LUA_SUPPORT'
p1
S'0'
p2
sS'JOBS'
p3
S'1'
p4
sS'TARGET_UI'
p5
g2
sS'GAMERANGER'
p6
g2
sS'CC'
p7
S'gcc'
p8
sS'CXX'
p9
S'g++'
p10
sS'BUILD'
p11
S'RELEASE'
p12
sS'TARGET_CGAME'
p13
g2
sS'TARGET_GAME'
p14
g4
sS'BUILD_ROOT'
p15
S'build'
p16
s.

(Shanks) #6

It should work if you change BUILD=‘RELEASE’ to BUILD=‘release’


(hunterthebest) #7

Gives again an error :

Compile/src# scons BUILD=release
scons: Reading SConscript files ...
cpu: x86
Loading build configuration from site.conf:
  WITH_LUA_SUPPORT='0'
  JOBS='1'
  TARGET_UI='0'
  GAMERANGER='0'
  CC='gcc'
  CXX='g++'
  BUILD='release'
  TARGET_CGAME='0'
  TARGET_GAME='1'
  BUILD_ROOT='build'
Command line: BUILD='release'
dumpversion: 4.3.2
gcc major: 4
os: Linux

scons: warning: The env.Copy() method is deprecated; use the env.Clone() method instead.
File "/home/www/Compile/src/SConstruct", line 278, in <module>
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build/release/game
gcc -o build/release/game/game/bg_animation.os -c -fPIC -m32 -m32 -pipe -Wall -fmessage-length=0 -DNDEBUG -O3 -march=i686 -Winline -ffast-math -fomit-frame-pointer -finline-functions -fschedule-insns2 -fno-strict-aliasing -DGAMEDLL -DUSE_MDXFILE -DNO_BOT_SUPPORT -DTHREADS -I/home/www/Compile/Omnibot/Common -I/home/www/Compile/Omnibot/ET -Isha-1 game/bg_animation.c
In file included from /usr/include/features.h:354,
                 from /usr/include/assert.h:37,
                 from game/q_shared.h:89,
                 from game/bg_animation.c:12:
/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory
scons: *** [build/release/game/game/bg_animation.os] Error 1
scons: building terminated because of errors.


(IRATA) #8

It’s all in the error message:

/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory

Install the stubs header, this should do the trick:
aptitude install libc6-dev


(hunterthebest) #9

Again error : I guess the same…

Compile/src# scons BUILD=release
scons: Reading SConscript files ...
cpu: x86
Loading build configuration from site.conf:
  WITH_LUA_SUPPORT='0'
  JOBS='1'
  TARGET_UI='0'
  GAMERANGER='0'
  CC='gcc'
  CXX='g++'
  BUILD='release'
  TARGET_CGAME='0'
  TARGET_GAME='1'
  BUILD_ROOT='build'
Command line: BUILD='release'
dumpversion: 4.3.2
gcc major: 4
os: Linux

scons: warning: The env.Copy() method is deprecated; use the env.Clone() method instead.
File "/home/www/Compile/src/SConstruct", line 278, in <module>
scons: done reading SConscript files.
scons: Building targets ...
scons: building associated VariantDir targets: build/release/game
gcc -o build/release/game/game/bg_animation.os -c -fPIC -m32 -m32 -pipe -Wall -fmessage-length=0 -DNDEBUG -O3 -march=i686 -Winline -ffast-math -fomit-frame-pointer -finline-functions -fschedule-insns2 -fno-strict-aliasing -DGAMEDLL -DUSE_MDXFILE -DNO_BOT_SUPPORT -DTHREADS -I/home/www/Compile/Omnibot/Common -I/home/www/Compile/Omnibot/ET -Isha-1 game/bg_animation.c
In file included from /usr/include/features.h:354,
                 from /usr/include/assert.h:37,
                 from game/q_shared.h:89,
                 from game/bg_animation.c:12:
/usr/include/gnu/stubs.h:7:27: error: gnu/stubs-32.h: No such file or directory
scons: *** [build/release/game/game/bg_animation.os] Error 1
scons: building terminated because of errors.

Shouldn’t be something with version of debain : x86.?


(Shanks) #10

Do you have the glibc-devel package installed?


(hunterthebest) #11

If it’s the same what IRATA said : Yes. If it isn’t : IDK.


(hunterthebest) #12

Okey I succesfull did what you said(I installed glibc-devel) Bacon and it WORKS.
Thank you very much for u help guys!