linking error when running libTooling tutorial

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

linking error when running libTooling tutorial

David Blaikie via cfe-dev

I followed the libTooling tutorial at here: http://clang.llvm.org/docs/LibASTMatchersTutorial.html to write the loop-convert program. When I built it, I got the following error (I used the unofficial monorepo to build clang):


$ ninja loop-convert
[1/1] Linking CXX executable bin/loop-convert
FAILED: : && /usr/bin/clang++-6.0   -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -fno-common -Woverloaded-virtual -Wno-nested-anon-types -g  -fuse-ld=lld-6.0 -Wl,--color-diagnostics -Wl,-allow-shlib-undefined tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o  -o bin/loop-convert  lib/libLLVMSupport.so.8svn -lpthread lib/libclangTooling.so.8svn lib/libclangBasic.so.8svn lib/libclangASTMatchers.so.8svn -Wl,-rpath,"\$ORIGIN/../lib" && :
/usr/bin/ld.lld-6.0: error: undefined symbol: clang::PCHContainerOperations::PCHContainerOperations()
>>> referenced by new_allocator.h:120 (/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/ext/new_allocator.h:120)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(void __gnu_cxx::new_allocator<clang::PCHContainerOperations>::construct<clang::PCHContainerOperations>(clang::PCHContainerOperations*))

/usr/bin/ld.lld-6.0: error: undefined symbol: vtable for clang::SyntaxOnlyAction
>>> referenced by FrontendActions.h:158 (/home/lu/work/git-repos/llvm-mono/llvm-project/clang/include/clang/Frontend/FrontendActions.h:158)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(clang::SyntaxOnlyAction::SyntaxOnlyAction())

/usr/bin/ld.lld-6.0: error: undefined symbol: clang::FrontendAction::FrontendAction()
>>> referenced by FrontendAction.h:253 (/home/lu/work/git-repos/llvm-mono/llvm-project/clang/include/clang/Frontend/FrontendAction.h:253)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(clang::ASTFrontendAction::ASTFrontendAction())

/usr/bin/ld.lld-6.0: error: undefined symbol: vtable for clang::ASTFrontendAction
>>> referenced by FrontendAction.h:253 (/home/lu/work/git-repos/llvm-mono/llvm-project/clang/include/clang/Frontend/FrontendAction.h:253)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(clang::ASTFrontendAction::ASTFrontendAction())
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.


Can anyone point me to the right direction to fix it?

Thanks.

-- 
Love,
Lou


_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: linking error when running libTooling tutorial

David Blaikie via cfe-dev
Try adding clangFrontend to target_link_libraries in CMakeLists.txt.

Lou Wynn via cfe-dev <[hidden email]> ezt írta (időpont: 2018. okt. 22., H, 12:14):

I followed the libTooling tutorial at here: http://clang.llvm.org/docs/LibASTMatchersTutorial.html to write the loop-convert program. When I built it, I got the following error (I used the unofficial monorepo to build clang):


$ ninja loop-convert
[1/1] Linking CXX executable bin/loop-convert
FAILED: : && /usr/bin/clang++-6.0   -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -fno-common -Woverloaded-virtual -Wno-nested-anon-types -g  -fuse-ld=lld-6.0 -Wl,--color-diagnostics -Wl,-allow-shlib-undefined tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o  -o bin/loop-convert  lib/libLLVMSupport.so.8svn -lpthread lib/libclangTooling.so.8svn lib/libclangBasic.so.8svn lib/libclangASTMatchers.so.8svn -Wl,-rpath,"\$ORIGIN/../lib" && :
/usr/bin/ld.lld-6.0: error: undefined symbol: clang::PCHContainerOperations::PCHContainerOperations()
>>> referenced by new_allocator.h:120 (/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/ext/new_allocator.h:120)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(void __gnu_cxx::new_allocator<clang::PCHContainerOperations>::construct<clang::PCHContainerOperations>(clang::PCHContainerOperations*))

/usr/bin/ld.lld-6.0: error: undefined symbol: vtable for clang::SyntaxOnlyAction
>>> referenced by FrontendActions.h:158 (/home/lu/work/git-repos/llvm-mono/llvm-project/clang/include/clang/Frontend/FrontendActions.h:158)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(clang::SyntaxOnlyAction::SyntaxOnlyAction())

