Skip to content

Tweaks for building with macOS 26#11605

Open
mitchute wants to merge 4 commits into
developfrom
xcode-generated-builds
Open

Tweaks for building with macOS 26#11605
mitchute wants to merge 4 commits into
developfrom
xcode-generated-builds

Conversation

@mitchute
Copy link
Copy Markdown
Collaborator

@mitchute mitchute commented May 27, 2026

Pull request overview

  • A collection of tweaks needed to get EnergyPlus building on macOS 26 for Xcode- and Unix-generated makefiles.

Description of the purpose of this PR

Pull Request Author

  • Title of PR should be user-synopsis style (clearly understandable in a standalone changelog context)
  • Label the PR with at least one of: Defect, Refactoring, NewFeature, Performance, and/or DoNoPublish
  • Pull requests that impact EnergyPlus code must also include unit tests to cover enhancement or defect repair
  • Author should provide a "walkthrough" of relevant code changes using a GitHub code review comment process
  • If any diffs are expected, author must demonstrate they are justified using plots and descriptions
  • If changes fix a defect, the fix should be demonstrated in plots and descriptions
  • If any defect files are updated to a more recent version, upload new versions here or on DevSupport
  • If IDD requires transition, transition source, rules, ExpandObjects, and IDFs must be updated, and add IDDChange label
  • If structural output changes, add to output rules file and add OutputChange label
  • If adding/removing any LaTeX docs or figures, update that document's CMakeLists file dependencies
  • If adding/removing any output files (e.g., eplustbl.*)
    • Update ..\scripts\Epl-run.bat
    • Update ..\scripts\RunEPlus.bat
    • Update ..\src\EPLaunch\ MainModule.bas, epl-ui.frm, and epl.vbp (VersionComments)
    • Update ...github\workflows\energyplus.py

Reviewer

  • Perform a Code Review on GitHub
  • If branch is behind develop, merge develop and build locally to check for side effects of the merge
  • If defect, verify by running develop branch and reproducing defect, then running PR and reproducing fix
  • If feature, test running new feature, try creative ways to break it
  • CI status: all green or justified
  • Check that performance is not impacted (CI Linux results include performance check)
  • Run Unit Test(s) locally
  • Check any new function arguments for performance impacts
  • Verify IDF naming conventions and styles, memos and notes and defaults
  • If new idf included, locally check the err file and other outputs

@mitchute mitchute requested a review from RKStrand May 27, 2026 00:25
@mitchute mitchute added the DoNotPublish Includes changes that shouldn't be reported in the changelog label May 27, 2026
@mitchute mitchute changed the title Suppress Implicit 64-to-32 bit Conversion Errors for Xcode Generated Builds Compiler Tweaks for macOS 26 May 27, 2026
@mitchute mitchute changed the title Compiler Tweaks for macOS 26 Tweaks for building with macOS 26 May 27, 2026
Copy link
Copy Markdown
Contributor

@jmarrec jmarrec left a comment

Choose a reason for hiding this comment

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

I don't really get why we have XCode specific stuff but maybe it's really needed?

I pushed a branch with only 2 changes that allows me to build on Apple Clang 21 (macOS 26.5 fully up to date)

https://github.com/NatLabRockies/EnergyPlus/compare/build_apple-clang-21?expand=1

Comment thread cmake/CompilerFlags.cmake
Comment on lines +131 to +133
if(CMAKE_GENERATOR STREQUAL "Xcode")
target_compile_options(project_warnings INTERFACE -Wno-shorten-64-to-32)
endif()
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I have tweaks locally to build on apple-clang 21, and I haven't needed to add this?

Also, is this really Xcode generator specific?

(I would have expected CMAKE_CXX_COMPILER_ID MATCHES "Clang")

Comment thread idd/CMakeLists.txt

add_executable(generate_embeddable_epJSON_schema embedded/generate_embeddable_epJSON_schema.cpp)
target_link_libraries(generate_embeddable_epJSON_schema PRIVATE project_options project_fp_options project_warnings fmt::fmt)
target_link_libraries(generate_embeddable_epJSON_schema PRIVATE project_options project_fp_options project_warnings fmt::fmt nlohmann_json)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Haven't needed that either

Comment thread third_party/CLI/CLI11.hpp
Comment on lines +161 to +164
#ifndef CLI11_HAS_CODECVT
#if defined(__APPLE__) && defined(__clang__)
#define CLI11_HAS_CODECVT 0
#elif defined(__GNUC__) && !defined(__llvm__) && !defined(__INTEL_COMPILER) && __GNUC__ < 5
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I see what you're doing. This is better than my own

    target_compile_options(project_warnings INTERFACE -Wno-deprecated-declarations) # wstring_convert deprecated in newer libc++

