FWGS / xash3d

DEPRECATED in favor of https://github.com/FWGS/xash3d-fwgs. Only bugfixes are accepted.
https://xash.su
GNU General Public License v3.0
554 stars 107 forks source link

How to compile Xash3D under OSX? #106

Closed cia48621793 closed 7 years ago

cia48621793 commented 8 years ago

Looks like brew install libsdl2* didn't worked....

mittorn commented 8 years ago

Try compile SDL2 separately. FindSDL2.cmake used now, so you can easily specify path to SDL2.

a1batross commented 8 years ago

When I compiled it, I used libsdl2 libs from libsdl.org. FindSDL2.cmake easily finds it.

FreeSlave commented 8 years ago

As I remember ld on OS X does not include /usr/local/lib (where homebrew creates links) as search path by default. Before building you may need to set DYLD_LIBRARY_PATH appropriately.

sballu commented 8 years ago

I've been able to see the menu with OSX 10.6.8 With minor changes and gcc 4.8 instead of gcc 4.2

Now i have to compile the games libraries and see if it works :)

a1batross commented 8 years ago

This is how I compiled it in VirtualBox(Mac OS X 10.11):

  1. Install SDL2 libraries from libsdl.org. Placed it in Frameworks.
  2. mkdir build && cmake -DXASH_SDL=yes -DXASH_VGUI=no -DXASH_X11=no -DCMAKE_OSX_ARCHITECTURES=i386 ../ && make
  3. Comment out functions with errors. (It's only crashhandler)
  4. make again.
  5. Move all dylib's, xash3d and xash3d.sh to any folder.
  6. Run script.

This version will not have VGUI support. I need to launch VM and commit fixes for CMakeLists.txt

sballu commented 8 years ago

I've tried with the vgui less client, and I have a display problem, maybe you will be able to give some cvar to set to avoid this problem.

[](look at the picture : http://www.hostingpics.net/viewer.php?id=206263Capturedecran20160211a060246.png)

sballu commented 8 years ago

You can look this picture to see the problem : Picture

fnky commented 8 years ago

Sorry for hijacking the thread, but I seem to not be able to build, because it can't find the pm_info.h from hlsdk (built from xash3d/build relatively as mentioned by @a1batross).

Using OS X 10.11.2 — here's a log just for the sake of it

-- The C compiler identification is AppleClang 7.0.2.7000181
-- The CXX compiler identification is AppleClang 7.0.2.7000181
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
<FindSDL2.cmake>
</FindSDL2.cmake>
-- Found SDL2: /Users/iChrille/Library/Frameworks/SDL2.framework;-framework Cocoa
<FindSDL2.cmake>
</FindSDL2.cmake>
-- Configuring done
CMake Warning (dev):
  Policy CMP0042 is not set: MACOSX_RPATH is enabled by default.  Run "cmake
  --help-policy CMP0042" for policy details.  Use the cmake_policy command to
  set the policy and suppress this warning.

  MACOSX_RPATH is not specified for the following targets:

   xash
   xashmenu

This warning is for project developers.  Use -Wno-dev to suppress it.

-- Generating done
-- Build files have been written to: /Users/iChrille/git/xash3d/build
Scanning dependencies of target xashmenu
[  1%] Building CXX object mainui/CMakeFiles/xashmenu.dir/basemenu.cpp.o
[  1%] Building CXX object mainui/CMakeFiles/xashmenu.dir/menu_advcontrols.cpp.o
[  2%] Building CXX object mainui/CMakeFiles/xashmenu.dir/menu_audio.cpp.o
[  3%] Building CXX object mainui/CMakeFiles/xashmenu.dir/menu_btns.cpp.o
[  3%] Building CXX object mainui/CMakeFiles/xashmenu.dir/menu_configuration.cpp.o
[  4%] Building CXX object mainui/CMakeFiles/xashmenu.dir/menu_controls.cpp.o
[  5%] Building CXX object mainui/CMakeFiles/xashmenu.dir/menu_creategame.cpp.o
[  5%] Building CXX object mainui/CMakeFiles/xashmenu.dir/menu_credits.cpp.o
[  6%] Building CXX object mainui/CMakeFiles/xashmenu.dir/menu_customgame.cpp.o
[  7%] Building CXX object mainui/CMakeFiles/xashmenu.dir/menu_filedialog.cpp.o
[  7%] Building CXX object mainui/CMakeFiles/xashmenu.dir/menu_gameoptions.cpp.o
[  8%] Building CXX object mainui/CMakeFiles/xashmenu.dir/menu_internetgames.cpp.o
[  9%] Building CXX object mainui/CMakeFiles/xashmenu.dir/menu_langame.cpp.o
[  9%] Building CXX object mainui/CMakeFiles/xashmenu.dir/menu_loadgame.cpp.o
[ 10%] Building CXX object mainui/CMakeFiles/xashmenu.dir/menu_main.cpp.o
[ 11%] Building CXX object mainui/CMakeFiles/xashmenu.dir/menu_multiplayer.cpp.o
[ 11%] Building CXX object mainui/CMakeFiles/xashmenu.dir/menu_newgame.cpp.o
[ 12%] Building CXX object mainui/CMakeFiles/xashmenu.dir/menu_playersetup.cpp.o
In file included from /Users/iChrille/git/xash3d/mainui/menu_playersetup.cpp:28:
In file included from /Users/iChrille/git/xash3d/mainui/../common/cl_entity.h:63:
/Users/iChrille/git/xash3d/mainui/../common/entity_state.h:121:10: fatal error: 'pm_info.h' file not found
#include "pm_info.h"
         ^
1 error generated.
make[2]: *** [mainui/CMakeFiles/xashmenu.dir/menu_playersetup.cpp.o] Error 1
make[1]: *** [mainui/CMakeFiles/xashmenu.dir/all] Error 2
make: *** [all] Error 2
fnky commented 8 years ago

Nevermind figured it out. Forgot to set the path for the SDK.

fnky commented 8 years ago

Got it compiled, and running however I can't seem to play in actual levels. I have tried running with -dev to enable console, and start a map (also tried +map) however, the log says a server is spawned, but I am still within the menu.

[02:43:27] Set: [1440x900]
[02:43:28] Video: Intel Iris Pro OpenGL Engine
[02:43:28] AVI: Not supported
[02:43:28] UI_SetColors: colors.lst not found
[02:43:28] UI_LoadBmpButtons: btns_main.bmp not found
2016-02-12 02:43:28.395 xash3d[96014:3089345] 02:43:28.394 WARNING:  140: This application, or a library it uses, is using the deprecated Carbon Component Manager for hosting Audio Units. Support for this will be removed in a future release. Also, this makes the host incompatible with version 3 audio units. Please transition to the API's in AudioComponent.h.
[02:43:28] Using SDL audio driver: coreaudio @ 44100 Hz
[02:43:28] execing valve.rc
[02:43:28] execing language.cfg
[02:43:28] execing autoexec.cfg
[02:43:28] execing violence.cfg
[02:43:28] execing config.cfg
[02:43:28] execing config.cfg
[02:43:28] execing touch.cfg
[02:43:35] Dll loaded for mod Half-Life
[02:43:35] Server loaded
[02:43:35] Spawn Server: c0a0    # <-- Spawned server on map c0a0 (new game)
[02:43:35] execing skill.cfg
[02:43:35] server: GAME SKILL LEVEL:1
[02:43:35] server: *Graph Loaded!
[02:43:35] SV_LoadFromFile: 0 entities inhibited
[02:43:35] server: Dead end link trainstop27
[02:43:35] Game started
[02:43:36] Keynum 1073742051 out of range
[02:43:36] Keynum 1073742051 out of range
[02:43:40] Shutting down...        # <-- I quit the game
[02:43:40] Shutting down audio.
sballu commented 8 years ago

You have to compile the vgui less client library => There

fnky commented 8 years ago

Same result. Still get VGUI and can't start game, no idea why—everything compiles fine.

Solexid commented 8 years ago

Compile hlsdk and put hl.dll and client.dll to valve ddl folders

mittorn commented 8 years ago

Is client loaded? Can you post full log?

fnky commented 8 years ago

At the moment I haven't gotten the vgui-less hlsdk to compile, as I have to manually change Makefiles for it to compiled correctly on OS X 10.11—Which I have successfully done with the original hlsdk, but have a few struggles with your custom ones.

I used Clang to compile hlsdk, but apparently you use cflags that requires GCC 4.x in your fork.

sballu commented 8 years ago

With the vgui-less client and original server one, I have graphical bugs and low fps. I tried with both vgui-less client and server libraries, and I can t start a map. There is nothing in log.

fnky commented 8 years ago

@sballu Try start it with -dev

sballu commented 8 years ago

I started with -dev 5 ;)

mittorn commented 8 years ago

Did you try to load original osx client?

a1batross commented 7 years ago

Need to write instructions about compiling Xash3D under MacOSX and, even, add it Travis.

a1batross commented 7 years ago

https://github.com/FWGS/xash3d/wiki/Building-and-running#cmake-recommended-for-non-windows

Just use CMake. OSX is 64 bit only now, so use a command for 64 bit systems.