Community
cancel
Showing results for 
Search instead for 
Did you mean: 
_Santosh_
Beginner
376 Views

Dpcpp Error While Generating Shared Object

Jump to solution

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
322 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

5 Replies
GouthamK_Intel
Moderator
345 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


_Santosh_
Beginner
335 Views
Hi,
Steps are not mentioned in the previous reply.
Please find the screenshot !! and provide the necessary steps.
GouthamK_Intel
Moderator
323 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

_Santosh_
Beginner
297 Views
Hi,
Thanks for the response!! It "helped'' me to resolve the issue.

Thanks & Regards
Santosh
GouthamK_Intel
Moderator
287 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



Reply