# Problems dynamic compilation and cuda fortran

**URL:** <https://forums.developer.nvidia.com/t/problems-dynamic-compilation-and-cuda-fortran/131750>\
**Category:** Legacy PGI Compilers (archived)\
**Created:** [May 21, 2010, 2:28pm UTC](https://forums.developer.nvidia.com/t/problems-dynamic-compilation-and-cuda-fortran/131750 "2010-05-21T14:28:12Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![dafte](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@dafte](https://forums.developer.nvidia.com/u/dafte)\
**Post date:** [May 21, 2010, 2:28pm UTC](https://forums.developer.nvidia.com/t/problems-dynamic-compilation-and-cuda-fortran/131750/1 "2010-05-21T14:28:12Z")

</div>

I am trying to use cuda fortran in a project. But i have a problem during the compilation. When i compile a dynamic library I get the following error :

> ld: Base/FldFortranVecCUF.o: relocation R\_X86\_64\_PC32 against symbol `kernel\_operatordivcu\_\_entry’ can not be used when making a shared object; recompile with -fPIC  
> ld: final link failed: Bad value

I use this command to compile :  
pgf90 -Mcuda=cc13 -fast -fPIC -o Base/FldFortranVecCUF.o -c Base/FldFortranVecCUF.cuf

When i compile in static, with -Mcuda=emu or without cuda kernel, i have no trouble. I am looking for an error for some time now but didn’t find it yet. Is there something special about cuda fortran and dynamic libraries?