/usr/bin/ld.lld-6.0: error: undefined symbol: clang::FrontendAction::FrontendAction()
>>> referenced by FrontendAction.h:253 (/home/lu/work/git-repos/llvm-mono/llvm-project/clang/include/clang/Frontend/FrontendAction.h:253)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(clang::ASTFrontendAction::ASTFrontendAction())

/usr/bin/ld.lld-6.0: error: undefined symbol: vtable for clang::ASTFrontendAction
>>> referenced by FrontendAction.h:253 (/home/lu/work/git-repos/llvm-mono/llvm-project/clang/include/clang/Frontend/FrontendAction.h:253)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(clang::ASTFrontendAction::ASTFrontendAction())
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.


Can anyone point me to the right direction to fix it?

Thanks.

-- 
Love,
Lou

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: linking error when running libTooling tutorial

David Blaikie via cfe-dev

I've already added. This is my CMakeLists.txt:

set(LLVM_LINK_COMPONENTS Support)

add_clang_executable(loop-convert
  LoopConvert.cpp
  )
target_link_libraries(loop-convert
  PRIVATE
  clangTooling
  clangBasic
  clangASTMatchers
  )

Love,
Lou

On 10/22/18 7:18 PM, Kristóf Umann wrote:
Try adding clangFrontend to target_link_libraries in CMakeLists.txt.

Lou Wynn via cfe-dev <[hidden email]> ezt írta (időpont: 2018. okt. 22., H, 12:14):

I followed the libTooling tutorial at here: http://clang.llvm.org/docs/LibASTMatchersTutorial.html to write the loop-convert program. When I built it, I got the following error (I used the unofficial monorepo to build clang):


$ ninja loop-convert
[1/1] Linking CXX executable bin/loop-convert
FAILED: : && /usr/bin/clang++-6.0   -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -fno-common -Woverloaded-virtual -Wno-nested-anon-types -g  -fuse-ld=lld-6.0 -Wl,--color-diagnostics -Wl,-allow-shlib-undefined tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o  -o bin/loop-convert  lib/libLLVMSupport.so.8svn -lpthread lib/libclangTooling.so.8svn lib/libclangBasic.so.8svn lib/libclangASTMatchers.so.8svn -Wl,-rpath,"\$ORIGIN/../lib" && :
/usr/bin/ld.lld-6.0: error: undefined symbol: clang::PCHContainerOperations::PCHContainerOperations()
>>> referenced by new_allocator.h:120 (/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/ext/new_allocator.h:120)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(void __gnu_cxx::new_allocator<clang::PCHContainerOperations>::construct<clang::PCHContainerOperations>(clang::PCHContainerOperations*))

/usr/bin/ld.lld-6.0: error: undefined symbol: vtable for clang::SyntaxOnlyAction
>>> referenced by FrontendActions.h:158 (/home/lu/work/git-repos/llvm-mono/llvm-project/clang/include/clang/Frontend/FrontendActions.h:158)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(clang::SyntaxOnlyAction::SyntaxOnlyAction())

/usr/bin/ld.lld-6.0: error: undefined symbol: clang::FrontendAction::FrontendAction()
>>> referenced by FrontendAction.h:253 (/home/lu/work/git-repos/llvm-mono/llvm-project/clang/include/clang/Frontend/FrontendAction.h:253)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(clang::ASTFrontendAction::ASTFrontendAction())

/usr/bin/ld.lld-6.0: error: undefined symbol: vtable for clang::ASTFrontendAction
>>> referenced by FrontendAction.h:253 (/home/lu/work/git-repos/llvm-mono/llvm-project/clang/include/clang/Frontend/FrontendAction.h:253)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(clang::ASTFrontendAction::ASTFrontendAction())
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.


Can anyone point me to the right direction to fix it?

Thanks.

-- 
Love,
Lou

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: linking error when running libTooling tutorial

David Blaikie via cfe-dev
Shouldn't it be this?:
set(LLVM_LINK_COMPONENTS Support)

add_clang_executable(loop-convert
  LoopConvert.cpp
  )
target_link_libraries(loop-convert
  PRIVATE
  clangFrontend
  clangTooling
  clangBasic
  clangASTMatchers
  )  


Lou Wynn <[hidden email]> ezt írta (időpont: 2018. okt. 22., H, 13:59):

I've already added. This is my CMakeLists.txt:

set(LLVM_LINK_COMPONENTS Support)

add_clang_executable(loop-convert
  LoopConvert.cpp
  )
target_link_libraries(loop-convert
  PRIVATE
  clangTooling
  clangBasic
  clangASTMatchers
  )

Love,
Lou

