2

I am using two external frameworks In my IOS code. Both framework internally using PLCrashReoprter framework, due to which I am getting duplicate symbol errors.

Now one of the framework, i.e crash reporter framework is having provision to add prefix to the file names/symbols. Below is the code written to add prefix in nameSpace.h:


#define PLCRASHREPORTER_PREFIX AcmeCo

#ifdef PLCRASHREPORTER_PREFIX

// We need two extra layers of indirection to make CPP substitute
// the PLCRASHREPORTER_PREFIX define.
#define PLNS_impl2(prefix, symbol) prefix ## symbol
#define PLNS_impl(prefix, symbol) PLNS_impl2(prefix, symbol)
#define PLNS(symbol) PLNS_impl(PLCRASHREPORTER_PREFIX, symbol)

#define PLCrashMachExceptionServer          PLNS(PLCrashMachExceptionServer)
#define PLCrashReport                       PLNS(PLCrashReport)
#define PLCrashReportApplicationInfo        PLNS(PLCrashReportApplicationInfo)
#define PLCrashReportBinaryImageInfo        PLNS(PLCrashReportBinaryImageInfo)
#define PLCrashReportExceptionInfo          PLNS(PLCrashReportExceptionInfo)

Now the error "comes Apple Mach-O Linker Error"

Undefined symbols for architecture i386:
  "_OBJC_CLASS_$_AcmeCoPLCrashReport", referenced from:
      objc-class-ref in CrashReporter.o

I have added the nameSpace.h file above all the includes.

Please guide me as tried all possible things but no use. Thanks in advance!!

dandan78
  • 13,328
  • 13
  • 64
  • 78
  • You'd have to change the names in one of the frameworks' source files, too. Changing the name in the header files won't be enough. – Crowman Nov 04 '14 at 12:18
  • Is there a reason why you can't just both link them against the same `PLCrashReoprter` framework without twiddling with renaming symbols? – Sergey L. Nov 04 '14 at 12:21
  • Its an external framework, so I am not having its source code. Just headers are visible. – Sonam Sodani Nov 04 '14 at 12:48

1 Answers1

1

You need to recompile the corresponding framwork (all .c files) with the same macro definition so that it exports and uses the modified symbol names.

Klas Lindbäck
  • 33,105
  • 5
  • 57
  • 82
  • Its a third party framework. Can not locate .c file. Just few header files are visible. – Sonam Sodani Nov 04 '14 at 12:50
  • 1
    The source repository for PLCrashReporter is here: https://opensource.plausible.coop/src/projects/PLCR/repos/plcrashreporter/browse But this won't help you anyway, since you would also need to recompile one of your external frameworks that uses PLCrashReporter. So the real solution is asking your 3rd party vendors to provide their frameworks with a namespaced version of PLCrashReporter. On top of that, you'll need to be able to disable crash reporting in one of the frameworks, since you can get reports via both at the same time. – Kerni Nov 04 '14 at 13:35
  • 1
    Solved this issue by recompiling & regenerating the framework from the source code of PLCrashReporter (Link given by Kerni in above comment). – Sonam Sodani Mar 04 '15 at 09:13