0

In our project we rely on 2 printer libraries: StarIO & Epson ePOS, and during compile i hit this error:

duplicate symbol _GetOnlineStatus in:
/Users/brendan/Development/xxxx/Frameworks/StarIO.framework/StarIO(StarIOPort.o)
/Users/brendan/Development/xxxx/xxxxApp/SDKs/Epson/libepos2.a(eposprint_common_status.o)
ld: 1 duplicate symbol for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see 
invocation)

Need some help with the best way to resolve this issue please.

Brendan
  • 809
  • 1
  • 8
  • 13

1 Answers1

0

This situation can sometimes be challenging — since both libraries are seemingly using the same symbol and because the implementations could be different. The only reliable way to fix this is to have each library vendor use a prefix for each of their classes/symbols within their libraries.

Apart from that, since I assume you only have the compiled version of the epson library (libepos2.a) you'll either want to:

  1. Rename the symbol(s) that clash in StarIO.framework
  2. Combine both libraries.

Option 1:

If you decide to simply rename the symbol causing the issue do a search in StarIO.framework:

GetOnlineStatus

Then rename it everywhere (in 12 files) it shows up in that library to something slightly different:

StarIO_GetOnlineStatus

Located in the following:

StarIO.framework/Versions/A/Headers/SMPort.h
StarIO.framework/Versions/A/Headers/WBluetoothPort.h
StarIO.framework/Versions/A/Headers/BluetoothPort.h
StarIO.framework/Versions/A/Headers/starmicronics/StarIOPort.h

StarIO.framework/Versions/Current/Headers/SMPort.h
StarIO.framework/Versions/Current/Headers/WBluetoothPort.h
StarIO.framework/Versions/Current/Headers/BluetoothPort.h
StarIO.framework/Versions/Current/Headers/starmicronics/StarIOPort.h

StarIO.framework/Headers/SMPort.h
StarIO.framework/Headers/BluetoothPort.h
StarIO.framework/Headers/WBluetoothPort.h
StarIO.framework/Headers/starmicronics/StarIOPort.h

Option 2:

The other option would be to combine the two libraries into one, although that can be quite a bit more complicated and present other issues perhaps. For details on how to go about doing so please see this answer here on stackoverflow.

l'L'l
  • 44,951
  • 10
  • 95
  • 146
  • Thanks for your answer I'L'l. I tried option 1, though unfortunately that did not work for me. Option 2 I'm a bit reluctant to try. I've been in touch with Epson and they hopefully can create a new build with namespaced symbols. – Brendan Feb 25 '18 at 22:09