I wonder if it's better to have it inline in CLI11.hpp or if it should be in CMake via target_compile_definitions(xxx PRIVATE CLI11_HAS_CODECVT=0) (for targets energyplus and convertInputFormat). I guess inline is fine.

@mitchute
Copy link
Copy Markdown
Collaborator Author

mitchute commented Jun 1, 2026

@RKStrand
Copy link
Copy Markdown
Contributor

RKStrand commented Jun 1, 2026

@mitchute @jmarrec Ok, I just tried this. Pulled it down, ran configure and generate on CMake, cleaned the build folder in Xcode, and then tried to build. It was not successful. Here are the error messages:

image

@mitchute
Copy link
Copy Markdown
Collaborator Author

mitchute commented Jun 1, 2026

OK. I also see this with Xcode and Apple Clang 17. Can you try a Unix makefile build with CLion?

@RKStrand
Copy link
Copy Markdown
Contributor

RKStrand commented Jun 1, 2026

I was just able to successfully build using CLion--both energyplus and energyplus_tests. Was able to successfully run 1ZoneUncontrolled.idf using this energyplus build and the test suite completed 1260 test successfully. Not sure why it didn't do every unit test but at least it successfully completed what it did.

I'd love to get Xcode running again, but at least having CLion up and running is super helpful.

@RKStrand
Copy link
Copy Markdown
Contributor

RKStrand commented Jun 1, 2026

For the record, in case it helps, I'm running a Nov 2023 MacBook Pro 16-inch, with the Apple M3 Max chip, 128 GB of memory, macOS Tahoe26.5, and Xcode Version 26.5 (17F42).

@mitchute
Copy link
Copy Markdown
Collaborator Author

mitchute commented Jun 1, 2026

Was able to successfully run 1ZoneUncontrolled.idf using this energyplus build and the test suite completed 1260 test successfully. Not sure why it didn't do every unit test but at least it successfully completed what it did.

@RKStrand can you post anything regarding what caused the failure in completing all the tests?

@RKStrand
Copy link
Copy Markdown
Contributor

RKStrand commented Jun 1, 2026

I just tried this in debug and here is a place that it seems to have a problem:

image

@mitchute
Copy link
Copy Markdown
Collaborator Author

mitchute commented Jun 1, 2026

Thanks @RKStrand. I saw that as well.

@mitchute
Copy link
Copy Markdown
Collaborator Author

mitchute commented Jun 2, 2026

@RKStrand
Copy link
Copy Markdown
Contributor

RKStrand commented Jun 2, 2026

@mitchute Ok, here is what I got on my machine:

Big Picture for "msm" branch: Xcode builds and runs successfully, CLion encounters an error building energyplus_tests (details below)

Xcode:
energyplus--builds successfully (two warnings in epexpat related to xmltok_ but that didn't prevent the build) and ran 1ZoneUncontrolled.idf without issue
energyplus_tests--builds successfully (same warnings) and runs all tests (2229) successfully without any issues

CLion:
energyplus--buildings successfully and ran 1ZoneUncontrolled.idf without issue
energyplus_tests--build error as shown here...

.../third_party/gtest/googletest/include/gtest/gtest-printers.h:478:35: error: implicit conversion from 'char8_t' to 'char32_t' may change the meaning of the represented code unit [-Werror,-Wcharacter-conversion]
478 | PrintTo(ImplicitCast_<char32_t>(c), os);

It points to the (c) in that line as the issue.

@mitchute
Copy link
Copy Markdown
Collaborator Author

mitchute commented Jun 2, 2026

Right... I missed that change here. I'll push a patch soon.

@mitchute
Copy link
Copy Markdown
Collaborator Author

mitchute commented Jun 2, 2026

@RKStrand give it another shot now.

@RKStrand
Copy link
Copy Markdown
Contributor

RKStrand commented Jun 2, 2026

@mitchute Ok, after that, now I can say: Xcode--same as before (everything good).

CLion--energyplus still builds and runs. energyplus_tests builds now. What is a bit weird is that when I run it, it only does 1260 tests and then at some point, I get the following pop-up window (see left of image below).

image

If I click on ignore, it just stops right there. If I click on "Reopen", it launches a terminal window and tries to run energyplus_tests from the terminal. But that doesn't finish either because as you can see from the right side of the image, it seems to crash in a Solar Shading test.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

DoNotPublish Includes changes that shouldn't be reported in the changelog

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants