Raised This Month: $12 Target: $400
 3% 

Compiling for Linux... SSE and MMX?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Chrisber
AlliedModders Donor
Join Date: Jul 2007
Location: localhost
Old 10-13-2010 , 09:56   Compiling for Linux... SSE and MMX?
Reply With Quote #1

Hey,
I currently want to compile for Linux.
My idea was to install Code::Blocks (which works well) and then import my Visual Studio 2008 Projekt (which works aswell too).

But when I want to compile, there are some errors in the SDK:
Code:
/usr/lib/gcc/i486-linux-gnu/4.3.2/include/xmmintrin.h:35:3: error: #error "SSE instruction set not enabled"
In file included from /usr/include/c++/4.3/vector:66,
                 from test/includes.hpp:40,
                 from /home/chris/projects/test/blah.cpp:1:
/usr/include/c++/4.3/bits/stl_algobase.h:232:56: error: macro "min" passed 3 arguments, but takes just 2
/usr/include/c++/4.3/bits/stl_algobase.h:252:56: error: macro "max" passed 3 arguments, but takes just 2
In file included from SourceMM/core/sourcehook/sourcehook_impl.h:175,
                 from test/includes.hpp:6,
                 from /home/chris/projects/test/blah.cpp:1:
SourceMM/core/sourcehook/sourcehook_impl_cproto.h: In static member function ‘static unsigned int SourceHook::Impl::CProto::GetRealFlags(const SourceHook::PassInfo&)’:
SourceMM/core/sourcehook/sourcehook_impl_cproto.h:59: warning: enumeral and non-enumeral type in conditional expression
In file included from SDK/public/edict.h:14,
                 from SDK/public/engine/iserverplugin.h:16,
                 from test/includes.hpp:13,
                 from /home/chris/projects/test/blah.cpp:1:
SDK/public/mathlib/vector.h: In copy constructor ‘VectorByValue::VectorByValue(const VectorByValue&)’:
SDK/public/mathlib/vector.h:333: warning: base class ‘class Vector’ should be explicitly initialized in the copy constructor
SDK/public/mathlib/vector.h: In copy constructor ‘QAngleByValue::QAngleByValue(const QAngleByValue&)’:
SDK/public/mathlib/vector.h:1802: warning: base class ‘class QAngle’ should be explicitly initialized in the copy constructor
In file included from SDK/public/tier1/utlvector.h:25,
                 from SDK/public/gametrace.h:15,
                 from SDK/public/cmodel.h:128,
                 from SDK/public/edict.h:15,
                 from SDK/public/engine/iserverplugin.h:16,
                 from test/includes.hpp:13,
                 from /home/chris/projects/test/blah.cpp:1:
SDK/public/tier1/strtools.h: In function ‘int V_stricmp(const char*, const char*)’:
SDK/public/tier1/strtools.h:101: error: ‘stricmp’ was not declared in this scope
In file included from SDK/public/tier1/utlsymbol.h:17,
                 from SDK/public/filesystem.h:13,
                 from test/includes.hpp:14,
                 from /home/chris/projects/test/blah.cpp:1:
SDK/public/tier1/utlrbtree.h: In function ‘bool CaselessStringLessThan(const char* const&, const char* const&)’:
SDK/public/tier1/utlrbtree.h:33: error: ‘stricmp’ was not declared in this scope
In file included from SDK/public/filesystem.h:13,
                 from test/includes.hpp:14,
                 from /home/chris/projects/test/blah.cpp:1:
SDK/public/tier1/utlsymbol.h: At global scope:
SDK/public/tier1/utlsymbol.h:56: warning: type qualifiers ignored on function return type
In file included from test/includes.hpp:15,
                 from /home/chris/projects/test/blah.cpp:1:
