Skip to content

Add 'clangSerialization' to CMakeLists (fix downstream link error). #475

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 1 commit into from
Sep 1, 2023

Conversation

tylanphear
Copy link
Contributor

The following link error occurs in downstream after 1bda00e:

ld: error: undefined symbol: clang::PCHContainerOperations::PCHContainerOperations()
>>> referenced by opencl_clang.cpp
>>>               _deps/opencl-clang-build/CMakeFiles/common_clang.dir/opencl_clang.cpp.o:(Compile)
icpx: error: linker command failed with exit code 1 (use -v to see invocation)

This is similar to the link error seen in
https://reviews.llvm.org/D157078, which was resolved in the same way
(https://reviews.llvm.org/rG36daf3532d91bb3e61d631edceea77ebb8417801).

This patch just adds 'clangSerialization' to the link libraries to
resolve the issue.

The following link error occurs in downstream after 1bda00e:

```
ld: error: undefined symbol: clang::PCHContainerOperations::PCHContainerOperations()
>>> referenced by opencl_clang.cpp
>>>               _deps/opencl-clang-build/CMakeFiles/common_clang.dir/opencl_clang.cpp.o:(Compile)
icpx: error: linker command failed with exit code 1 (use -v to see invocation)
```

This is similar to the link error seen in
https://reviews.llvm.org/D157078, which was resolved in the same way
(https://reviews.llvm.org/rG36daf3532d91bb3e61d631edceea77ebb8417801).

This patch just adds 'clangSerialization' to the link libraries to
resolve the issue.
@tylanphear
Copy link
Contributor Author

This fix is also urgent to unblock the downstream build. Pinging @hewj03, @haonanya for review.

Copy link
Contributor

@wenju-he wenju-he left a comment

Choose a reason for hiding this comment

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

LGTM

@wenju-he
Copy link
Contributor

@tylanphear I just take a look at link.txt and it show opencl-clang is linking libclangSerialization.a
The root cause is probably that opencl-clang doesn't depends on clangSerialization target and opencl-clang is linking its dependencies before clangSerialization is built. So this build error could happen to other clang static libraries. 1bda00e forgot to use add_dependencies.
I suggest to revert 1bda00e first, WDYT?

@wwXing0
Copy link
Contributor

wwXing0 commented Aug 16, 2023

@tylanphear I just take a look at link.txt and it show opencl-clang is linking libclangSerialization.a The root cause is probably that opencl-clang doesn't depends on clangSerialization target and opencl-clang is linking its dependencies before clangSerialization is built. So this build error could happen to other clang static libraries. 1bda00e forgot to use add_dependencies. I suggest to revert 1bda00e first, WDYT?

reverts commit 1bda00e by #476

@tylanphear
Copy link
Contributor Author

Closing in favor of #476

@tylanphear tylanphear closed this Aug 16, 2023
@tylanphear tylanphear deleted the fix_downstream_link_error branch August 16, 2023 03:03
@wenju-he
Copy link
Contributor

wenju-he commented Aug 18, 2023

after discussion with @zhaomaosu, we think this pr is probably the right fix although it is still unclear why clangSerialization is needed twice in link.txt.
clangSerialization is also added to some clang tools CMakeLists.txt
So I'll revert #476 and then re-open this PR.

@wenju-he
Copy link
Contributor

@tylanphear branch tylanphear:fix_downstream_link_error is deleted, could you please restore the branch and re-open this pr?

@tylanphear tylanphear restored the fix_downstream_link_error branch August 31, 2023 17:12
@tylanphear
Copy link
Contributor Author

Reopening as requested by @wenju-he.

@tylanphear tylanphear reopened this Aug 31, 2023
@wenju-he wenju-he merged commit 8c0846c into intel:main Sep 1, 2023
@tylanphear tylanphear deleted the fix_downstream_link_error branch September 1, 2023 00:57
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