Generate Libtool Objects for Cuda files

Labeeb Asari <[email protected]> Mon, 20 Mar 2023 14:09:19 +0530
Newsgroups gmane.comp.gnu.libtool.general
Message-ID <CABdRRwQa_S3aDOac=1xWZEv51_UQjZYcrgrZP_jEz3MdGhXPsg@mail.gmail.com>
*Background : *

I'm trying to integrate Cuda in an existing C library. This C library uses
GNU Autotools for building.

The flow is

   - compile all C source files using gcc
   - compile all Cuda source files using nvcc
   - link all the object files using gcc


I've tried this on a small test library by manually running compiling and
linking commands and the library was created successfully.

*Questions : *

   1. How do I configure libtool to compile cuda source files using a
   different compiler (nvcc)? I've tried writing a rule to compile Cuda source
   files separately, however during linking, libtool ignores all the cuda
   object files because they don't have corresponding libtool object files
   with them.                      I've tried the following libtool commands
   to compile a .cu file(cuda source code) [image: image.png] The correct
   command to compile this using just nvcc is :  nvcc -Xcompiler -fPIC -c
   test.cu
   2. If libtool cannot compile cuda source files, How do I use libtool
   without generating libtool objects?(I only want to build a shared object
   file). Basically libtool should generate only .o files for each .c file
   during compilation. And it should link all the .o files (including the ones
   generated by nvcc) during linking. How do I achieve this?

ThankYou.
image.png (image/png, 110.4 KB) - not displayed