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

*: Fix compile error under macos #9102

Merged
merged 1 commit into from
May 30, 2024
Merged

Conversation

JaySon-Huang
Copy link
Contributor

@JaySon-Huang JaySon-Huang commented May 30, 2024

What problem does this PR solve?

Issue Number: close #9101, ref #8835

Problem Summary:

Introduce by #9064

The signature of je_mallctl is

int mallctl(	const char *name,
 	void *oldp,
 	size_t *oldlenp,
 	void *newp,
 	size_t newlen);

But we pass a uint64_t * for oldlenp.

'uint64_t' is 'unsigned long long ' while 'size_t' is 'unsigned long' under MacOS, that cause the following compile error

/Users/pingcap/workspace/bp-tiflash-release-darwin-arm64-dnmfl-build-binaries/source/tiflash/dbms/src/Common/MemoryAllocTrace.cpp:32:5: error: no matching function for call to 'je_mallctl'
    je_mallctl("thread.deallocatedp", reinterpret_cast<void *>(&ptr2), &size2, nullptr, 0);
    ^~~~~~~~~~
/Users/pingcap/workspace/bp-tiflash-release-darwin-arm64-dnmfl-build-binaries/source/tiflash/release-darwin/build-release/contrib/jemalloc-cmake/include/jemalloc/jemalloc_rename.h:11:20: note: expanded from macro 'je_mallctl'
#define je_mallctl je_mallctl
                   ^~~~~~~~~~
/Users/pingcap/workspace/bp-tiflash-release-darwin-arm64-dnmfl-build-binaries/source/tiflash/contrib/jemalloc-cmake/include/jemalloc/jemalloc_protos.h:53:38: note: candidate function not viable: no known conversion from 'uint64_t *' (aka 'unsigned long long *') to 'size_t *' (aka 'unsigned long *') for 3rd argument
JEMALLOC_EXPORT int JEMALLOC_NOTHROW je_mallctl(const char * name,
                                     ^
/Users/pingcap/workspace/bp-tiflash-release-darwin-arm64-dnmfl-build-binaries/source/tiflash/release-darwin/build-release/contrib/jemalloc-cmake/include/jemalloc/jemalloc_rename.h:11:20: note: expanded from macro 'je_mallctl'
#define je_mallctl je_mallctl

What is changed and how it works?

Change the type from uint64_t to size_t for 3rd param of je_mallctl

Fix compile error under macos

Check List

Tests

  • Unit test
  • Integration test
  • Manual test (add detailed scripts or steps below)
  • No code

Side effects

  • Performance regression: Consumes more CPU
  • Performance regression: Consumes more Memory
  • Breaking backward compatibility

Documentation

  • Affects user behaviors
  • Contains syntax changes
  • Contains variable changes
  • Contains experimental features
  • Changes MySQL compatibility

Release note

None

Signed-off-by: JaySon-Huang <tshent@qq.com>
@ti-chi-bot ti-chi-bot bot added do-not-merge/needs-linked-issue release-note-none Denotes a PR that doesn't merit a release note. labels May 30, 2024
@ti-chi-bot ti-chi-bot bot added the size/XS Denotes a PR that changes 0-9 lines, ignoring generated files. label May 30, 2024
@JaySon-Huang
Copy link
Contributor Author

/hold
wait for the manual mac build result

@ti-chi-bot ti-chi-bot bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 30, 2024
@JaySon-Huang
Copy link
Contributor Author

/unhold
Build success on mac

@ti-chi-bot ti-chi-bot bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 30, 2024
Copy link
Member

@CalvinNeo CalvinNeo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@ti-chi-bot ti-chi-bot bot added approved needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels May 30, 2024
@ti-chi-bot ti-chi-bot bot added lgtm and removed needs-1-more-lgtm Indicates a PR needs 1 more LGTM. labels May 30, 2024
Copy link
Contributor

ti-chi-bot bot commented May 30, 2024

[LGTM Timeline notifier]

Timeline:

  • 2024-05-30 04:47:05.692583783 +0000 UTC m=+2924579.449719352: ☑️ agreed by CalvinNeo.
  • 2024-05-30 06:21:21.265701218 +0000 UTC m=+2930235.022836790: ☑️ agreed by JinheLin.

Copy link
Contributor

ti-chi-bot bot commented May 30, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: CalvinNeo, JinheLin, Lloyd-Pottiger

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [CalvinNeo,JinheLin,Lloyd-Pottiger]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@ti-chi-bot ti-chi-bot bot merged commit 9e1a79f into pingcap:master May 30, 2024
4 of 5 checks passed
@JaySon-Huang JaySon-Huang deleted the fix_macos branch May 30, 2024 06:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm release-note-none Denotes a PR that doesn't merit a release note. size/XS Denotes a PR that changes 0-9 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

tiflash failed to be built on mac
4 participants