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

error if using Enzyme with gcc/g++ #1883

Merged
merged 4 commits into from
May 15, 2024
Merged

error if using Enzyme with gcc/g++ #1883

merged 4 commits into from
May 15, 2024

Conversation

ZuseZ4
Copy link
Member

@ZuseZ4 ZuseZ4 commented May 15, 2024

It would be nicer to check if we actually have a LLVM based compiler, but I am worried of some vendor specific compilers having awkward names. So only check for GNU, since that's 100% unsupported. This should still cover almost all cases and prevents issues like this:
closes #1871

Tested locally:

➜  build git:(recognize-unsupported-gnu) CC=/usr/bin/gcc cmake .. -GNinja  -DEnzyme_DIR=/u/drehwald/prog/Enzyme/enzyme/build/ -DCMAKE_LINKER=lld
project languages: C
C compiler: GNU
CMake Error at /u/drehwald/prog/Enzyme/enzyme/build/EnzymeConfigVersion.cmake:8 (message):
  Enzyme requires an LLVM based C compiler.
Call Stack (most recent call first):
  CMakeLists.txt:5 (find_package)


-- Configuring incomplete, errors occurred!
➜  build git:(recognize-unsupported-gnu) ..
➜  test_find_package git:(recognize-unsupported-gnu) rm -rf build && mkdir build && cd build                                                                
➜  build git:(recognize-unsupported-gnu) CC=clang cmake .. -GNinja  -DEnzyme_DIR=/u/drehwald/prog/Enzyme/enzyme/build/ -DCMAKE_LINKER=lld
-- The C compiler identification is Clang 16.0.5
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /u/drehwald/prog/llvm16/build/bin/clang - skipped
-- Detecting C compile features
-- Detecting C compile features - done
found dir /u/drehwald/prog/Enzyme/enzyme/build/
found 1
imported targets LLVMEnzyme-16;ClangEnzyme-16;ClangEnzymeFlags;LLDEnzyme-16;LLDEnzymeFlags;LLDEnzymeAssumeUnknownNoFree;LLDEnzymeLooseTypeFlags;LLDEnzymePrintTypeFlags;LLDEnzymePrintFlags;LLDEnzymeNoStrictAliasingFlags
-- Configuring done (0.5s)
-- Generating done (0.0s)
-- Build files have been written to: /u/drehwald/prog/Enzyme/enzyme/test/test_find_package/build

@ZuseZ4 ZuseZ4 requested a review from wsmoses May 15, 2024 00:12
@ZuseZ4 ZuseZ4 enabled auto-merge May 15, 2024 00:22
@wsmoses
Copy link
Member

wsmoses commented May 15, 2024

This should be made into a warning as there are legitimate use cases of non clang compilers, for example if part of the code is not differentiated or has custom derivatives defined, or using an existing Bitcode library

@ZuseZ4
Copy link
Member Author

ZuseZ4 commented May 15, 2024

This should be made into a warning as there are legitimate use cases of non clang compilers.

Sure, done.

Copy link
Member

@wsmoses wsmoses left a comment

Choose a reason for hiding this comment

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

Can you also print the cmake_c_compiler and the thing you're checking in the warning as well?

@ZuseZ4
Copy link
Member Author

ZuseZ4 commented May 15, 2024

Can you also print the cmake_c_compiler and the thing you're checking in the warning as well?

project languages: C
CMake Warning at /u/drehwald/prog/Enzyme/enzyme/build/EnzymeConfigVersion.cmake:8 (message):
  C compiler ID equals GNU

  C compiler: /usr/bin/gcc

  Using Enzyme without an LLVM based C compiler.
Call Stack (most recent call first):
  CMakeLists.txt:5 (find_package)

@wsmoses
Copy link
Member

wsmoses commented May 15, 2024

Excellent, I think that extra info will help folks.

@ZuseZ4 ZuseZ4 added this pull request to the merge queue May 15, 2024
Merged via the queue into main with commit f5e66b2 May 15, 2024
33 of 46 checks passed
@ZuseZ4 ZuseZ4 deleted the recognize-unsupported-gnu branch May 15, 2024 04:22
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.

Building Enzyme CMake - Undefined symbol: main
2 participants