Mac OS compile?
Hey all, first post on this amazing community.

So I was giving compiling on Mac OS a go and immediately ran into trouble. Loaded the project into Xcode but "Product->Build" gives me an error "C++ linker does not work with blank $LIBS". I'm wondering if this is a normal and known error with some common fix for the project or if my build environment is fubar.

Back story; my 5-yr old (too young?) loves playing Descent 2 with me, and he wants me to change one of the missiles so that instead of damage, upon impact the robot becomes "silkwing" or "imagespace". Well, as a developer dad, of course I find the source code and get to work. But I'm stuck at Step 0.

Here's the full stack.

ExternalBuildToolExecution d1x-rebirth-opengl
    cd /Users/bdamm/usr/dxx-rebirth/contrib/..
    export ACTION=
    /usr/local/bin/scons d1x=1 d2x=0 opengl=True debug=True editor=False CXXFLAGS=-O0 builddir=build/d1x-rebirth-opengl ipv6=False use_udp=True use_tracker=True --
===== D1X-Rebirth v0.59.100 0.60.0-beta2-33-g926a7f2a9286* =====
DXX-Archive.2: compiling on 'darwin'/'x86_64' for 'darwin' into build/d1x-rebirth-opengl/
DXX-Archive.2: checking version of C++ compiler 'g++' ... 'Apple LLVM version 7.3.0 (clang-703.0.31)'
DXX-Archive.2: checking path to assembler ... '/Applications/'
DXX-Archive.2: checking version of assembler '/Applications/' ... 'Apple LLVM version 7.3.0 (clang-703.0.31)'
DXX-Archive.2: checking path to linker ... '/Applications/'
DXX-Archive.2: checking version of linker '/Applications/' ... None
DXX-Archive.2:    CXX: 'g++'
DXX-Archive.2:    CPPDEFINES: ['__unix__', ('PHYSFS_DEPRECATED', '')]
DXX-Archive.2:    CPPPATH: ['/Users/bdamm/Library/Frameworks/SDL.framework/Headers', '/Library/Frameworks/SDL.framework/Headers', 'common/include', 'common/main', '.', 'build/d1x-rebirth-opengl/']
DXX-Archive.2:    CPPFLAGS: ['-Wno-sign-compare']
DXX-Archive.2:    CXXFLAGS: ['-g', '-O2', '-ftabstop=4', '-Wall', '-Werror=extra', '-Werror=format=2', '-Werror=missing-braces', '-Werror=missing-include-dirs', '-Werror=uninitialized', '-Werror=undef', '-Werror=pointer-arith', '-Werror=cast-qual', '-Werror=missing-declarations', '-Werror=redundant-decls', '-Werror=vla', '-funsigned-char', '-O0']
DXX-Archive.2:    LIBS: None
DXX-Archive.2:    LINKFLAGS: ['-Wl,-rpath,@loader_path/../Frameworks']
DXX-Archive.2:    $CCACHE_PREFIX: None
DXX-Archive.2:    $DISTCC_HOSTS: None
DXX-Archive.2: checking whether C++ compiler and linker
DXX-Archive.2: checking whether C++ compiler works...yes
DXX-Archive.2: checking whether C++ compiler and linker work with blank $LIBS and blank $
scons: *** C++ compiler works.  C++ linker does not work with specified blank $LIBS and specified $LINKFLAGS.  C++ linker does not work with blank $LIBS and blank $LINKFLAGS.  See build/d1x-rebirth-opengl/sconf.log for details.  Stop.
Command /usr/local/bin/scons failed with exit code 2

Anyone know what this points to?

Kreator tends the OS X build. I think it works, since he recently filed a ticket about a problem running from Finder. The build output says to check the sconf.log. What does that log show?
Ah ya! Of course, *smack forehead*

