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

Target MLIREmitCAllTests does not link with Debug configuration #3

Closed
OliverScherf opened this issue Oct 8, 2020 · 3 comments
Closed
Assignees

Comments

@OliverScherf
Copy link
Contributor

When Building and Linking the MLIREmitCAllTests target in Debug mode the following linker errors occur:

build] [8/8 100% :: 3.835] Linking CXX executable unittests/MLIREmitCAllTests
[build] FAILED: unittests/MLIREmitCAllTests 
[build] : && /bin/clang++-10  -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wimplicit-fallthrough  -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -g   unittests/CMakeFiles/MLIREmitCAllTests.dir/emitc_mhlo.cpp.o unittests/CMakeFiles/MLIREmitCAllTests.dir/emitc_std.cpp.o unittests/CMakeFiles/MLIREmitCAllTests.dir/emitc_tensor.cpp.o  -o unittests/MLIREmitCAllTests  /home/oliver/git/install-mlir/lib/libLLVMSupport.a  /home/oliver/git/install-mlir/lib/libLLVMSupport.a  -lpthread  lib/libgtest_maind.a  lib/libgtestd.a  -lpthread  -lrt  -ldl  -lm  /usr/lib/x86_64-linux-gnu/libz.so  /usr/lib/x86_64-linux-gnu/libtinfo.so  /home/oliver/git/install-mlir/lib/libLLVMDemangle.a  -lpthread && :
[build] /bin/ld: unittests/CMakeFiles/MLIREmitCAllTests.dir/emitc_tensor.cpp.o: in function `(anonymous namespace)::tensor_meta_is_tensor_0d_Test::TestBody()':
[build] /home/oliver/git/mlir-emitc/build/../unittests/emitc_tensor.cpp:358: undefined reference to `is_tensor_of_dim<0ul, Tensor<unsigned short>, void>::value'
[build] /bin/ld: unittests/CMakeFiles/MLIREmitCAllTests.dir/emitc_tensor.cpp.o: in function `(anonymous namespace)::tensor_meta_is_tensor_1d_Test::TestBody()':
[build] /home/oliver/git/mlir-emitc/build/../unittests/emitc_tensor.cpp:377: undefined reference to `is_tensor_of_dim<1ul, Tensor<signed char, 12ul>, void>::value'
[build] /bin/ld: unittests/CMakeFiles/MLIREmitCAllTests.dir/emitc_tensor.cpp.o: in function `(anonymous namespace)::tensor_meta_is_tensor_2d_Test::TestBody()':
[build] /home/oliver/git/mlir-emitc/build/../unittests/emitc_tensor.cpp:396: undefined reference to `is_tensor_of_dim<2ul, Tensor<double, 3ul, 7ul>, void>::value'
[build] /bin/ld: unittests/CMakeFiles/MLIREmitCAllTests.dir/emitc_tensor.cpp.o: in function `(anonymous namespace)::tensor_meta_is_tensor_3d_Test::TestBody()':
[build] /home/oliver/git/mlir-emitc/build/../unittests/emitc_tensor.cpp:415: undefined reference to `is_tensor_of_dim<3ul, Tensor<float, 1ul, 4ul, 6ul>, void>::value'
[build] /bin/ld: unittests/CMakeFiles/MLIREmitCAllTests.dir/emitc_tensor.cpp.o: in function `(anonymous namespace)::tensor_meta_is_tensor_4d_Test::TestBody()':
[build] /home/oliver/git/mlir-emitc/build/../unittests/emitc_tensor.cpp:434: undefined reference to `is_tensor_of_dim<4ul, Tensor<unsigned char, 2ul, 1ul, 1ul, 9ul>, void>::value'

MLIR emitC Commit: d5a5f63a4abb96ef754531bac9a84180a2c04648 (cgo Branch)
LLVM Commit: d4e889f1f5723105dbab12b749503d2462eb1755
LLVM Build Type Release

When I build MLIREmitCAllTests in Release mode, everything compiles and links correctly.

@marbre
Copy link
Contributor

marbre commented Oct 9, 2020

Yes, I can reproduce this. The breakage was introduced with commit 0455091. @simon-camp as you authored that commit, can you please take a look?

@simon-camp
Copy link
Member

I fixed this in 7efa4da by instantiating the templates outside of the test macros. I don't know why it worked in release but not in debug builds though.

@marbre
Copy link
Contributor

marbre commented Oct 12, 2020

Thanks for the fix Simon!

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

No branches or pull requests

3 participants