Intel® oneAPI Base Toolkit
Support for the core tools and libraries within the base toolkit that are used to build and deploy high-performance data-centric applications.
419 Discussions

Dpcpp Error While Generating Shared Object

_Santosh_
Beginner
1,541 Views

Hi,

I have migrated the code and tried to generate target file using makefile.

$ make
dpcpp -shared -o libadd.so add.dp.o
/usr/bin/ld: /tmp/add-071358.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: /tmp/libadd-ca2409.o: relocation R_X86_64_32 against `.rodata' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: Nonrepresentable section on output
dpcpp: error: linker command failed with exit code 1 (use -v to see invocation)
Makefile:15: recipe for target 'libadd.so' failed
make: *** [libadd.so] Error 1

Please find the original Makefile attached along with source code files in the zip file attached!! I was able to generate target file in native code. 

But I'm unable to do the same after migration. Can you please let me know the changes need to be done to makefile so that i can generate target file using dpcpp?

0 Kudos
1 Solution
GouthamK_Intel
Moderator
1,487 Views

Hi Santosh,

We apologise for the unavailability of the attached screenshot, and there might be some technical issue.

 

Please find the steps below.

  1. dpcpp -fPIC -c add.dp.cpp
  2. dpcpp -fPIC -shared -o libadd.so add.dp.o
  3. mpiicc driver.c libadd.so -o myout

Also, I'm attaching the screenshot again. Please check it below.

GouthamK_Intel_0-1602590332218.png

 

Let us know if you face any further challenges.

 

Thanks & Regards

Goutham

View solution in original post

0 Kudos
5 Replies
GouthamK_Intel
Moderator
1,510 Views

Hi Santosh,

Use the -fPIC option when building shared libraries. It is required for the compilation of each object file included in the shared library.


Please follow the below steps to create a shared object file.

Let us know if you face any further issues.


Thanks & Regards

Goutham


0 Kudos
_Santosh_
Beginner
1,500 Views
Hi,
Steps are not mentioned in the previous reply.
Please find the screenshot !! and provide the necessary steps.
0 Kudos
GouthamK_Intel
Moderator
1,488 Views

Hi Santosh,

We apologise for the unavailability of the attached screenshot, and there might be some technical issue.

 

Please find the steps below.

  1. dpcpp -fPIC -c add.dp.cpp
  2. dpcpp -fPIC -shared -o libadd.so add.dp.o
  3. mpiicc driver.c libadd.so -o myout

Also, I'm attaching the screenshot again. Please check it below.

GouthamK_Intel_0-1602590332218.png

 

Let us know if you face any further challenges.

 

Thanks & Regards

Goutham

0 Kudos
_Santosh_
Beginner
1,462 Views
Hi,
Thanks for the response!! It "helped'' me to resolve the issue.

Thanks & Regards
Santosh
0 Kudos
GouthamK_Intel
Moderator
1,452 Views

Hi Santosh,

Glad to know that your issue is resolved!


Thanks for the confirmation!

As this issue has been resolved, we will no longer respond to this thread. 

If you require any additional assistance from Intel, please start a new thread. 

Any further interaction in this thread will be considered community only. 


Have a Good day!


Thanks & Regards

Goutham



0 Kudos
Reply