Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

error when building on macOS #598

Closed
1 of 4 tasks
w-woloszyn opened this issue Oct 7, 2023 · 3 comments
Closed
1 of 4 tasks

error when building on macOS #598

w-woloszyn opened this issue Oct 7, 2023 · 3 comments
Labels
Priority: High Represent a high impact in key areas of the base/user experience Stale Status: Pending Test This PR or Issue requires more testing Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.

Comments

@w-woloszyn
Copy link

Priority

High

Area

  • Data
  • Source
  • Docker
  • Other

What happened?

Hi everyone,

I would like to share with you the problem I encountered when building the otclient on macOS. (It is not clear to me if macOS is officially supported, but if not I think that ultimately it would make a nice PR request.)

The error occurs when building src/CMakeFiles/otclient.dir/Unity/unity_7_cxx.cxx.o, and here's what I've got:

In file included from /Users/wwoloszyn/Repositories/otclient/build/macos-release/src/CMakeFiles/otclient.dir/cmake_pch.hxx:5:
In file included from /Users/wwoloszyn/Repositories/otclient/src/framework/pch.h:35:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/algorithm:1712:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/memory:846:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/__memory/allocate_at_least.h:13:
/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/__memory/allocator_traits.h:298:9: error: no matching function for call to 'construct_at'
        _VSTD::construct_at(__p, _VSTD::forward<_Args>(__args)...);
        ^~~~~~~~~~~~~~~~~~~
/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/__config:695:17: note: expanded from macro '_VSTD'
#  define _VSTD std
                ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:292:37: note: in instantiation of function template specialization 'std::allocator_traits<std::allocator<FileInfo>>::construct<FileInfo, const std::string &, long long &, void, void>' requested here
        allocator_traits<_TpAlloc>::construct(__tmp, __get_elem(), _VSTD::forward<_Args>(__args)...);
                                    ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:953:55: note: in instantiation of function template specialization 'std::__shared_ptr_emplace<FileInfo, std::allocator<FileInfo>>::__shared_ptr_emplace<const std::string &, long long &>' requested here
    ::new ((void*)_VSTD::addressof(*__guard.__get())) _ControlBlock(__a, _VSTD::forward<_Args>(__args)...);
                                                      ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/__memory/shared_ptr.h:962:19: note: in instantiation of function template specialization 'std::allocate_shared<FileInfo, std::allocator<FileInfo>, const std::string &, long long &, void>' requested here
    return _VSTD::allocate_shared<_Tp>(allocator<_Tp>(), _VSTD::forward<_Args>(__args)...);
                  ^
/Users/wwoloszyn/Repositories/otclient/src/framework/core/modulemanager.cpp:174:46: note: in instantiation of function template specialization 'std::make_shared<FileInfo, const std::string &, long long &, void>' requested here
                data.files.emplace_back(std::make_shared<FileInfo>(path, time));
                                             ^
/Library/Developer/CommandLineTools/SDKs/MacOSX13.3.sdk/usr/include/c++/v1/__memory/construct_at.h:33:38: note: candidate template ignored: substitution failure [with _Tp = FileInfo, _Args = <const std::string &, long long &>]: no matching constructor for initialization of 'FileInfo'
_LIBCPP_HIDE_FROM_ABI constexpr _Tp* construct_at(_Tp* __location, _Args&&... __args) {
                                     ^
3 warnings and 1 error generated.

Please note that I have used the following patch on the code:

index 5a5868d9..a9b12c4a 100644
--- a/CMakePresets.json
+++ b/CMakePresets.json
@@ -57,6 +57,26 @@
         "rhs": "Linux"
       }
     },
+    {
+      "name": "macos-release",
+      "displayName": "MacOS - Release",
+      "description": "Sets Unix Makefiles generator, compilers, build and install directory and set build type as release",
+      "generator": "Unix Makefiles",
+      "binaryDir": "${sourceDir}/build/${presetName}",
+      "cacheVariables": {
+        "CMAKE_TOOLCHAIN_FILE": {
+          "value": "$env{VCPKG_ROOT}/scripts/buildsystems/vcpkg.cmake",
+          "type": "FILEPATH"
+        },
+        "CMAKE_BUILD_TYPE": "RelWithDebInfo",
+        "OPTIONS_ENABLE_CCACHE": "ON"
+      },
+      "condition": {
+        "type": "equals",
+        "lhs": "${hostSystemName}",
+        "rhs": "Darwin"
+      }
+    },
     {
       "name": "windows-release-asan",
       "inherits": "windows-release",
@@ -106,6 +126,10 @@
       "name": "linux-release",
       "configurePreset": "linux-release"
     },
+    {
+      "name": "macos-release",
+      "configurePreset": "macos-release"
+    },
     {
       "name": "linux-debug",
       "configurePreset": "linux-debug"```

### What OS are you seeing the problem on?

MacOS

### Code of Conduct

- [X] I agree to follow this project's Code of Conduct
@w-woloszyn w-woloszyn added the Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors. label Oct 7, 2023
@github-actions github-actions bot added Priority: High Represent a high impact in key areas of the base/user experience Status: Pending Test This PR or Issue requires more testing labels Oct 7, 2023
@w-woloszyn
Copy link
Author

Static analysis suggests it might be about int64_t vs long long on Mac. I will try to write a fix in a finite amount of time.

Copy link

This issue is stale because it has been open 120 days with no activity.

@github-actions github-actions bot added the Stale label Jan 24, 2024
@mehah
Copy link
Owner

mehah commented Mar 22, 2024

I'm cleaning the issue list, if anyone wants to open a new one with the same subject, feel free.

@mehah mehah closed this as completed Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: High Represent a high impact in key areas of the base/user experience Stale Status: Pending Test This PR or Issue requires more testing Type: Bug Inconsistencies or issues which will cause an issue or problem for users or implementors.
Projects
None yet
Development

No branches or pull requests

2 participants