On 10/22/18 7:18 PM, Kristóf Umann wrote:
Try adding clangFrontend to target_link_libraries in CMakeLists.txt.

Lou Wynn via cfe-dev <[hidden email]> ezt írta (időpont: 2018. okt. 22., H, 12:14):

I followed the libTooling tutorial at here: http://clang.llvm.org/docs/LibASTMatchersTutorial.html to write the loop-convert program. When I built it, I got the following error (I used the unofficial monorepo to build clang):


$ ninja loop-convert
[1/1] Linking CXX executable bin/loop-convert
FAILED: : && /usr/bin/clang++-6.0   -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -fno-common -Woverloaded-virtual -Wno-nested-anon-types -g  -fuse-ld=lld-6.0 -Wl,--color-diagnostics -Wl,-allow-shlib-undefined tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o  -o bin/loop-convert  lib/libLLVMSupport.so.8svn -lpthread lib/libclangTooling.so.8svn lib/libclangBasic.so.8svn lib/libclangASTMatchers.so.8svn -Wl,-rpath,"\$ORIGIN/../lib" && :
/usr/bin/ld.lld-6.0: error: undefined symbol: clang::PCHContainerOperations::PCHContainerOperations()
>>> referenced by new_allocator.h:120 (/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/ext/new_allocator.h:120)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(void __gnu_cxx::new_allocator<clang::PCHContainerOperations>::construct<clang::PCHContainerOperations>(clang::PCHContainerOperations*))

/usr/bin/ld.lld-6.0: error: undefined symbol: vtable for clang::SyntaxOnlyAction
>>> referenced by FrontendActions.h:158 (/home/lu/work/git-repos/llvm-mono/llvm-project/clang/include/clang/Frontend/FrontendActions.h:158)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(clang::SyntaxOnlyAction::SyntaxOnlyAction())

/usr/bin/ld.lld-6.0: error: undefined symbol: clang::FrontendAction::FrontendAction()
>>> referenced by FrontendAction.h:253 (/home/lu/work/git-repos/llvm-mono/llvm-project/clang/include/clang/Frontend/FrontendAction.h:253)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(clang::ASTFrontendAction::ASTFrontendAction())

/usr/bin/ld.lld-6.0: error: undefined symbol: vtable for clang::ASTFrontendAction
>>> referenced by FrontendAction.h:253 (/home/lu/work/git-repos/llvm-mono/llvm-project/clang/include/clang/Frontend/FrontendAction.h:253)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(clang::ASTFrontendAction::ASTFrontendAction())
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.


Can anyone point me to the right direction to fix it?

Thanks.

-- 
Love,
Lou

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: linking error when running libTooling tutorial

David Blaikie via cfe-dev

Nice, adding clangFrontend works! The tutorial needs an update.

Thanks.

Love,
Lou

On 10/22/18 8:06 PM, Kristóf Umann wrote:
Shouldn't it be this?:
set(LLVM_LINK_COMPONENTS Support)

add_clang_executable(loop-convert
  LoopConvert.cpp
  )
target_link_libraries(loop-convert
  PRIVATE
  clangFrontend
  clangTooling
  clangBasic
  clangASTMatchers
  )  


Lou Wynn <[hidden email]> ezt írta (időpont: 2018. okt. 22., H, 13:59):

I've already added. This is my CMakeLists.txt:

set(LLVM_LINK_COMPONENTS Support)

add_clang_executable(loop-convert
  LoopConvert.cpp
  )
target_link_libraries(loop-convert
  PRIVATE
  clangTooling
  clangBasic
  clangASTMatchers
  )

Love,
Lou

On 10/22/18 7:18 PM, Kristóf Umann wrote:
Try adding clangFrontend to target_link_libraries in CMakeLists.txt.

Lou Wynn via cfe-dev <[hidden email]> ezt írta (időpont: 2018. okt. 22., H, 12:14):

I followed the libTooling tutorial at here: http://clang.llvm.org/docs/LibASTMatchersTutorial.html to write the loop-convert program. When I built it, I got the following error (I used the unofficial monorepo to build clang):


