Page 1 of 1

Building Source.Python failed - ./Build.sh: 158: Bad substitution

Posted: Mon May 04, 2020 5:05 pm
by Pudge90
Hi everyone, so I am trying to build SP on an ubuntu 20.04 machine. I am using gcc 4.8.5, cmake 3.16.3. I ran ./Build.sh csgo and my build died after 47%:

Code: Select all

[ 47%] Building CXX object CMakeFiles/core.dir/core/modules/entities/entities_entity_wrap.cpp.o



The last messages are:

Code: Select all

In file included from /home/steam/sourcepython/Source.Python/src/core/modules/entities/entities_entity_wrap.cpp:34:0:
/home/steam/sourcepython/Source.Python/src/core/modules/physics/physics.h: In static member function ‘static U* Wrapper<T>::_obj(CPointer*)’:
/home/steam/sourcepython/Source.Python/src/core/modules/physics/physics.h:60:11: error: ‘Wrap’ was not declared in this scope
  { return Wrap<U>(__obj__<T>(pPtr)); }
           ^
/home/steam/sourcepython/Source.Python/src/core/modules/physics/physics.h:60:17: error: expected primary-expression before ‘>’ token
  { return Wrap<U>(__obj__<T>(pPtr)); }
                 ^
make[2]: *** [CMakeFiles/core.dir/build.make:609: CMakeFiles/core.dir/core/modules/entities/entities_entity_wrap.cpp.o] Error 1
COLLECT_GCC_OPTIONS='-D' 'BOOST_PYTHON_MAX_ARITY=32' '-D' 'BOOST_PYTHON_NO_LIB' '-D' 'BOOST_PYTHON_SOURCE' '-D' 'BOOST_PYTHON_STATIC_LIB' '-D' 'ENGINE_BRANCH_CSGO' '-D' 'ENGINE_CSGO' '-D' 'GAME_DLL=1' '-D' 'SOURCE_ENGINE=csgo' '-D' 'SOURCE_ENGINE_BRANCH=csgo' '-D' 'USE_PROTOBUF' '-D' 'core_EXPORTS' '-I' '/home/steam/sourcepython/Source.Python/src/hl2sdk/csgo' '-I' '/home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/common' '-I' '/home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/common/protobuf-2.5.0/src' '-I' '/home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/game/shared' '-I' '/home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/game/server' '-I' '/home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/public' '-I' '/home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/public/tier0' '-I' '/home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/public/tier1' '-I' '/home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/public/engine/protobuf' '-I' '/home/steam/sourcepython/Source.Python/src/thirdparty/dyncall/include' '-I' '/home/steam/sourcepython/Source.Python/src/thirdparty/boost' '-I' '/home/steam/sourcepython/Source.Python/src/thirdparty/AsmJit/include' '-I' '/home/steam/sourcepython/Source.Python/src/thirdparty/DynamicHooks/include' '-I' '/home/steam/sourcepython/Source.Python/src/core' '-I' '/home/steam/sourcepython/Source.Python/src/thirdparty/python_linux/include' '-D' '_LINUX' '-D' 'POSIX' '-D' 'LINUX' '-D' 'GNUC' '-D' 'COMPILER_GCC' '-D' 'stricmp=strcasecmp' '-D' '_stricmp=strcasecmp' '-D' '_strnicmp=strncasecmp' '-D' 'strnicmp=strncasecmp' '-D' '_snprintf=snprintf' '-D' '_vsnprintf=vsnprintf' '-D' '_alloca=alloca' '-D' 'strcmpi=strcasecmp' '-Wall' '-Wno-uninitialized' '-Wno-switch' '-Wno-unused' '-Wno-non-virtual-dtor' '-Wno-overloaded-virtual' '-Wno-conversion-null' '-Wno-write-strings' '-Wno-invalid-offsetof' '-Wno-reorder' '-mfpmath=sse' '-msse' '-m32' '-fno-strict-aliasing' '-std=c++11' '-fno-threadsafe-statics' '-v' '-fvisibility=hidden' '-D' '_NDEBUG' '-O3' '-D' 'NDEBUG' '-fPIC' '-o' 'CMakeFiles/core.dir/core/modules/engines/engines_server_wrap.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=i686'
 as -v -I /home/steam/sourcepython/Source.Python/src/hl2sdk/csgo -I /home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/common -I /home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/common/protobuf-2.5.0/src -I /home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/game/shared -I /home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/game/server -I /home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/public -I /home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/public/tier0 -I /home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/public/tier1 -I /home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/public/engine/protobuf -I /home/steam/sourcepython/Source.Python/src/thirdparty/dyncall/include -I /home/steam/sourcepython/Source.Python/src/thirdparty/boost -I /home/steam/sourcepython/Source.Python/src/thirdparty/AsmJit/include -I /home/steam/sourcepython/Source.Python/src/thirdparty/DynamicHooks/include -I /home/steam/sourcepython/Source.Python/src/core -I /home/steam/sourcepython/Source.Python/src/thirdparty/python_linux/include --32 -o CMakeFiles/core.dir/core/modules/engines/engines_server_wrap.cpp.o /tmp/cct6aa0I.s
