Comments (3)
Hm that looks like the linker didn't find your main function for some reason. Mind sharing the whole code which fails?
from enzyme.
We were originally building the test files outside of the Enzyme library. However we're currently trying inside the Enzyme/enzyme/test/test_find_package folder. Trying to build the enzyme_test_2 executable (we removed the enzyme_test_1 executable due to errors with Clang). We just want to test (and compile) the main.c source file to see if __enzyme_autodiff works.
In that folder, we tried building the executable with
cmake -DEnzyme_DIR=/u/jpmedina/Enzyme/enzyme/build .
This was successful
But then when we type make
we get the same error again
[ 50%] Building C object CMakeFiles/enzyme_test_2.dir/main.c.o
[100%] Linking C executable enzyme_test_2
ld.lld: error: undefined symbol: main
>>> referenced by /usr/lib/gcc/x86_64-linux-gnu/9/../../../x86_64-linux-gnu/Scrt1.o:(_start)
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/enzyme_test_2.dir/build.make:97: enzyme_test_2] Error 1
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/enzyme_test_2.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
For reference:
The code in /Enzyme/enzyme/test/test_find_package/CMakeLists.txt
cmake_minimum_required(VERSION 3.16)
project(enzyme_consumer LANGUAGES C)
find_package(Enzyme REQUIRED CONFIG NO_DEFAULT_PATH)
message("found dir ${Enzyme_DIR}")
message("found ${Enzyme_FOUND}")
get_property(importTargetsAfter DIRECTORY "${CMAKE_SOURCE_DIR}" PROPERTY IMPORTED_TARGETS)
message("imported targets ${importTargetsAfter}")
#add_subdirectory(${Enzyme_DIR} ${PROJECT_SOURCE_DIR}/build/enzyme)
#add_executable(enzyme_test_1 main.c)
#target_link_libraries(enzyme_test_1 PUBLIC ClangEnzymeFlags)
add_executable(enzyme_test_2 main.c)
target_compile_definitions(enzyme_test_2 PUBLIC -DNOVERSION)
target_link_libraries(enzyme_test_2 PUBLIC LLDEnzymeFlags)
The code for /Enzyme/enzyme/test/test_find_package/main.c
int printf(const char*, ...);
extern double __enzyme_autodiff(void*, double);
double square(double x) {
return x * x;
}
double dsquare(double x) {
return __enzyme_autodiff((void*) square, x);
}
int main() {
for(double i=1; i<5; i++) {
printf("%f %f\n", square(i), dsquare(i));
}
#ifndef NOVERSION
printf("Enzyme version %d %d %d\n", ENZYME_VERSION_MAJOR, ENZYME_VERSION_MINOR, ENZYME_VERSION_PATCH);
#endif
}
from enzyme.
We realized that we were unintentionally using gcc instead of clang.
Would it be possible to recognize this and throw and error to the user?
from enzyme.
Related Issues (20)
- Enzyme: Cannot cast __enzyme_autodiff primal argument 16 HOT 7
- enzyme_dupped parameter doesn't return gradient
- New C++ interface with lambda HOT 2
- Can't compile eigensumsqdyn-notmp.cpp with Eigen 3.4.0
- Injected headers for c++ break tooling
- Incorrect derivative result when nested void functions and recursive nature functions are used. HOT 6
- abort cmake when -DLLVM_DIR is an invalid path.
- check-enzyme-integration tests failures HOT 3
- Branch mismatcharg fails to compile HOT 6
- Unnecessary caching for recursive functions
- Bug in Enzyme gsl branch HOT 3
- compilation slowdown associated with PreserveNVVMNewPM HOT 1
- Is this N/3 correct? HOT 10
- incorrect derivative of function that returns struct HOT 2
- C++ interface templates appear to be broken HOT 7
- `std::vector.push_back()` causes segementation fault in Enzyme HOT 2
- EnzymeCreateForwardDiff missing from CApi.h HOT 1
- Clarify usage through linking HOT 8
- Failing unittest Enzyme/ReverseMode/gsl_sf_legendre_array_e.ll
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from enzyme.