# cannot link to dynamic library correctly during parallel build

**URL:** <https://discourse.cmake.org/t/cannot-link-to-dynamic-library-correctly-during-parallel-build/1706>\
**Category:** Code\
**Tags:** os:linux, gen:ninja\
**Created:** [August 14, 2020, 7:31am UTC](https://discourse.cmake.org/t/cannot-link-to-dynamic-library-correctly-during-parallel-build/1706 "2020-08-14T07:31:22Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![sandy-lcq](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/s/d07c76/32.png) [@sandy-lcq](https://discourse.cmake.org/u/sandy-lcq)\
**Post date:** [August 14, 2020, 7:31am UTC](https://discourse.cmake.org/t/cannot-link-to-dynamic-library-correctly-during-parallel-build/1706/1 "2020-08-14T07:31:22Z")

</div>

I met a compile fail problem, which is caused during parallel build. Please see this bug report for detail:  
[https://bugs.llvm.org/show\_bug.cgi?id=46617](https://bugs.llvm.org/show_bug.cgi?id=46617)

how can I fix this in CMakeList.txt? I have tried to explicitly change target\_link\_libraries to .so, but during parallel build, if .a is generated first, it is possbile that .a is used, and make the build fail, is this bug of cmake?

Thanks

---

<div class="post-metadata">

**Author:** ![ben.boeckel](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/b/ea5d25/32.png) [@ben.boeckel](https://discourse.cmake.org/u/ben.boeckel)\
**Post date:** [November 11, 2020, 10:12pm UTC](https://discourse.cmake.org/t/cannot-link-to-dynamic-library-correctly-during-parallel-build/1706/2 "2020-11-11T22:12:22Z")

</div>

Already posted [here](https://discourse.cmake.org/t/cannot-link-to-dynamic-library-during-parallel-build/1685).
