# How to stop CMake from appending shared libraries on a Cray?

**URL:** <https://discourse.cmake.org/t/how-to-stop-cmake-from-appending-shared-libraries-on-a-cray/1826>\
**Category:** Code\
**Created:** [September 11, 2020, 8:53pm UTC](https://discourse.cmake.org/t/how-to-stop-cmake-from-appending-shared-libraries-on-a-cray/1826 "2020-09-11T20:53:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jrobcary](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/bcef8e/32.png) [@jrobcary](https://discourse.cmake.org/u/jrobcary)\
**Post date:** [September 11, 2020, 8:53pm UTC](https://discourse.cmake.org/t/how-to-stop-cmake-from-appending-shared-libraries-on-a-cray/1826/1 "2020-09-11T20:53:12Z")

</div>

3.18.2

The end of my link line has

-lz -ldl -lrt  
/global/project/projectdirs/txsupp/vp11usrs/cori/contrib-gcc8.3/muparser-2.2.6.1-ser/lib64/libmuparser.a  
/global/project/projectdirs/txsupp/vp11usrs/cori/contrib-gcc8.3/Python-2.7.16-sersh/lib/python2.7/config/libpython2.7.a  
-lutil  
/opt/cray/pe/libsci/19.06.1/GNU/8.1/x86\_64/lib/libsci\_gnu\_82\_mpi\_mp.so  
/opt/cray/pe/libsci/19.06.1/GNU/8.1/x86\_64/lib/libsci\_gnu\_82\_mp.so  
/opt/gcc/8.3.0/snos/lib64/libgomp.so

which results in

/usr/bin/ld: attempted static link of dynamic object  
`/opt/cray/pe/libsci/19.06.1/GNU/8.1/x86\_64/lib/libsci\_gnu\_82\_mpi\_mp.so’  
collect2: error: ld returned 1 exit status

It all links just fine if those appended shared libraries are taken off  
the link line.

How can I tell CMake not to append these?

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 19, 2020, 1:21pm UTC](https://discourse.cmake.org/t/how-to-stop-cmake-from-appending-shared-libraries-on-a-cray/1826/2 "2020-11-19T13:21:18Z")

</div>

Could you provide the relevant `target_link_libraries` for this? Potentially the `find_package` calls involved with that as well. It could be that you need to tell something to find static libraries instead.

@chuckatkins if you know what might be going on here.

---

<div class="post-metadata">

**Author:** ![jrobcary](https://discourse.cmake.org/letter_avatar_proxy/v4/letter/j/bcef8e/32.png) [@jrobcary](https://discourse.cmake.org/u/jrobcary)\
**Post date:** [November 19, 2020, 3:39pm UTC](https://discourse.cmake.org/t/how-to-stop-cmake-from-appending-shared-libraries-on-a-cray/1826/3 "2020-11-19T15:39:22Z")

</div>

This can be closed. By some combination of removing libraries, getting rid of implicit libs, etc., the problem went away. Thx!