$ ninja loop-convert
[1/1] Linking CXX executable bin/loop-convert
FAILED: : && /usr/bin/clang++-6.0   -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -fno-common -Woverloaded-virtual -Wno-nested-anon-types -g  -fuse-ld=lld-6.0 -Wl,--color-diagnostics -Wl,-allow-shlib-undefined tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o  -o bin/loop-convert  lib/libLLVMSupport.so.8svn -lpthread lib/libclangTooling.so.8svn lib/libclangBasic.so.8svn lib/libclangASTMatchers.so.8svn -Wl,-rpath,"\$ORIGIN/../lib" && :
/usr/bin/ld.lld-6.0: error: undefined symbol: clang::PCHContainerOperations::PCHContainerOperations()
>>> referenced by new_allocator.h:120 (/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/ext/new_allocator.h:120)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(void __gnu_cxx::new_allocator<clang::PCHContainerOperations>::construct<clang::PCHContainerOperations>(clang::PCHContainerOperations*))

/usr/bin/ld.lld-6.0: error: undefined symbol: vtable for clang::SyntaxOnlyAction
>>> referenced by FrontendActions.h:158 (/home/lu/work/git-repos/llvm-mono/llvm-project/clang/include/clang/Frontend/FrontendActions.h:158)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(clang::SyntaxOnlyAction::SyntaxOnlyAction())

/usr/bin/ld.lld-6.0: error: undefined symbol: clang::FrontendAction::FrontendAction()
>>> referenced by FrontendAction.h:253 (/home/lu/work/git-repos/llvm-mono/llvm-project/clang/include/clang/Frontend/FrontendAction.h:253)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(clang::ASTFrontendAction::ASTFrontendAction())

/usr/bin/ld.lld-6.0: error: undefined symbol: vtable for clang::ASTFrontendAction
>>> referenced by FrontendAction.h:253 (/home/lu/work/git-repos/llvm-mono/llvm-project/clang/include/clang/Frontend/FrontendAction.h:253)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(clang::ASTFrontendAction::ASTFrontendAction())
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.


Can anyone point me to the right direction to fix it?

Thanks.

-- 
Love,
Lou

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: linking error when running libTooling tutorial

David Blaikie via cfe-dev
Cheers, glad it's solved!
Lou Wynn <[hidden email]> ezt írta (időpont: 2018. okt. 22., H, 14:16):

Nice, adding clangFrontend works! The tutorial needs an update.

Yup, let's do it then. ;) 

Thanks.

Love,
Lou

    
On 10/22/18 8:06 PM, Kristóf Umann wrote:
Shouldn't it be this?:
set(LLVM_LINK_COMPONENTS Support)

add_clang_executable(loop-convert
  LoopConvert.cpp
  )
target_link_libraries(loop-convert
  PRIVATE
  clangFrontend
  clangTooling
  clangBasic
  clangASTMatchers
  )  


Lou Wynn <[hidden email]> ezt írta (időpont: 2018. okt. 22., H, 13:59):

I've already added. This is my CMakeLists.txt:

set(LLVM_LINK_COMPONENTS Support)

add_clang_executable(loop-convert
  LoopConvert.cpp
  )
target_link_libraries(loop-convert
  PRIVATE
  clangTooling
  clangBasic
  clangASTMatchers
  )

Love,
Lou

On 10/22/18 7:18 PM, Kristóf Umann wrote:
Try adding clangFrontend to target_link_libraries in CMakeLists.txt.

Lou Wynn via cfe-dev <[hidden email]> ezt írta (időpont: 2018. okt. 22., H, 12:14):

I followed the libTooling tutorial at here: http://clang.llvm.org/docs/LibASTMatchersTutorial.html to write the loop-convert program. When I built it, I got the following error (I used the unofficial monorepo to build clang):


$ ninja loop-convert
[1/1] Linking CXX executable bin/loop-convert
FAILED: : && /usr/bin/clang++-6.0   -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -fno-common -Woverloaded-virtual -Wno-nested-anon-types -g  -fuse-ld=lld-6.0 -Wl,--color-diagnostics -Wl,-allow-shlib-undefined tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o  -o bin/loop-convert  lib/libLLVMSupport.so.8svn -lpthread lib/libclangTooling.so.8svn lib/libclangBasic.so.8svn lib/libclangASTMatchers.so.8svn -Wl,-rpath,"\$ORIGIN/../lib" && :
/usr/bin/ld.lld-6.0: error: undefined symbol: clang::PCHContainerOperations::PCHContainerOperations()
>>> referenced by new_allocator.h:120 (/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/ext/new_allocator.h:120)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(void __gnu_cxx::new_allocator<clang::PCHContainerOperations>::construct<clang::PCHContainerOperations>(clang::PCHContainerOperations*))