That file ends with:
g++ -c -g -O2 -ftabstop=4 -Wall -Werror=extra -Werror=format=2 -Werror=missing-braces -Werror=missing-include-dirs -Werror=uninitialized -Werror=undef -Werror=pointer-arith -Werror=cast-qual -Werror=missing-declarations -Werror=redundant-decls -Werror=vla -funsigned-char -O0 -Werror -Wno-sign-compare -D__unix__ -DPHYSFS_DEPRECATED= -I/Users/bdamm/Library/Frameworks/SDL.framework/Headers -I/Library/Frameworks/SDL.framework/Headers -Icommon/include -Icommon/main -I. -Ibuild/d1x-rebirth-opengl -F/Users/bdamm/Library/Frameworks -F/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks build/d1x-rebirth-opengl/.sconf_temp/conftest_2.cpp -o build/d1x-rebirth-opengl/.sconf_temp/conftest_2.o
g++ -g -O2 -ftabstop=4 -Wall -Werror=extra -Werror=format=2 -Werror=missing-braces -Werror=missing-include-dirs -Werror=uninitialized -Werror=undef -Werror=pointer-arith -Werror=cast-qual -Werror=missing-declarations -Werror=redundant-decls -Werror=vla -funsigned-char -O0 -Werror build/d1x-rebirth-opengl/.sconf_temp/conftest_2.o -F/Users/bdamm/Library/Frameworks -F/System/Library/Frameworks/ApplicationServices.framework/Versions/A/Frameworks -framework ApplicationServices -framework Cocoa -framework SDL -framework OpenGL -o build/d1x-rebirth-opengl/.sconf_temp/conftest_2
ld: warning: directory not found for option '-F/Users/bdamm/Library/Frameworks'
ld: framework not found SDL
clang: error: linker command failed with exit code 1 (use -v to see invocation)
scons: Configure: no

So I think that means I need to install SDL. I've gone back and re-read the compilation instructions, sure enough there it is. My apologies. SDL 1.2.8... and physFS.

Thanks Smile
Ok, after installing the needed bits I got a good build! Specifically, I was never able to build SDL 1.2.15 from source (there are bugs that prevent building with El Capitan) but using the binary framework package worked. Same for SDL_mixer (1.2.8 I think). PhysFS 3.0.1 source repository compiled cleanly with just "cmake; make; make install". Held my breath on the Xcode compile and got a clean compile. I took my old Descent data files (from GoG distribution) and copied them over to the build target Contents/Resources, and presto, Descent 1 fired right up! It looks amazing, this game has *NEVER* looked so good. Wow, what amazing work you guys have done. And the menu adjustments are outstanding. And I love the logging and diagnostics. Rebirth indeed!

Next up will be to figure out how to compile or start it as Descent 2. For another day!
The same source tree can build Descent and Descent 2. From your output, it looks like the Xcode wrapper projects force it to build only one or the other at a time. This is probably because it would be overwhelming to the user to offer all the combinations as individual projects, and the Xcode projects interface lacks the customizeability to let you check off the features you want. I see in source control a target d2x-rebirth-opengl. I expect that will do what you want (but I have no Mac on which to check this).

As for your longer term goal, the text for those cheats is in similar/main/gamecntl.cpp. Look there to trace how the cheats are implemented. Look in similar/main/collide.cpp at apply_damage_to_robot and collide_robot_and_weapon for possible places to detect the missile event. If you want more hints, ask.
Poking around collide_robot_and_weapon I tried a bunch of stuff that didn't work but ultimately ended up with:
   int jolly_strike = !robot_is_companion(robptr) && (get_weapon_id(weapon) == weapon_id_type::CONCUSSION_ID);
       powerup_basic_str(30, 30, 30, 1, "Jolly missile strike!");

Along the way I learned a lot about the ai subsystem. Next task: Make the robots actually turn to the nearest wall then either hold station or spin. We shall see Smile

Thanks for the help!

Forum Jump:

Users browsing this thread: 1 Guest(s)