Error Building Citra directly from Github

#1

Issue:
This is my first time trying to build Citra on Mac OSX

System Information

  • Operating System: Mac OSX 10.11.6
  • CPU: Intel Core i5
  • GPU: Intel Graphics??
  • Citra Version (found in title bar): Whatever is on Github
  • Game:
  • Screenshot of Issue (include the full Citra window including titlebar):

Log: This is where the error is thrown. I would appreciate if I can get any help

[ 84%] Building CXX object src/core/CMakeFiles/core.dir/file_sys/archive_backend.cpp.o
[ 84%] Building CXX object src/core/CMakeFiles/core.dir/file_sys/archive_extsavedata.cpp.o
[ 84%] Building CXX object src/core/CMakeFiles/core.dir/file_sys/archive_ncch.cpp.o
[ 84%] Building CXX object src/core/CMakeFiles/core.dir/file_sys/archive_other_savedata.cpp.o
/Users/3002109/citra/src/core/file_sys/archive_backend.cpp:24:21: error: cannot
initialize a parameter of type ‘void *’ with an rvalue of type
‘const value_type *’ (aka ‘const char *’)
std::memcpy(string.data(), data.data(), string.size());
^~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.12.sdk/usr/include/string.h:72:20: note:
passing argument to parameter ‘__dst’ here
void *memcpy(void *__dst, const void *__src, size_t __n);
^
/Users/3002109/citra/src/core/file_sys/archive_backend.cpp:30:21: error: cannot
initialize a parameter of type ‘void *’ with an rvalue of type
‘const value_type *’ (aka ‘const char16_t *’)
std::memcpy(u16str.data(), data.data(), u16str.size() * sizeof(c…
^~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX10.12.sdk/usr/include/string.h:72:20: note:
passing argument to parameter ‘__dst’ here
void *memcpy(void *__dst, const void *__src, size_t __n);
^
2 errors generated.
make[2]: *** [src/core/CMakeFiles/core.dir/file_sys/archive_backend.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs…
make[1]: *** [src/core/CMakeFiles/core.dir/all] Error 2
make: *** [all] Error 2

In order to save a copy of the log, follow this guide: How to Upload the Log File

#2

We only support macOS version 10.12 and later.

#3

Aside from the OS I should still be able to build Citra right?

#4

Yes, you will be able to build it.

#5

So…I am still having an error and I am not sure what the issue is.

#6

Your compiler needs to support C++17. Reposting this conversation from the Discord server:

[11:08 PM] <mazes_80> Hi, just noticed citra fails to compile with clang 5 or 6
[11:12 PM] <mazes_80> file: src/core/file_sys/archive_backend.cpp
[11:12 PM] <mazes_80> 24:        std::memcpy(string.data(), data.data(), string.size());
[11:12 PM] <mazes_80> 30:        std::memcpy(u16str.data(), data.data(), u16str.size() * sizeof(char16_t));
[11:13 PM] <mazes_80> just casting dest to (void *), allows compiling with clang 5 or 6
[11:20 PM] Lioncache: likely because .data is const qualified
[11:22 PM] Lioncache: if you change it to &string[0] (ditto for u16str's equivalent) in the destination, it should work as well (that or just pass -std=c++17)
[11:41 PM] <mazes_80> passing -std=c++17 didn't change anything, as the build cmake already provided -std=gnu++1z to makefiles
[11:47 PM] <mazes_80> &string[0] syntax works (as did casting), only those two line are blockers for compiling with clang
[12:43 AM] wwylele / 白疾風: mazes_80: you need to update your lbc++ library. The const qualifier is removed in c++17, but is a library change
[12:47 AM] Selby: @wwylele / 白疾風 for a moment there you had me - I thought that the const qualifier had been removed entirely, not just from std::string :sweat_smile:
[12:49 AM] wwylele / 白疾風: >.> oops
[1:02 AM] <mazes_80> that's nice, but rather than the burden of any single clang user asking advice on how to deal with this, a simple syntax changes would allow to compile without changing anything for a lot of people on distro missing latest gcc
[1:05 AM] Selby: mazes_80: we already made the decision to move to g++17
[1:05 AM] Selby: c++17*
[1:05 AM] Selby: why should we backpedal now?
[1:09 AM] <mazes_80> maybe, i do not fully understand the point, but rewrite string.data() -> &string[0] as suggested by lioncache, isn't allowed by c++17
[1:11 AM] wwylele / 白疾風: ...?
[1:20 AM] <mazes_80> -std::memcpy(string.data(), data.data(), string.size());
[1:20 AM] <mazes_80> +std::memcpy(&string[0], data.data(), string.size());
[1:21 AM] <mazes_80> allows to compile with clang 5, 6, isn't it c++17 compliant ?
[1:37 AM] Selby: http://en.cppreference.com/w/cpp/string/basic_string/operator_at does list it as returning a mutable reference, but again, why are we backpedaling now? Devs will be wanting to use more c++17 down the road
[1:38 AM] Adityarup Laha: definitely.
[1:41 AM] wwylele / 白疾風: mazes_80: ah I misinterpreted it probably because of a missing "?". The c++17 use of "data()" was unintentionally introduced by me and I once offered to removed. However we decided to not change it because we are going to use more c++17 stuff here and there, which requires user to update sooner or later anyway
[2:03 AM] <mazes_80> thanks everyone in any case```