/usr/bin/ld.lld-6.0: error: undefined symbol: vtable for clang::SyntaxOnlyAction
>>> referenced by FrontendActions.h:158 (/home/lu/work/git-repos/llvm-mono/llvm-project/clang/include/clang/Frontend/FrontendActions.h:158)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(clang::SyntaxOnlyAction::SyntaxOnlyAction())

/usr/bin/ld.lld-6.0: error: undefined symbol: clang::FrontendAction::FrontendAction()
>>> referenced by FrontendAction.h:253 (/home/lu/work/git-repos/llvm-mono/llvm-project/clang/include/clang/Frontend/FrontendAction.h:253)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(clang::ASTFrontendAction::ASTFrontendAction())

/usr/bin/ld.lld-6.0: error: undefined symbol: vtable for clang::ASTFrontendAction
>>> referenced by FrontendAction.h:253 (/home/lu/work/git-repos/llvm-mono/llvm-project/clang/include/clang/Frontend/FrontendAction.h:253)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(clang::ASTFrontendAction::ASTFrontendAction())
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.


Can anyone point me to the right direction to fix it?

Thanks.

-- 
Love,
Lou

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: linking error when running libTooling tutorial

David Blaikie via cfe-dev
Actually, how did you configure cmake? I experienced similar linker errors when building other external projects, and I suspect it might be down to using a different setup.

On 22 Oct 2018 14:19, "Kristóf Umann" <[hidden email]> wrote:
Cheers, glad it's solved!
Lou Wynn <[hidden email]> ezt írta (időpont: 2018. okt. 22., H, 14:16):

Nice, adding clangFrontend works! The tutorial needs an update.

Yup, let's do it then. ;) 

Thanks.

Love,
Lou

    
On 10/22/18 8:06 PM, Kristóf Umann wrote:
Shouldn't it be this?:
set(LLVM_LINK_COMPONENTS Support)

add_clang_executable(loop-convert
  LoopConvert.cpp
  )
target_link_libraries(loop-convert
  PRIVATE
  clangFrontend
  clangTooling
  clangBasic
  clangASTMatchers
  )  


Lou Wynn <[hidden email]> ezt írta (időpont: 2018. okt. 22., H, 13:59):

I've already added. This is my CMakeLists.txt:

set(LLVM_LINK_COMPONENTS Support)

add_clang_executable(loop-convert
  LoopConvert.cpp
  )
target_link_libraries(loop-convert
  PRIVATE
  clangTooling
  clangBasic
  clangASTMatchers
  )

Love,
Lou

On 10/22/18 7:18 PM, Kristóf Umann wrote:
Try adding clangFrontend to target_link_libraries in CMakeLists.txt.

Lou Wynn via cfe-dev <[hidden email]> ezt írta (időpont: 2018. okt. 22., H, 12:14):

I followed the libTooling tutorial at here: http://clang.llvm.org/docs/LibASTMatchersTutorial.html to write the loop-convert program. When I built it, I got the following error (I used the unofficial monorepo to build clang):


$ ninja loop-convert
[1/1] Linking CXX executable bin/loop-convert
FAILED: : && /usr/bin/clang++-6.0   -fPIC -fvisibility-inlines-hidden -Werror=date-time -Werror=unguarded-availability-new -std=c++11 -Wall -Wextra -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wno-noexcept-type -Wnon-virtual-dtor -Wdelete-non-virtual-dtor -Wstring-conversion -fdiagnostics-color -fno-common -Woverloaded-virtual -Wno-nested-anon-types -g  -fuse-ld=lld-6.0 -Wl,--color-diagnostics -Wl,-allow-shlib-undefined tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o  -o bin/loop-convert  lib/libLLVMSupport.so.8svn -lpthread lib/libclangTooling.so.8svn lib/libclangBasic.so.8svn lib/libclangASTMatchers.so.8svn -Wl,-rpath,"\$ORIGIN/../lib" && :
/usr/bin/ld.lld-6.0: error: undefined symbol: clang::PCHContainerOperations::PCHContainerOperations()
>>> referenced by new_allocator.h:120 (/usr/bin/../lib/gcc/x86_64-linux-gnu/5.4.0/../../../../include/c++/5.4.0/ext/new_allocator.h:120)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(void __gnu_cxx::new_allocator<clang::PCHContainerOperations>::construct<clang::PCHContainerOperations>(clang::PCHContainerOperations*))

