Skip to content

Add a check before using -fno-define-target-os-macros #125

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

Merged
merged 2 commits into from
May 15, 2024
Merged

Add a check before using -fno-define-target-os-macros #125

merged 2 commits into from
May 15, 2024

Conversation

sunshaoce
Copy link
Contributor

I found an error when testing on a board that supports RISC-V Vector 1.0:

cc: error: unrecogized command-line option '-fno-define-target-os-macros'

I think the problem is probably caused by the lower version of cc?

gcc version 13.2.0

But I think we can refer to this commit to solve it.
9b14a92

Add a condition that is only enabled on APPLE architecture for -fno-define-target-os-macros.

# (https://github.com/madler/zlib/pull/895)
# Disable the compiler extension to workaround the build failure until a zlib
# source update with the fix.
target_compile_options(clamscan PRIVATE -fno-define-target-os-macros)
Copy link
Contributor

Choose a reason for hiding this comment

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

It would be better to use CheckCXXCompilerFlag, since there are versions of clang out there that don't support this flag.

https://cmake.org/cmake/help/latest/module/CheckCXXCompilerFlag.html

Copy link
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 your suggestion! This is indeed a better solution.

@sunshaoce sunshaoce changed the title Only enable -fno-define-target-os-macros for APPLE architecture Add a check before using -fno-define-target-os-macros May 15, 2024
@sunshaoce sunshaoce merged commit ad9cc9d into llvm:main May 15, 2024
@fhahn
Copy link
Contributor

fhahn commented May 15, 2024

Many thanks @sunshaoce

@sunshaoce sunshaoce deleted the fix branch May 16, 2024 09:11
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