Can't build on macOS Sierra 10.12.6

Hi,

I tried to build the source on my mac and got the following error: (I followed this wiki page)

vcmi/AI/FuzzyLite/fuzzylite/./fl/Operation.h:1044:24: error: passing an object that undergoes default argument promotion to 'va_start' has
       undefined behavior [-Werror,-Wvarargs]
          va_start(args, first);

My environment setup is:

OS: macOS Sierra 10.12.6
cmake 3.9.3

clang:

Apple LLVM version 9.0.0 (clang-900.0.37)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

Any help would be greatly appreciated!

Unfortunately there is issue with building FuzzyLite with most recent Clang and therefore with Xcode:

For now you can bypass it using older Xcode like 8.2.1 or adding -Wno-varargs compile option to AI/FuzzyLite/fuzzylite/CMakeLists.txt:

if(NOT MSVC)
#TODO: Remove -Werror before release.
#Add Unix compilation flags
    set(CMAKE_CXX_FLAGS "-pedantic -Wall -Wextra -Werror -Wno-varargs ${CMAKE_CXX_FLAGS}")

I hope we can somehow resolve it soon.

Thanks @SSX. I created a Troubleshooting section on the wiki and have your answer posted there for the time being. It could be updated once this issue is fixed.

I thought about suppressing the warning while running the cmake command with the suppressing flag passed in (which will affect the whole project build). Modifying just the AI/FuzzyLite/fuzzylite/CMakeLists.txt is definitely a better solution given it only affects that particular subdirectory.

I have successfully built the source, but when I was trying to run the executable, got the following errors:

dyld: Library not loaded: @rpath/SDL2.framework/Versions/A/SDL2
  Referenced from: /Library/Frameworks/SDL2_image.framework/Versions/A/SDL2_image
  Reason: image not found

How do you guys solve this? I referred to the solution on stack overflow, but wondering if there is a better solution.

I found out the issue was caused by the SDL2_image files I previously installed under directory /LIbrary/Frameworks/SDL2_image.framework/Versions/A/SDL2_image. I removed this package (because I have no other pass depends on it).

After that, if I do otool -L vcmiclient, then the path to SDL2_image will be the correct one installed by homebrew:

/usr/local/opt/sdl2_image/lib/libSDL2_image-2.0.0.dylib

I didn’t have to solve this at all. I suppose it’s related to the fact how packages are installed on your system. Did you manually changed where homebrew install packages by default? Since I think it’s /usr/local/Cellar always.

And how did you get SDL2 inside /Library/Frameworks/?

PS: Just in case there is one more relevant bug: #2771
It’s can be bypassed by removing assert, but shouldn’t be the problem anyway if you use older Clang too.