Sunday, October 01, 2017

linking error when compiling zdoom

Hi,

I'm trying to make port of zdoom but I can't get it to link.

The error I got was:
CMakeFiles/zdoom.dir/scripting/vm/vmexec.cpp.o: In function `__cxx_global_var_init':
/home/tmy/tmp/gzdoom-g3.1.0/src/scripting/vm/vmexec.cpp:(.text+0x42): undefined reference to `__cxa_thread_atexit'
c++: error: linker command failed with exit code 1 (use -v to see invocation)
*** Error 1 in . (src/CMakeFiles/zdoom.dir/build.make:10917 'gzdoom')

I got a bit of help in this and added following to Makefile:
CONFIGURE_ARGS+= -DCMAKE_EXE_LINKER_FLAGS="-lc++abi"

That changed the above linking error to:
usr/bin/../lib/libc++abi.so.0.0: undefined reference to `pthread_rwlock_rdlock'
/usr/bin/../lib/libc++abi.so.0.0: undefined reference to `pthread_rwlock_unlock'
/usr/bin/../lib/libc++abi.so.0.0: undefined reference to `pthread_rwlock_wrlock'


I tried to change CONFIGURE_ARGS as follows:
CONFIGURE_ARGS+= -DCMAKE_EXE_LINKER_FLAGS="-lpthread -lc++abi"

After compiling the linking failed with "undefined reference to
`__cxa_thread_atexit'" which seems odd as it should be in the c++abi library.

Any idea whats going on?

Here's my WIP Makefile:

# $OpenBSD: Makefile,v 1.8 2013/06/23 17:51:31 dcoppa Exp $

COMMENT = enhanced port of the official DOOM source code

V = 3.1.0
PKGNAME = zdoom-${V}
DISTNAME = gzdoom-g${V}

CATEGORIES= games

HOMEPAGE = https://zdoom.org

MASTER_SITES = https://zdoom.org/files/gzdoom/src/
EXTRACT_SUFX = .zip

# GPLv3
PERMIT_PACKAGE_CDROM= Yes

WANTLIB += bz2 c jpeg m pthread z

MODULES = devel/cmake

MODCMAKE_VERBOSE = yes

BUILD_DEPENDS = archivers/bzip2 \
audio/libsndfile \
audio/mpg123 \
audio/openal \
devel/nasm \
devel/sdl2 \
graphics/jpeg

CONFIGURE_ARGS+= -DCMAKE_EXE_LINKER_FLAGS="-lpthread -lc++abi"
#CONFIGURE_ARGS+= -DCMAKE_EXE_LINKER_FLAGS="-std=c++11 -stdlib=libstdc++ -lc++abi"

RUN_DEPENDS = audio/fluidsynth \
x11/gxmessage

.include <bsd.port.mk>

No comments:

Post a Comment