GNU assembler version 2.34 (x86_64-linux-gnu) using BFD version (GNU Binutils for Ubuntu) 2.34
COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/
LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.8/32/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../i386-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../../lib32/:/lib/i386-linux-gnu/:/lib/../lib32/:/usr/lib/i386-linux-gnu/:/usr/lib/../lib32/:/usr/lib/gcc/x86_64-linux-gnu/4.8/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../i386-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.8/../../../:/lib/i386-linux-gnu/:/lib/:/usr/lib/i386-linux-gnu/:/usr/lib/
COLLECT_GCC_OPTIONS='-D' 'BOOST_PYTHON_MAX_ARITY=32' '-D' 'BOOST_PYTHON_NO_LIB' '-D' 'BOOST_PYTHON_SOURCE' '-D' 'BOOST_PYTHON_STATIC_LIB' '-D' 'ENGINE_BRANCH_CSGO' '-D' 'ENGINE_CSGO' '-D' 'GAME_DLL=1' '-D' 'SOURCE_ENGINE=csgo' '-D' 'SOURCE_ENGINE_BRANCH=csgo' '-D' 'USE_PROTOBUF' '-D' 'core_EXPORTS' '-I' '/home/steam/sourcepython/Source.Python/src/hl2sdk/csgo' '-I' '/home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/common' '-I' '/home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/common/protobuf-2.5.0/src' '-I' '/home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/game/shared' '-I' '/home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/game/server' '-I' '/home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/public' '-I' '/home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/public/tier0' '-I' '/home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/public/tier1' '-I' '/home/steam/sourcepython/Source.Python/src/hl2sdk/csgo/public/engine/protobuf' '-I' '/home/steam/sourcepython/Source.Python/src/thirdparty/dyncall/include' '-I' '/home/steam/sourcepython/Source.Python/src/thirdparty/boost' '-I' '/home/steam/sourcepython/Source.Python/src/thirdparty/AsmJit/include' '-I' '/home/steam/sourcepython/Source.Python/src/thirdparty/DynamicHooks/include' '-I' '/home/steam/sourcepython/Source.Python/src/core' '-I' '/home/steam/sourcepython/Source.Python/src/thirdparty/python_linux/include' '-D' '_LINUX' '-D' 'POSIX' '-D' 'LINUX' '-D' 'GNUC' '-D' 'COMPILER_GCC' '-D' 'stricmp=strcasecmp' '-D' '_stricmp=strcasecmp' '-D' '_strnicmp=strncasecmp' '-D' 'strnicmp=strncasecmp' '-D' '_snprintf=snprintf' '-D' '_vsnprintf=vsnprintf' '-D' '_alloca=alloca' '-D' 'strcmpi=strcasecmp' '-Wall' '-Wno-uninitialized' '-Wno-switch' '-Wno-unused' '-Wno-non-virtual-dtor' '-Wno-overloaded-virtual' '-Wno-conversion-null' '-Wno-write-strings' '-Wno-invalid-offsetof' '-Wno-reorder' '-mfpmath=sse' '-msse' '-m32' '-fno-strict-aliasing' '-std=c++11' '-fno-threadsafe-statics' '-v' '-fvisibility=hidden' '-D' '_NDEBUG' '-O3' '-D' 'NDEBUG' '-fPIC' '-o' 'CMakeFiles/core.dir/core/modules/engines/engines_server_wrap.cpp.o' '-c' '-shared-libgcc' '-mtune=generic' '-march=i686'
make[1]: *** [CMakeFiles/Makefile2:105: CMakeFiles/core.dir/all] Error 2
make: *** [Makefile:84: all] Error 2
./Build.sh: 158: Bad substitution


Line 158 in my Build.sh is:

Code: Select all

test ${PIPESTATUS[0]} -eq 0


