build: mac, use native clang as default compiler#322
Merged
miketout merged 68 commits intomiketout:devfrom Nov 2, 2024
Merged
Conversation
Release v1.2.3
Release v1.2.3-1
Release v1.2.3-2
Release v1.2.3-3
Release v1.2.3-4
Release v1.2.3-5
Release v1.2.3-6
Release v1.2.3-7
Release v1.2.4
Release v1.2.4-1
Release v1.2.4-2
Release v1.2.5
Release v1.2.5-1
without that fix clang gives an error:
./mmr.h:143:35: error: overloaded operator >> has higher precedence than comparison operator [-Werror,-Woverloaded-shift-op-parentheses]
assert(work << 128 >> 128 == work && stake << 128 >> 128 == stake);
~~~~~~~~~~~~~~~~~~ ^ ~~~~
./pbaas/vdxf.h:817:24: error: no matching constructor for initialization of 'uint256'
salt = uint256(std::vector<unsigned char>(data.end() - sizeof(uint256)), data.end());
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
./uint256.h:119:5: note: candidate constructor not viable: requires single argument 'b', but 2 arguments were provided
uint256(const base_blob<256>& b) : base_blob<256>(b) {}
It was accidentally separated data.end() - sizeof(uint256) and data.end() into two arguments instead of passing them as a range.
The fix creates a std::vector<unsigned char> from the range [data.end() - sizeof(uint256), data.end()).
The single std::vector is then passed to the uint256 constructor that takes a const std::vector<unsigned char>&, matching the expected constructor.
TODO: reconsider all of these flags
Manual invocation of internal functions like __tls_init() is not recommended and is typically unnecessary.
avoid this error:
src/tcp_address.cpp:132:12: error: 'sprintf' is deprecated: This function is provided for compatibility reasons only. Due to security concerns inherent in the design of sprintf(3), it is highly recommended that you use snprintf(3) instead. [-Werror,-Wdeprecated-declarations]
pos += sprintf (pos, "%d", ntohs (port_));
^
when building on with Apple clang version 14.0.3 (clang-1403.0.22.14.1)
older versions of rust will give error like this on modern osx and xcode: b6f6b59b6a29ec3a.rlib(rust.metadata.bin), archive member 'rust.metadata.bin' with length 23385156 is not mach-o or llvm bitcode file '/Users/builder/verus-mac-build/depends/x86_64-apple-darwin22.5.0/native/lib/rustlib/x86_64-apple-darwin/lib/libcore-b6f6b59b6a29ec3a.rlib' clang: error: linker command failed with exit code 1 (use -v to see invocation)
Author
|
Build of last commit is tested on: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR attempts to switch the macOS build from the outdated
gcc@8to the nativeclang. However, building withclangrequires extensive changes in the source code to resolve various ambiguities and other issues. Additionally, some fixes reveal existing hidden errors in the code, such as in this commit, whereexportOutNumwas mistakenly declared as aboolinstead of anintinPreCheckAcceptedOrEarnedNotarization.Every commit needs to be carefully reviewed, and the entire build should pass all internal tests, including syncing from scratch, before this PR is accepted.
p.s. Also, please note that this version has been tested on
macOS Monterey 12.6.1withXcode 13.2.1andApple clang version 13.0.0 (clang-1300.0.29.30). Other macOS versions or newer Xcode releases are likely to fail to build the project. I plan to address these issues after all introduced changes in this PR are accepted. This PR is the first step toward making the macOS build cleaner, more correct, and more maintainable.