IOS Build Error Expo SDK 47

Getting this error on building for IOS

❌  duplicate symbol '_A' in
┌─ libRNBluetoothEscposPrinter.a(RNBluetoothEscposPrinter.o)
└─ libepos2.a(AccesscodeEngine.o)
❌  ld: 1 duplicate symbol for architecture arm64
❌  clang: error: linker command failed with exit code 1 (use -v to see invocation)

I am using GitHub - tulparyazilim/tp-react-native-bluetooth-printer: React-Native plugin for the bluetooth ESC/POS printers. This plugin is fork of react-native-bluetooth-escpos-printer library for Scanning bluetooth devices and using this GitHub - tr3v3r/react-native-esc-pos-printer: An unofficial React Native library for printing on an EPSON TM printer with the Epson ePOS SDK for iOS and Epson ePOS SDK for Android for printing receipts.

Working fine on Android without any build error.

IOS Build Environment

|           Build environment           |
| xcode_path  | /Applications/ |
| gym_version | 2.210.0                 |
| sdk         | iPhoneOS16.0.sdk        |

any help?

@wodin @notbrent

Hi @anismohamed

This looks to me like a bug in the iOS code for tulparyazilim/tp-react-native-bluetooth-printer

You should probably try creating an issue on their repository or maybe asking on a place like Stack Overflow

Hi @wodin . Thanks for replying.
if I install any one of these libraries and build the application for iOS then it works fine . Both installed at a same time is not working.

Ah I see

Still it looks like an incompatibility between those two libraries, so Expo did not cause the problem and cannot fix it.

Do you need both libraries? It looks like react-native-esc-pos-printer does have a discover() function.

If the above doesn’t work, perhaps you could post to Stack Overflow to say what you are trying to do and how you are trying to do it and what errors you are getting. Maybe someone has suggestions on how to scan for Bluetooth printers and how to print to a Bluetooth printer found by scanning.

@wodin Yes . I need both libraries, as discover() function of react-native-esc-pos-printer discovers the offline devices as well if they were paired before and were saved in the mobile. To discover only the online printers, first I had to unpair those paired printers from the settings of the mobile device and then if I tried to discover printers then it showed no printers. So this thing, i had to done manullay.
To overcome this issue , I used other library for scanning which was emitting only the online devices and then used the previous one to initialize the printers and print respective things.

OK, then it sounds like you need to talk to the authors of the react-native-esc-pos-printer library to see if there’s a way to make it do what you want, or else see if they can give you advice on how to make it work with the other library. Either way this does not seem to me to be something that Expo can help you with.

EDIT: Unless maybe you can use some other library to do the scanning.

Would this work?

With this config plugin:

@wodin Thanks a lot for your kind support and detailed replies.
Yes. It seems to me that the issue is not with the expo . But I opened a question here for the possible guidance to overcome this issue.
I tried this mentioned library react-native-ble-plx with this config plugin before, it was just scanning normal Bluetooth devices , not the Epson printers.
But I would again give it a try to check scanning.
Thanks again for your kind support.

Is there any flag, which we can specify while giving command for ios build using eas build --platform ios --profile development to not strictly check for the duplicate symbol errors?

1 Like

No. There’s a way you can deal with two copies of the same library being loaded (using a config plugin), but that doesn’t seem to be the case you are running into.

In your case you have two different libraries that both export the same symbol. So you could possibly make a change to one or both of them to rename the symbol, but I’m not sure which symbol it is, since in the error it’s referring to something called “_A”. Maybe that’s some sort of mangled symbol name, but I don’t know enough about Objective C to be sure.

Here’s a fix for a similar issue:

And it seems the symbol you should be looking for is “A”. In the above case the symbol was “distance”, but the error was referring to “_distance”.

So I believe this is where one of those “A” symbols is coming from. The other one would of course be in the other library, which I haven’t checked.

I think that you might be able to make the same fix as in the RN SVG PR above:

-Byte A[] = {0x61};//a
+static Byte A[] = {0x61};//a

If that doesn’t work you could try renaming all occurrences of A in that file to TPRNBTP_A or something like that. But at first glance this “A” symbol doesn’t seem to need to be exported, so better just not export it if possible.

Try using patch-package to make the change. If it works, maybe you can submit a pull request to the library.

1 Like

Hi @wodin . Thanks for your time and detailed response.

I wanted to take a moment to express my gratitude for the help you provided me in resolving the programming issue I was facing. Your suggested fix was extremely helpful and allowed me to solve the problem quickly and efficiently.

I forked that library.

I just changed
Byte A[] = {0x61};//a
static Byte A[] = {0x61};//a .

Saved. Pushed. Reinstalled. Rebuild and it worked.

I will send a pull request to that main library.
Thanks for your kind help again.

1 Like

Thanks for confirming it works!

1 Like

This topic was automatically closed 20 days after the last reply. New replies are no longer allowed.