Before I had different errors regarding the gcc version or missing libraries but now I am a little lost about what's wrong. Any help here to get this to work is appreciated. Thanks

Re: Building Source.Python failed - ./Build.sh: 158: Bad substitution

Posted: Mon May 04, 2020 5:36 pm
by L'In20Cible
Seems like a forward declaration issue on Linux introduced by 895338e. What if you replace ../src/core/modules/physics/physics.h#L64 from:

Syntax: Select all

return Wrap<U>((T *)pPtr->m_ulAddr);

To:

Syntax: Select all

return ::Wrap<U>((T *)pPtr->m_ulAddr);


Alternatively, what if you add the following lines:

Syntax: Select all

template<class WrapperType>
WrapperType* Wrap(typename WrapperType::wrapped_type* pWrapped);

Before ../src/core/modules/physics/physics.h#L43?

Re: Building Source.Python failed - ./Build.sh: 158: Bad substitution

Posted: Mon May 04, 2020 7:59 pm
by Pudge90
Thanks for the fast reply!
Since I pulled the latest master my physics.h already looked a little different so I went with your alternative approach and added the two lines:

Syntax: Select all

Code: Select all

template<class WrapperType>
WrapperType* Wrap(typename WrapperType::wrapped_type* pWrapped);


With that change the build process went though till:

Code: Select all

[100%] Built target core

Which is great.

But right after that I received:

Code: Select all

./Build.sh: 158: Bad substitution


I then checked .../src/Builds/Linux/csgo/ but there was no "Release" folder (as described here: https://github.com/Source-Python-Dev-Team/Source.Python/blob/92b3adfaaaf1bb9ecd2be1ddad55bc68589b4152/addons/source-python/docs/source-python/source/contributing/building.rst
This is all there is (output of ls):
build.log CMakeCache.txt CMakeFiles cmake_install.cmake core.so Makefile source-python.so

Is that correct ? Am I still missing something ?

Re: Building Source.Python failed - ./Build.sh: 158: Bad substitution

Posted: Mon May 04, 2020 8:22 pm
by L'In20Cible
Pudge90 wrote:Thanks for the fast reply!
Since I pulled the latest master my physics.h already looked a little different so I went with your alternative approach and added the two lines:

Syntax: Select all

Code: Select all

template<class WrapperType>
WrapperType* Wrap(typename WrapperType::wrapped_type* pWrapped);


With that change the build process went though till:

Code: Select all

[100%] Built target core

Which is great.

But right after that I received:

Code: Select all

./Build.sh: 158: Bad substitution


I then checked .../src/Builds/Linux/csgo/ but there was no "Release" folder (as described here: https://github.com/Source-Python-Dev-Team/Source.Python/blob/92b3adfaaaf1bb9ecd2be1ddad55bc68589b4152/addons/source-python/docs/source-python/source/contributing/building.rst
This is all there is (output of ls):
build.log CMakeCache.txt CMakeFiles cmake_install.cmake core.so Makefile source-python.so

Is that correct ? Am I still missing something ?

Sounds like a typo in the docs. Place that source-python.so into your ../addons/ directory and that core.so into your ../addons/source-python/bin/ one and it should be working.

Re: Building Source.Python failed - ./Build.sh: 158: Bad substitution

Posted: Mon May 04, 2020 8:50 pm
by Pudge90
Okay, I'll try it out tomorrow. Thanks!

Out of curiosity, why is the core.dll(~4mb) so much smaller than the core.so(~20mb) ? Is that just due to the compiler ?

Re: Building Source.Python failed - ./Build.sh: 158: Bad substitution

Posted: Mon May 04, 2020 9:07 pm
by L'In20Cible
Pudge90 wrote:Okay, I'll try it out tomorrow. Thanks!

Out of curiosity, why is the core.dll(~4mb) so much smaller than the core.so(~20mb) ? Is that just due to the compiler ?

The ELF file contains much more info than the bare DLL (debug symbols, dwarf info, etc.) which would requires an external PDB file on windows, etc.

Re: Building Source.Python failed - ./Build.sh: 158: Bad substitution

Posted: Tue May 05, 2020 6:34 pm
by Pudge90
I tried to load my plugin today with the built core.so and source-python.so and the plugin was loaded successfully, thanks!

L'In20Cible wrote:The ELF file contains much more info than the bare DLL (debug symbols, dwarf info, etc.) which would requires an external PDB file on windows, etc.

Ahh okay I see.