Skip to content

Conversation

ShortDevelopment
Copy link
Contributor

@ShortDevelopment ShortDevelopment commented Oct 4, 2025

Issues

  • Modern MacOS only supports CMake >= 3.10.
  • Modern libICU requires c++17
  • clang reports an invalid CFI advance_loc expression

Changes

  • Upgrade to CMake 3.10
  • Set EMBED_ICU to pin libicu for now
  • Ensure labels for local jumps are "private" using our own LOCAL_LABEL definition
    https://gitlab.winehq.org/wine/wine/-/merge_requests/4547
    #if defined(__APPLE__)
    #define C_FUNC(name) _##name
    #define EXTERNAL_C_FUNC(name) C_FUNC(name)
    #define LOCAL_LABEL(name) L##name
    #else
    #define C_FUNC(name) name
    #define EXTERNAL_C_FUNC(name) C_FUNC(name)@plt
    #define LOCAL_LABEL(name) .L##name
    #endif

Fixes #7031

@ShortDevelopment ShortDevelopment force-pushed the bugfix/cmake-version/7031 branch 2 times, most recently from 76ef2bc to 12fddc3 Compare October 4, 2025 13:46
@ShortDevelopment ShortDevelopment force-pushed the bugfix/cmake-version/7031 branch from 12fddc3 to cb550bb Compare October 4, 2025 15:59
@ShortDevelopment ShortDevelopment marked this pull request as ready for review October 4, 2025 16:00
@ShortDevelopment ShortDevelopment marked this pull request as draft October 4, 2025 16:15
@rhuanjl
Copy link
Collaborator

rhuanjl commented Oct 4, 2025

Looking at the Linux CI log, it looks like ch or chakracore is crashing when being asked to regen the bytecode on Linux.

The python regen script writes a prologue to the file then calls ch with certain parameters to produce the bytecode - the line where the "error" is being found is the line where the prologue ends and the generated material starts. Nothing is being generated hence the mismatch.

This is the first test that runs so it could be that it's not a problem specific to bytecode regen but that either the ch or chakracore build is broken and doesn't run at all.

Are you able to test offline? I have no Linux setup at the moment, so cannot easily test (would need to make a vm)

Ideally would try running offline with a debugger attached and find where ch or chakracore is crashing (or at least why it's closing with no output)

@ShortDevelopment
Copy link
Contributor Author

Interestingly I would expect the regenByteCode.py tool to output some error:

if job.returncode != 0:
print(error)
print('Command line: ')
print(*command_with_file)
sys.exit(1)

@ShortDevelopment
Copy link
Contributor Author

So it turns out that the ByteCode gen fails because ./ch cannot read the input file.

The filename is set by

hr = GetFileNameFlag(&fileNameWide);

called by

HRESULT ChakraRTInterface::ParseConfigFlags()

called by

ChakraCore/bin/ch/ch.cpp

Lines 45 to 49 in 22f1619

extern "C"
HRESULT __stdcall OnChakraCoreLoadedEntry(TestHooks& testHooks)
{
return ChakraRTInterface::OnChakraCoreLoaded(testHooks);
}

called by

HRESULT OnChakraCoreLoaded(OnChakraCoreLoadedPtr pfChakraCoreLoaded)
{
if (pfChakraCoreLoaded == nullptr)
{
pfChakraCoreLoaded = (OnChakraCoreLoadedPtr)GetProcAddress(GetModuleHandle(NULL), "OnChakraCoreLoadedEntry");
if (pfChakraCoreLoaded == nullptr)
{
return S_OK;
}
}

but ./ch does not export OnChakraCoreLoadedEntry any more (that's broken by this PR)

@rhuanjl
Copy link
Collaborator

rhuanjl commented Oct 4, 2025

Interestingly I would expect the regenByteCode.py tool to output some error:

if job.returncode != 0:
print(error)
print('Command line: ')
print(*command_with_file)
sys.exit(1)

That error display has been unreliable in the past - ideally should fix it...

@rhuanjl
Copy link
Collaborator

rhuanjl commented Oct 4, 2025

So it turns out that the ByteCode gen fails because ./ch cannot read the input file.

The filename is set by

hr = GetFileNameFlag(&fileNameWide);

called by

HRESULT ChakraRTInterface::ParseConfigFlags()

called by

ChakraCore/bin/ch/ch.cpp

Lines 45 to 49 in 22f1619

extern "C"
HRESULT __stdcall OnChakraCoreLoadedEntry(TestHooks& testHooks)
{
return ChakraRTInterface::OnChakraCoreLoaded(testHooks);
}

called by

HRESULT OnChakraCoreLoaded(OnChakraCoreLoadedPtr pfChakraCoreLoaded)
{
if (pfChakraCoreLoaded == nullptr)
{
pfChakraCoreLoaded = (OnChakraCoreLoadedPtr)GetProcAddress(GetModuleHandle(NULL), "OnChakraCoreLoadedEntry");
if (pfChakraCoreLoaded == nullptr)
{
return S_OK;
}
}

but ./ch does not export OnChakraCoreLoadedEntry any more (that's broken by this PR)

Seems like very strange breakage for simply changing the cmake version - does the export somehow depend on a deprecated cmake feature? I can't remember if that logic is something I've ever looked at.

@ShortDevelopment ShortDevelopment force-pushed the bugfix/cmake-version/7031 branch from c55d3a7 to b5a7b0a Compare October 4, 2025 19:04
@ShortDevelopment
Copy link
Contributor Author

CMake 3.4 introduced CMAKE_ENABLE_EXPORTS to enable exports from executables.

@ShortDevelopment ShortDevelopment marked this pull request as ready for review October 4, 2025 19:43
Set `EMBED_ICU` flag
@ShortDevelopment ShortDevelopment marked this pull request as draft October 5, 2025 13:07
@ShortDevelopment ShortDevelopment changed the title chore: use CMake 3.10 fix: MacOS build Oct 5, 2025
@ShortDevelopment ShortDevelopment marked this pull request as ready for review October 5, 2025 20:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Build]: MacOS ci does not support CMake < 3.5
2 participants