# How to link libs when compiling my own codes based on C API？

**URL:** <https://discuss.pytorch.org/t/how-to-link-libs-when-compiling-my-own-codes-based-on-c-api/6747>\
**Category:** Uncategorized\
**Created:** [August 26, 2017, 7:24am UTC](https://discuss.pytorch.org/t/how-to-link-libs-when-compiling-my-own-codes-based-on-c-api/6747 "2017-08-26T07:24:30Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![matthieuheitz](https://discuss.pytorch.org/letter_avatar_proxy/v4/letter/m/8edcca/32.png) [@matthieuheitz](https://discuss.pytorch.org/u/matthieuheitz)\
**Post date:** [June 5, 2018, 9:14am UTC](https://discuss.pytorch.org/t/how-to-link-libs-when-compiling-my-own-codes-based-on-c-api/6747/3 "2018-06-05T09:14:45Z")

</div>

Hello,  
I’m on Ubuntu 16.04, I installed Pytorch from source, following the instructions here [GitHub - pytorch/pytorch: Tensors and Dynamic neural networks in Python with strong GPU acceleration](https://github.com/pytorch/pytorch/).  
I was surprised that there is no libTH.\* in /home/$MYUSERNAME/anaconda/lib/python3.6/site-packages/torch/lib  
The only files there are :

> include/  
> libcaffe2\_gpu.so  
> libcaffe2\_gpu.so.1  
> libcaffe2.so  
> libcaffe2.so.1  
> libnccl.so  
> libnccl.so.1  
> libshm.so  
> THCUNN.h  
> THNN.h  
> torch\_shm\_manager

I had to build torch7 from source like described here [#include \<TH/TH.h\>](https://discuss.pytorch.org/t/include-th-th-h/5666), and I got a libTH.so  
Is there a reason that when building torch from pytorch, it doesn’t build the libTH.\* library ?  
Is there an option that I missed when building pytorch ?  
Thank you.

---

_[View the full topic](https://discuss.pytorch.org/t/how-to-link-libs-when-compiling-my-own-codes-based-on-c-api/6747)._
