1

I'm trying to use AngelScript on a 64 bit Linux machine (Linux Mint 14). I have installed the gnuc project that comes with the AngelScript sdk and tried to compile with the following command:

g++ -fno-strict-aliasing main.cpp -langelscript

This causes the following linker errors:

/usr/local/lib/libangelscript.a(as_thread.o): In function `asCThreadManager::asCThreadManager()':
as_thread.cpp:(.text+0x12a): undefined reference to `pthread_key_create'
/usr/local/lib/libangelscript.a(as_thread.o): In function `asCThreadManager::~asCThreadManager()':
as_thread.cpp:(.text+0x381): undefined reference to `pthread_key_delete'
/usr/local/lib/libangelscript.a(as_thread.o): In function `asCThreadManager::CleanupLocalData()':
as_thread.cpp:(.text+0x453): undefined reference to `pthread_getspecific'
as_thread.cpp:(.text+0x4b8): undefined reference to `pthread_setspecific'
/usr/local/lib/libangelscript.a(as_thread.o): In function `asCThreadManager::GetLocalData()':
as_thread.cpp:(.text+0x4f7): undefined reference to `pthread_getspecific'
as_thread.cpp:(.text+0x557): undefined reference to `pthread_setspecific'
/usr/local/lib/libangelscript.a(as_thread.o): In function `asCThreadCriticalSection::TryEnter()':
as_thread.cpp:(.text+0x6a0): undefined reference to `pthread_mutex_trylock'
/usr/local/lib/libangelscript.a(as_thread.o): In function `asCThreadReadWriteLock::asCThreadReadWriteLock()':
as_thread.cpp:(.text+0x6c5): undefined reference to `pthread_rwlock_init'
/usr/local/lib/libangelscript.a(as_thread.o): In function `asCThreadReadWriteLock::~asCThreadReadWriteLock()':
as_thread.cpp:(.text+0x708): undefined reference to `pthread_rwlock_destroy'
/usr/local/lib/libangelscript.a(as_thread.o): In function `asCThreadReadWriteLock::AcquireExclusive()':
as_thread.cpp:(.text+0x722): undefined reference to `pthread_rwlock_wrlock'
/usr/local/lib/libangelscript.a(as_thread.o): In function `asCThreadReadWriteLock::ReleaseExclusive()':
as_thread.cpp:(.text+0x73c): undefined reference to `pthread_rwlock_unlock'
/usr/local/lib/libangelscript.a(as_thread.o): In function `asCThreadReadWriteLock::AcquireShared()':
as_thread.cpp:(.text+0x756): undefined reference to `pthread_rwlock_rdlock'
/usr/local/lib/libangelscript.a(as_thread.o): In function `asCThreadReadWriteLock::ReleaseShared()':
as_thread.cpp:(.text+0x770): undefined reference to `pthread_rwlock_unlock'
collect2: error: ld returned 1 exit status

It seems a lot of things are undefined. I'm thinking it's a problem with the library installation.

RaptorDotCpp
  • 1,425
  • 14
  • 26

2 Answers2

1

AngelScript requires a library to be defined for threading. On GNU/Linux, you can enable this by adding -lpthread to your compilation command, to add Posix Threads.

RaptorDotCpp
  • 1,425
  • 14
  • 26
0

How to install AngelScript for Linux [Source]

mkdir angelscript
cd angelscript
wget http://www.angelcode.com/angelscript/sdk/files/angelscript_2.22.1.zip
unzip angelscript_*.zip
cd sdk/angelscript/projects/gnuc
SHARED=1 VERSION=2.22.1 make

# sudo make install fails when making the symbolic link, this removes the existing versions
rm -f ../../lib/\*
sudo SHARED=1 VERSION=2.22.1 make install

#cleanup files made by root
rm -f ../../lib/\*
cd ../../../../../
jackw11111
  • 1,457
  • 1
  • 17
  • 34
  • But if you need the current version I haven't figured out a way yet, other than to download the source with `wget ...angelscript_LATEST_VERSION.zip` replace LATEST_VERSION with release number and building the codeblocks project, setting the build to -m64 in compiler settings first, the lib files can then be copied to usr/local and link with `-langelscript64 -langelscript64d `. – jackw11111 Oct 27 '19 at 01:10