aliens

Author Topic: [SOLVED] Xcode build failure (OSX 10.12)  (Read 4173 times)

Offline Grub

  • Squaddie
  • *
  • Posts: 6
    • View Profile
[SOLVED] Xcode build failure (OSX 10.12)
« on: April 14, 2017, 01:40:33 am »
Hello, Im trying to build using Xcode. I have tried deleting and starting fresh on both the latest nightly download and homebrew unfortunately I keep running into the same error.

SetWindowedRootState.cpp:78:72: Cannot take the address of an rvalue of type 'std::__1::basic_ostringstream<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >' 

I am new to coding and feel like I'm in over my head also, I don't know how to include my screenshot other than attaching it
« Last Edit: April 14, 2017, 05:47:30 pm by Grub »

Offline MadHaTr

  • Sergeant
  • **
  • Posts: 18
    • View Profile
Re: Xcode build failure (OSX 10.12)
« Reply #1 on: April 14, 2017, 04:37:35 am »
You followed the instructions in the xcode folder that came with the source code?   

Spoiler:
To successfully build an OpenXcom OSX bundle you will need the relevant Xcode project files provided herewith as well as all the relevant dependencies installed in /usr/local/.

The dependencies you require are following:
- SDL (libsdl1.2)
- SDL_mixer (libsdl-mixer1.2)
- SDL_gfx (libsdl-gfx1.2), version 2.0.22 or later
- SDL_image (libsdl-image1.2)
- yaml-cpp, version 0.5 or later

If you want to save yourself the trouble - don’t do it manually, use Homebrew package manager - http://mxcl.github.com/homebrew/ or MacPorts - https://www.macports.org/ instead.

This guide assumes you listened to the previous recommendation and had your dependencies installed with brew terminal command (for Homebrew), like this:
```
$ brew install cmake yaml-cpp --with-static-lib sdl sdl_gfx sdl_image sdl_mixer --with-flac --with-libmikmod --with-libvorbis --with-static-lib
```
or port terminal command (for MacPorts), like this:
```
$ sudo port install yaml-cpp+universal libsdl+universal libsdl_gfx+universal libsdl_image+universal libsdl_mixer+universal
```

1. Open the `OpenxXcom.xcodeproj` with Xcode.  Right click on the project (on the left pane) and click 'Add files to "OpenxXcom"'.  Select the 'src' directory from the root of the project.  Don't copy the files and do create folder groups.

1. Push the ‘Build’ button and cross your fingers. Congratulations, you have a working build! But it is still unplayable though.

1. Find your newly created bundle in ‘./Build/Products/Release’ folder or otherwise 'DerivedData' (find it within your Xcode preferences), and copy it to some place you feel comfortable keeping your games in.

If you want to use the portable bundle, then:

1. Copy the relevant original game data files you possess into the ‘UFO’ (for UFO: Enemy Unknown) and/or ‘TFTD’ (for XCOM: Terror from the Deep) folder within the bundle respectively. If asked by the system what to do with the files and folders already present there, select ‘Merge’.

Or, if you prefer to keep your build always separate from the game data files for various reasons:

1. Create the directory `/Users/Shared/OpenXcom/` and move your original xcom data files (UFO and TFTD directories) there.

Most of the errors I have seen are improper use of dependencies.  Though I know nothing of xcode or osx.  I know a few people have had to add YAML_CPP_DLL to the preprocessor definitions. Is there something like this in xcode?  Though honestly, not sure but I don't think your error looks like a YAML error.   

I literally just finished getting it working on Win10, in Visual Studio Community 2017(VS15)

Offline Grub

  • Squaddie
  • *
  • Posts: 6
    • View Profile
Re: Xcode build failure (OSX 10.12)
« Reply #2 on: April 14, 2017, 05:00:17 am »
I followed the instructions, though I didn't know about the YAML_CPP_DLL. I tried to install it using homebrew but it wasn't found. I will continue to look for an equivalent formula in Xcode. Thank you

Offline Meridian

  • Global Moderator
  • Commander
  • *****
  • Posts: 9115
    • View Profile
Re: Xcode build failure (OSX 10.12)
« Reply #3 on: April 14, 2017, 01:09:56 pm »
Hello, Im trying to build using Xcode. I have tried deleting and starting fresh on both the latest nightly download and homebrew unfortunately I keep running into the same error.

SetWindowedRootState.cpp:78:72: Cannot take the address of an rvalue of type 'std::__1::basic_ostringstream<wchar_t, std::__1::char_traits<wchar_t>, std::__1::allocator<wchar_t> >' 

I am new to coding and feel like I'm in over my head also, I don't know how to include my screenshot other than attaching it

Try rewriting that part of the code like this: https://github.com/MeridianOXC/OpenXcom/commit/010eb6925520852b17605a6bb6d04fd44549d4b4#diff-29da21bb9c326d365981fc39460c1d92

Don't know why it is written so complicated (you could even say ugly) in vanilla.

Offline Grub

  • Squaddie
  • *
  • Posts: 6
    • View Profile
Re: Xcode build failure (OSX 10.12)
« Reply #4 on: April 14, 2017, 05:46:25 pm »
Thank you! The Xcode built successfully.