SDK/public/game/server/iplayerinfo.h:143: warning: type qualifiers ignored on function return type
SDK/public/game/server/iplayerinfo.h:145: warning: type qualifiers ignored on function return type
In file included from SDK/public/engine/IEngineTrace.h:17,
                 from test/includes.hpp:22,
                 from /home/chris/projects/test/blah.cpp:1:
SDK/public/mathlib/vector4d.h:148: error: ISO C++ forbids declaration of ‘__m128’ with no type
SDK/public/mathlib/vector4d.h:148: error: ‘__m128’ declared as an ‘inline’ field
SDK/public/mathlib/vector4d.h:148: error: expected ‘;’ before ‘&’ token
SDK/public/mathlib/vector4d.h:149: error: expected `;' before ‘inline’
SDK/public/mathlib/vector4d.h:149: error: ISO C++ forbids declaration of ‘__m128’ with no type
SDK/public/mathlib/vector4d.h:149: error: ‘__m128’ declared as an ‘inline’ field
SDK/public/mathlib/vector4d.h:149: error: expected ‘;’ before ‘&’ token
SDK/public/mathlib/vector4d.h:151: error: expected `;' before ‘private’
SDK/public/mathlib/vector4d.h: In member function ‘void Vector4DAligned::InitZero()’:
SDK/public/mathlib/vector4d.h:622: error: ‘class Vector4DAligned’ has no member named ‘AsM128’
SDK/public/mathlib/vector4d.h:622: error: ‘_mm_set1_ps’ was not declared in this scope
SDK/public/mathlib/vector4d.h: In function ‘void Vector4DWeightMADSSE(vec_t, const Vector4DAligned&, Vector4DAligned&, const Vector4DAligned&, Vector4DAligned&)’:
SDK/public/mathlib/vector4d.h:673: error: ‘__m128’ was not declared in this scope
SDK/public/mathlib/vector4d.h:673: error: expected `;' before ‘packed’
SDK/public/mathlib/vector4d.h:676: error: ‘class Vector4DAligned’ has no member named ‘AsM128’
SDK/public/mathlib/vector4d.h:676: error: ‘class Vector4DAligned’ has no member named ‘AsM128’
SDK/public/mathlib/vector4d.h:676: error: ‘const class Vector4DAligned’ has no member named ‘AsM128’
SDK/public/mathlib/vector4d.h:676: error: ‘packed’ was not declared in this scope
SDK/public/mathlib/vector4d.h:676: error: ‘_mm_mul_ps’ was not declared in this scope
SDK/public/mathlib/vector4d.h:676: error: ‘_mm_add_ps’ was not declared in this scope
SDK/public/mathlib/vector4d.h:677: error: ‘class Vector4DAligned’ has no member named ‘AsM128’
SDK/public/mathlib/vector4d.h:677: error: ‘class Vector4DAligned’ has no member named ‘AsM128’
SDK/public/mathlib/vector4d.h:677: error: ‘const class Vector4DAligned’ has no member named ‘AsM128’
In file included from test/includes.hpp:27,
                 from /home/chris/projects/test/blah.cpp:1:
SDK/game/shared/IEffects.h: At global scope:
SDK/game/shared/IEffects.h:23: error: use of enum ‘ShakeCommand_t’ without previous declaration
In file included from SDK/public/SoundEmitterSystem/isoundemittersystembase.h:17,
                 from test/includes.hpp:29,
                 from /home/chris/projects/test/blah.cpp:1:
SDK/public/mathlib/compressed_vector.h:528: warning: type qualifiers ignored on function return type
In file included from SDK/game/server/util.h:23,
                 from SDK/game/server/cbase.h:69,
                 from test/includes.hpp:32,
                 from /home/chris/projects/test/blah.cpp:1:
SDK/public/server_class.h: In constructor ‘ServerClass::ServerClass(const char*, SendTable*)’:
SDK/public/server_class.h:47: error: ‘_stricmp’ was not declared in this scope
SDK/public/server_class.h:56: error: ‘_stricmp’ was not declared in this scope
In file included from SDK/game/server/cbase.h:69,
                 from test/includes.hpp:32,
                 from /home/chris/projects/test/blah.cpp:1:
SDK/game/server/util.h: In function ‘bool FStrEq(const char*, const char*)’:
SDK/game/server/util.h:176: error: ‘stricmp’ was not declared in this scope
I don't know why this appears :/
I use the reverse-engineered SDK from hg.alliedmods.net for orangebox-valve

GCC version is 4.3.2

Any ideas?

Thanks!
Chrisber is offline
PM
hello, i am pm
Join Date: Jan 2004
Location: Canalization
Old 10-13-2010 , 10:36   Re: Compiling for Linux... SSE and MMX?
Reply With Quote #2

The compiler is in "no sse" mode (which makes sense because enabling sse reduces the number of computers your code will run on - though nowadays eveyone has it and valve requires it AFAIK)

Looks like you will want to compile with the flags from the linux Makefiles of the AM HL2 projects, ie. at least

-mfpmath=sse -msse -DHAVE_STDINT_H -m32
(the last being 32 bit build even if you're on x64 -- though maybe Code::Blocks does that for you)

and maybe also
-fno-exceptions -fno-rtti

and stuff. Look at the Makefile of sourcemod / mm:s / etc., search for CFLAGS and CPPFLAGS.

Greetings,
PM
__________________
hello, i am pm
PM is offline
Chrisber
AlliedModders Donor
Join Date: Jul 2007
Location: localhost
Old 10-21-2010 , 20:45   Re: Compiling for Linux... SSE and MMX?
Reply With Quote #3

Hi,
thanks a lot! Most errors disappeared for now

It _seems_ that everything works fine now.
Can you tell me which GCC version do I have to use for Orangebox Valve (CS:S)?

Thanks!
Chrisber is offline
KyleS
SourceMod Plugin Approver
Join Date: Jul 2009
Location: Segmentation Fault.
Old 10-22-2010 , 03:00   Re: Compiling for Linux... SSE and MMX?
Reply With Quote #4

https://bugs.alliedmods.net/show_bug.cgi?id=4655

Could be terribly wrong, but I'm assuming 4.4
KyleS is offline
Keeper
Senior Member
Join Date: Nov 2006
Old 10-22-2010 , 09:02   Re: Compiling for Linux... SSE and MMX?
Reply With Quote #5

We use 4.2 because of problems with some GSPs not having up to date GLIBC installed.
Keeper is offline
Chrisber
AlliedModders Donor
Join Date: Jul 2007
Location: localhost
Old 10-23-2010 , 08:19   Re: Compiling for Linux... SSE and MMX?
Reply With Quote #6

So, if I read correctly, VALVe uses GCC 4.4 now? And what's about the supposed broken MM:S? (Or did I misunderstood the text?)

Thanks
Chrisber is offline
Keeper
Senior Member
Join Date: Nov 2006
Old 10-23-2010 , 21:58   Re: Compiling for Linux... SSE and MMX?
Reply With Quote #7

The official word is 4.2 or higher. They also require libc 2.4 or higher.

Looking at server.so, CS:S does not require anything > 2.3
Looking at all the binaries in the orangebox/bin, nothing requires anything > 2.3

So if you compile anything requiring GLIBC > 2.3, you run the risk of some server operators not being able to use it.

I think only the L4D series requires >= 2.4
Keeper is offline
BAILOPAN
Join Date: Jan 2004
Old 10-23-2010 , 22:11   Re: Compiling for Linux... SSE and MMX?
Reply With Quote #8

SourceMod Linux builds always use gcc-4.1 FWIW. On Mac, we use gcc-4.2. Higher than that, I don't think we've verified our HL2SDK branches work with -Wall -Werror (if anyone still uses either these branches or those flags).

DS is looking into building SourceMod with clang & LLVM.
__________________
egg
BAILOPAN is offline
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 06:44.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode