Skip to content

Fix to prevent is_win flag setting with clang on macOS#867

Merged
devinamatthews merged 2 commits intoflame:masterfrom
yoshoku:fix_configure_darwin
May 1, 2025
Merged

Fix to prevent is_win flag setting with clang on macOS#867
devinamatthews merged 2 commits intoflame:masterfrom
yoshoku:fix_configure_darwin

Conversation

@yoshoku
Copy link
Copy Markdown
Contributor

@yoshoku yoshoku commented Apr 29, 2025

This pull request fixes an issue where libblis.dylib is not created when built with clang on macOS. My execution environment and the observed problem are as follows:

$ gcc --version
Apple clang version 17.0.0 (clang-1700.0.13.3)
Target: arm64-apple-darwin24.4.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
$ ~/blis
$ ./configure auto
$ cat config.mk | grep IS_WIN
IS_WIN            := yes
$ make
$ ls -1 lib/firestorm/
libblis.4.dylib
libblis.a

The cause of the problem is that the is_win flag is incorrectly set to yes in the configure script, leading to an incorrect filename being used. On macOS with clang, whether the environment is Windows or not is indicated by the value of the TARGET_OS_WIN32 macro:

$ gcc -dM -E - < /dev/null 2> /dev/null | grep "WIN32"
#define TARGET_OS_WIN32 0

The configure script determines the is_win flag by checking for the presence of the string "WIN32". This caused a false positive in the case of clang on macOS. This pull request modifies it so that the determination is made based on the value of TARGET_OS_WIN32.

Comment thread configure
"C compiler" "yes" found_cc

# Also check the compiler to see if we are (cross-)compiling for Windows
if "${found_cc}" -dM -E - < /dev/null 2> /dev/null | grep -q _WIN32; then
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 would suggest using grep -q "#define _WIN32" instead of checking os_name

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the suggestion. I have updated it following your idea: 618afd3

@devinamatthews devinamatthews merged commit ec5b572 into flame:master May 1, 2025
1 check passed
@devinamatthews
Copy link
Copy Markdown
Member

Thanks @yoshoku for the patch and @isuruf for the review.

@yoshoku yoshoku deleted the fix_configure_darwin branch May 1, 2025 15:24
devinamatthews pushed a commit that referenced this pull request Jun 7, 2025
Details:
- In some cases, macOS was improperly detected as Windows due to a builtin preprocessor definition `#define TARGET_OS_WINDOWS 0`.
- Update the detection to specifically look for `#define _WIN32` which more robustly detects Windows.

(cherry picked from commit ec5b572)
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.

3 participants