/usr/bin/ld.lld-6.0: error: undefined symbol: vtable for clang::SyntaxOnlyAction
>>> referenced by FrontendActions.h:158 (/home/lu/work/git-repos/llvm-mono/llvm-project/clang/include/clang/Frontend/FrontendActions.h:158)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(clang::SyntaxOnlyAction::SyntaxOnlyAction())

/usr/bin/ld.lld-6.0: error: undefined symbol: clang::FrontendAction::FrontendAction()
>>> referenced by FrontendAction.h:253 (/home/lu/work/git-repos/llvm-mono/llvm-project/clang/include/clang/Frontend/FrontendAction.h:253)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(clang::ASTFrontendAction::ASTFrontendAction())

/usr/bin/ld.lld-6.0: error: undefined symbol: vtable for clang::ASTFrontendAction
>>> referenced by FrontendAction.h:253 (/home/lu/work/git-repos/llvm-mono/llvm-project/clang/include/clang/Frontend/FrontendAction.h:253)
>>>               tools/clang/tools/extra/loop-convert/CMakeFiles/loop-convert.dir/LoopConvert.cpp.o:(clang::ASTFrontendAction::ASTFrontendAction())
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.


Can anyone point me to the right direction to fix it?

Thanks.

-- 
Love,
Lou

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev

_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: linking error when running libTooling tutorial

David Blaikie via cfe-dev

This is what I used:

cmake -GNinja  ../llvm-project/llvm -DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi" -DLLVM_OPTIMIZED_TABLEGEN=true -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-6.0 -DCMAKE_CXX_COMPILER=clang++-6.0 -DLLVM_USE_LINKER=lld-6.0 -DLLVM_TARGETS_TO_BUILD="X86" -DBUILD_SHARED_LIBS=ON


Love,
Lou

On 10/22/18 11:14 PM, Kristóf Umann wrote:
Actually, how did you configure cmake? I experienced similar linker errors when building other external projects, and I suspect it might be down to using a different setup.

On 22 Oct 2018 14:19, "Kristóf Umann" <[hidden email]> wrote:
Cheers, glad it's solved!
Lou Wynn <[hidden email]> ezt írta (időpont: 2018. okt. 22., H, 14:16):

Nice, adding clangFrontend works! The tutorial needs an update.

Yup, let's do it then. ;) 

Thanks.

Love,
Lou
On 10/22/18 8:06 PM, Kristóf Umann wrote:
Shouldn't it be this?:
set(LLVM_LINK_COMPONENTS Support)

add_clang_executable(loop-convert
  LoopConvert.cpp
  )
target_link_libraries(loop-convert
  PRIVATE
  clangFrontend
  clangTooling
  clangBasic
  clangASTMatchers
  )  



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev
Reply | Threaded
Open this post in threaded view
|

Re: linking error when running libTooling tutorial

David Blaikie via cfe-dev
Thanks!

On 22 Oct 2018 17:18, "Lou Wynn" <[hidden email]> wrote:

This is what I used:

cmake -GNinja  ../llvm-project/llvm -DLLVM_ENABLE_PROJECTS="clang;libcxx;libcxxabi" -DLLVM_OPTIMIZED_TABLEGEN=true -DCMAKE_BUILD_TYPE=Debug -DCMAKE_C_COMPILER=clang-6.0 -DCMAKE_CXX_COMPILER=clang++-6.0 -DLLVM_USE_LINKER=lld-6.0 -DLLVM_TARGETS_TO_BUILD="X86" -DBUILD_SHARED_LIBS=ON


Love,
Lou

On 10/22/18 11:14 PM, Kristóf Umann wrote:
Actually, how did you configure cmake? I experienced similar linker errors when building other external projects, and I suspect it might be down to using a different setup.

On 22 Oct 2018 14:19, "Kristóf Umann" <[hidden email]> wrote:
Cheers, glad it's solved!
Lou Wynn <[hidden email]> ezt írta (időpont: 2018. okt. 22., H, 14:16):

Nice, adding clangFrontend works! The tutorial needs an update.

Yup, let's do it then. ;) 

Thanks.

Love,
Lou
On 10/22/18 8:06 PM, Kristóf Umann wrote:
Shouldn't it be this?:
set(LLVM_LINK_COMPONENTS Support)

add_clang_executable(loop-convert
  LoopConvert.cpp
  )
target_link_libraries(loop-convert
  PRIVATE
  clangFrontend
  clangTooling
  clangBasic
  clangASTMatchers
  )  



_______________________________________________
cfe-dev mailing list
[hidden email]
http://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-dev