Xonotic Forums
[NEED HELP] NetRadiant doesn't compile on Mac - Printable Version

+- Xonotic Forums (https://forums.xonotic.org)
+-- Forum: Support (https://forums.xonotic.org/forumdisplay.php?fid=3)
+--- Forum: Xonotic - Help & Troubleshooting (https://forums.xonotic.org/forumdisplay.php?fid=4)
+--- Thread: [NEED HELP] NetRadiant doesn't compile on Mac (/showthread.php?tid=8005)



NetRadiant doesn't compile on Mac - nokko - 03-29-2019

Here I am, wanting to mess about with map-making for Xonotic. Against my better judgement, I run macOS. (High Sierra 10.13.6, though I doubt it matters much.) I cloned the latest version of NetRadiant off GitLab (commit SHA: ef6aad4cd2a3cb866401a4e30372ea82fd690995), installed dependencies, ran make, and....
Code:
$ export PKG_CONFIG_PATH=/opt/local/include; make

checking that the build tools exist
Checking for /bin/sh (bash (or another shell))... found.
Checking for echo (coreutils)... found.
Checking for /bin/echo -n (coreutils)... found.
Checking for cat (coreutils)... found.
Checking for mkdir -p (coreutils)... found.
Checking for cp (coreutils)... found.
Checking for cp -r --preserve=timestamps (coreutils)... found.
Checking for rm -f (coreutils)... found.
Checking for rm -f -r (coreutils)... found.
Checking for mv (coreutils)... found.
Checking for echo test | tee /dev/stderr (coreutils)... found.
Checking for sed (sed)... found.
Checking for find (findutils)... found.
Checking for diff (diff)... found.
Checking for cc (gcc)... found.
Checking for c++ (g++)... found.
Checking for ranlib (binutils)... found.
Checking for ar (binutils)... found.
Checking for pkg-config (pkg-config)... found.
Checking for unzip (unzip)... found.
Checking for git (git-core)... found.
Checking for svn (subversion)... found.
Checking for wget (wget)... found.
Checking for otool (xcode)... found.
All required tools have been found!

checking that the dependencies exist
Checking for jpeglib.h (libjpeg8-dev)... found and links.
Checking for glib.h (libglib2.0-dev)... found and links.
Checking for libxml/xpath.h (libxml2-dev)... found and links.
Checking for png.h (libpng12-dev)... found and links.
Checking for webp/decode.h (libwebp-dev)... found and links.
Checking for GL/gl.h (mesa-common-dev (or another OpenGL library))... found and links.
Checking for gtk/gtkdialog.h (libgtk2.0-dev)... found and links.
Checking for pango/pangoft2.h (libpango1.0-dev)... found and links.
Checking for gtk/gtkglwidget.h (libgtkglext1-dev)... found and links.
Checking for dlfcn.h (libc6-dev)... found and links.
Checking for zlib.h (zlib1g-dev)... found and links.
All required libraries have been found!

cc tools/quake2/qdata_heretic2/qcommon/reference.c  -MMD -W -Wall -Wcast-align -Wcast-qual -Wno-unused-parameter -fno-strict-aliasing -g -O -fPIC -I/opt/local/include/libxml2 -Itools/quake2/qdata_heretic2/common -Itools/quake2/qdata_heretic2/qcommon -Itools/quake2/qdata_heretic2 -Itools/quake2/common -Ilibs -Iinclude   -DPOSIX -DXWINDOWS -I/opt/local/lib/../include -I/usr/X11R6/include  -DRADIANT_VERSION="\"1.5.0n-git-ef6aad4c\"" -DRADIANT_MAJOR_VERSION="\"1\"" -DRADIANT_MINOR_VERSION="\"5\"" -DRADIANT_PATCH_VERSION="\"0\"" -DRADIANT_ABOUTMSG="\"Custom build\"" -DQ3MAP_VERSION="\"2.5.17n-git-ef6aad4c\"" -DRADIANT_EXECUTABLE="\"x86_64\"" -DGTK_TARGET=2  -c -o tools/quake2/qdata_heretic2/qcommon/reference.o
In file included from tools/quake2/qdata_heretic2/qcommon/reference.c:24:
tools/quake2/qdata_heretic2/qcommon/arrayedlist.h:36:8: error: unknown type name 'GDEF_ATTRIBUTE_INLINE'
static GDEF_ATTRIBUTE_INLINE int GetFreeNode( ArrayedListNode_t *nodeArray, int max ){
      ^
tools/quake2/qdata_heretic2/qcommon/arrayedlist.h:36:30: error: expected identifier or '('
static GDEF_ATTRIBUTE_INLINE int GetFreeNode( ArrayedListNode_t *nodeArray, int max ){
                            ^
tools/quake2/qdata_heretic2/qcommon/arrayedlist.h:51:8: error: unknown type name 'GDEF_ATTRIBUTE_INLINE'
static GDEF_ATTRIBUTE_INLINE void FreeNode( ArrayedListNode_t *nodeArray, int index ){
      ^
tools/quake2/qdata_heretic2/qcommon/arrayedlist.h:51:30: error: expected identifier or '('
static GDEF_ATTRIBUTE_INLINE void FreeNode( ArrayedListNode_t *nodeArray, int index ){
                            ^
4 errors generated.
make: *** [tools/quake2/qdata_heretic2/qcommon/reference.o] Error 1
Building the way that the GitLab page suggests you do it (cmake) doesn't really work either, the dependencies aren't specified correctly in the cmake file (relevant issue)
Code:
$ cmake -G "Unix Makefiles" -H. -Bbuild -DCMAKE_BUILD_TYPE=Release && cmake --build build -- -j4
-- Building NetRadiant 1.5.0n-git-ef6aad4c Custom build
-- Checking for module 'gtkglext-x11-1.0'
--   No package 'gtkglext-x11-1.0' found
CMake Error at /usr/local/Cellar/cmake/3.12.3/share/cmake/Modules/FindPkgConfig.cmake:436 (message):
 A required package was not found
Call Stack (most recent call first):
 /usr/local/Cellar/cmake/3.12.3/share/cmake/Modules/FindPkgConfig.cmake:602 (_pkg_check_modules_internal)
 cmake/FindGtkGLExt.cmake:7 (pkg_check_modules)
 libs/gtkutil/CMakeLists.txt:34 (find_package)


-- Configuring incomplete, errors occurred!


I'm not entirely sure what the make error is about. I'll put it on the issue tracker page, too, it seems like more than a dependency misconfiguration.
If anyone can shed some light on the issue, that'd be great. (Is NetRadiant for macOS even supported, has anyone gotten it to chooch?)


RE: NetRadiant doesn't compile on Mac - nokko - 03-29-2019

I was able to resolve this issue, but encountered a few more.
(Turns out my previous problem had been reported before in #118, I just had to add in #include <globaldefs.h> to the top of tools/quake2/qdata_heretic2/qcommon/arrayedlist.h)


The next problem was this error:

Code:
In file included from tools/quake3/q3data/q3data.c:29:
tools/quake3/common/vfs.h:56:45: error: use of undeclared identifier 'PATH_MAX'
extern char g_strForbiddenDirs[VFS_MAXDIRS][PATH_MAX + 1];
                                           ^
tools/quake3/q3data/q3data.c:353:6: warning: unused variable 'len' [-Wunused-variable]
       int len;
           ^
1 warning and 1 error generated.
make: *** [tools/quake3/q3data/q3data.o] Error 1


Here, PATH_MAX was undefined, I simply had to patch in another include. This time, #include <limits.h> in tools/quake3/common/vfs.h

Currently I am running into another issue, further down in compilation.
Code:
$ make
...
cc tools/quake3/q3map2/writebsp.c  -MMD -W -Wall -Wcast-align -Wcast-qual -Wno-unused-parameter -fno-strict-aliasing -g -O -fPIC -I/opt/local/include/libxml2 -I/opt/local/include/glib-2.0 -I/opt/local/lib/glib-2.0/include -I/opt/local/include -I/opt/local/include/libpng16 -I/opt/local/include   -Itools/quake3/common -Ilibs -Iinclude   -DPOSIX -DXWINDOWS -I/opt/local/lib/../include -I/usr/X11R6/include  -DRADIANT_VERSION="\"1.5.0n-git-ef6aad4c\"" -DRADIANT_MAJOR_VERSION="\"1\"" -DRADIANT_MINOR_VERSION="\"5\"" -DRADIANT_PATCH_VERSION="\"0\"" -DRADIANT_ABOUTMSG="\"Custom build\"" -DQ3MAP_VERSION="\"2.5.17n-git-ef6aad4c\"" -DRADIANT_EXECUTABLE="\"x86_64\"" -DGTK_TARGET=2  -c -o tools/quake3/q3map2/writebsp.o
file=install/q3map2.x86_64; mkdir -p ${file%/*}
c++ tools/quake3/common/cmdlib.o tools/quake3/common/imagelib.o tools/quake3/common/inout.o tools/quake3/common/jpeg.o tools/quake3/common/md4.o tools/quake3/common/mutex.o tools/quake3/common/polylib.o tools/quake3/common/scriplib.o tools/quake3/common/threads.o tools/quake3/common/vfs.o tools/quake3/q3map2/brush.o tools/quake3/q3map2/brush_primit.o tools/quake3/q3map2/bspfile_abstract.o tools/quake3/q3map2/bspfile_ibsp.o tools/quake3/q3map2/bspfile_rbsp.o tools/quake3/q3map2/bsp.o tools/quake3/q3map2/bsp_analyze.o tools/quake3/q3map2/bsp_scale.o tools/quake3/q3map2/bsp_info.o tools/quake3/q3map2/convert_ase.o tools/quake3/q3map2/convert_bsp.o tools/quake3/q3map2/convert_obj.o tools/quake3/q3map2/convert_map.o tools/quake3/q3map2/decals.o tools/quake3/q3map2/exportents.o tools/quake3/q3map2/facebsp.o tools/quake3/q3map2/fixaas.o tools/quake3/q3map2/fog.o tools/quake3/q3map2/help.o tools/quake3/q3map2/image.o tools/quake3/q3map2/leakfile.o tools/quake3/q3map2/light_bounce.o tools/quake3/q3map2/lightmaps_ydnar.o tools/quake3/q3map2/light.o tools/quake3/q3map2/light_trace.o tools/quake3/q3map2/light_ydnar.o tools/quake3/q3map2/main.o tools/quake3/q3map2/map.o tools/quake3/q3map2/minimap.o tools/quake3/q3map2/mesh.o tools/quake3/q3map2/model.o tools/quake3/q3map2/patch.o tools/quake3/q3map2/path_init.o tools/quake3/q3map2/portals.o tools/quake3/q3map2/prtfile.o tools/quake3/q3map2/shaders.o tools/quake3/q3map2/surface_extra.o tools/quake3/q3map2/surface_foliage.o tools/quake3/q3map2/surface_fur.o tools/quake3/q3map2/surface_meta.o tools/quake3/q3map2/surface.o tools/quake3/q3map2/tjunction.o tools/quake3/q3map2/tree.o tools/quake3/q3map2/visflow.o tools/quake3/q3map2/vis.o tools/quake3/q3map2/writebsp.o libddslib.a libetclib.a libfilematch.a libl_net.a libmathlib.a libpicomodel.a    -L/opt/local/lib -L/usr/X11R6/lib  -L/opt/local/lib -lxml2 -L/opt/local/lib -lglib-2.0 -lintl -L/opt/local/lib -lpng16 -ljpeg   -lz -lminizip   -o install/q3map2.x86_64
ld: warning: directory not found for option '-L/usr/X11R6/lib'
Undefined symbols for architecture x86_64:
 "_WebPDecodeRGBAInto", referenced from:
     _ImageLoad in image.o
 "_WebPGetInfo", referenced from:
     _ImageLoad in image.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [install/q3map2.x86_64] Error 1
Here, I guess something is rotten in the state of WebP? I'm not sure. Help would be appreciated, it's too late in the night for me to keep chipping away at this alone.


RE: NetRadiant doesn't compile on Mac - nokko - 03-29-2019

Attempted a fix by editing the makefile: fixed the broken paths to macOS' X11 libraries.

Code:
diff --git a/Makefile b/Makefile
index 009a3d06..f7e33d78 100644
--- a/Makefile
+++ b/Makefile
@@ -220,8 +220,13 @@ ifeq ($(OS),Darwin)
CFLAGS_COMMON += -fPIC
CXXFLAGS_COMMON += -fno-exceptions -fno-rtti
MACLIBDIR ?= /opt/local/lib
- CPPFLAGS_COMMON += -I$(MACLIBDIR)/../include -I/usr/X11R6/include
- LDFLAGS_COMMON += -L$(MACLIBDIR) -L/usr/X11R6/lib
+ # CPPFLAGS_COMMON += -I$(MACLIBDIR)/../include -I/usr/X11R6/include
+ CPPFLAGS_COMMON += -I$(MACLIBDIR)/../include -I/opt/X11/include
+
+ # LDFLAGS_COMMON += -L$(MACLIBDIR) -L/usr/X11R6/lib
+ LDFLAGS_COMMON += -L$(MACLIBDIR) -L/opt/X11/lib
+
+
LDFLAGS_DLL += -dynamiclib -ldl
EXE ?= $(shell uname -m)
MAKE_EXE_SYMLINK = true
New error, or, well, same error.
Code:
$ make
...
ar rc libpicomodel.a libs/picomodel/lwo/clip.o libs/picomodel/lwo/envelope.o libs/picomodel/lwo/list.o libs/picomodel/lwo/lwio.o libs/picomodel/lwo/lwo2.o libs/picomodel/lwo/lwob.o libs/picomodel/lwo/pntspols.o libs/picomodel/lwo/surface.o libs/picomodel/lwo/vecmath.o libs/picomodel/lwo/vmap.o libs/picomodel/picointernal.o libs/picomodel/picomodel.o libs/picomodel/picomodules.o libs/picomodel/pm_3ds.o libs/picomodel/pm_ase.o libs/picomodel/pm_fm.o libs/picomodel/pm_lwo.o libs/picomodel/pm_md2.o libs/picomodel/pm_md3.o libs/picomodel/pm_mdc.o libs/picomodel/pm_ms3d.o libs/picomodel/pm_obj.o libs/picomodel/pm_terrain.o
ranlib libpicomodel.a
file=install/q3map2.x86_64; mkdir -p ${file%/*}
c++ tools/quake3/common/cmdlib.o tools/quake3/common/imagelib.o tools/quake3/common/inout.o tools/quake3/common/jpeg.o tools/quake3/common/md4.o tools/quake3/common/mutex.o tools/quake3/common/polylib.o tools/quake3/common/scriplib.o tools/quake3/common/threads.o tools/quake3/common/vfs.o tools/quake3/q3map2/brush.o tools/quake3/q3map2/brush_primit.o tools/quake3/q3map2/bspfile_abstract.o tools/quake3/q3map2/bspfile_ibsp.o tools/quake3/q3map2/bspfile_rbsp.o tools/quake3/q3map2/bsp.o tools/quake3/q3map2/bsp_analyze.o tools/quake3/q3map2/bsp_scale.o tools/quake3/q3map2/bsp_info.o tools/quake3/q3map2/convert_ase.o tools/quake3/q3map2/convert_bsp.o tools/quake3/q3map2/convert_obj.o tools/quake3/q3map2/convert_map.o tools/quake3/q3map2/decals.o tools/quake3/q3map2/exportents.o tools/quake3/q3map2/facebsp.o tools/quake3/q3map2/fixaas.o tools/quake3/q3map2/fog.o tools/quake3/q3map2/help.o tools/quake3/q3map2/image.o tools/quake3/q3map2/leakfile.o tools/quake3/q3map2/light_bounce.o tools/quake3/q3map2/lightmaps_ydnar.o tools/quake3/q3map2/light.o tools/quake3/q3map2/light_trace.o tools/quake3/q3map2/light_ydnar.o tools/quake3/q3map2/main.o tools/quake3/q3map2/map.o tools/quake3/q3map2/minimap.o tools/quake3/q3map2/mesh.o tools/quake3/q3map2/model.o tools/quake3/q3map2/patch.o tools/quake3/q3map2/path_init.o tools/quake3/q3map2/portals.o tools/quake3/q3map2/prtfile.o tools/quake3/q3map2/shaders.o tools/quake3/q3map2/surface_extra.o tools/quake3/q3map2/surface_foliage.o tools/quake3/q3map2/surface_fur.o tools/quake3/q3map2/surface_meta.o tools/quake3/q3map2/surface.o tools/quake3/q3map2/tjunction.o tools/quake3/q3map2/tree.o tools/quake3/q3map2/visflow.o tools/quake3/q3map2/vis.o tools/quake3/q3map2/writebsp.o libddslib.a libetclib.a libfilematch.a libl_net.a libmathlib.a libpicomodel.a    -L/opt/local/lib -L/opt/X11/lib  -L/opt/local/lib -lxml2 -L/opt/local/lib -lglib-2.0 -lintl -L/opt/local/lib -lpng16 -ljpeg   -lz -lminizip   -o install/q3map2.x86_64
Undefined symbols for architecture x86_64:
 "_WebPDecodeRGBAInto", referenced from:
     _ImageLoad in image.o
 "_WebPGetInfo", referenced from:
     _ImageLoad in image.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [install/q3map2.x86_64] Error 1



RE: NetRadiant doesn't compile on Mac - Freddy - 03-29-2019

NetRadiant was switched to CMake quite some time ago, I think the Makefile should be removed as it's probably not up to date.
I'm not sure, but I think WebP support depends on crunch. For that, you need to also download the submodule:
Code:
git submodule update --init --recursive
and then run the cmake command again.