4

I have imported a new version of a framework in my SDK. Anyway, I am not able to build on iPhone 6 running iOS 9.0.1 because of the following error that's driving me crazy:

duplicate symbol _IPDJobStatus in:
/Users/akiki/Desktop/iOS 9 Test/MPSDK/iPD.framework/iPD(IPDDevice.o)
/Users/akiki/Desktop/iOS 9 Test/MPSDK/iPD.framework/iPD(IPDAdministration.o)
ld: 5 duplicate symbols for architecture arm7
clang: error: linker command failed with exit code 1 (use -v to see invocation)

This is happening for the same symbol _IPDJobStatus being found twice in 5 files. The same is happening on iPhone 4S running iOS 9.1 with arm64 architecture. To import the framework, I deleted the old one from the project, imported the new one and check into the Link Binary with Library section wether the framework reference links to the correct updated file. Before asking I have tried to perform the following actions:

  1. I searched for the duplicate symbol inside the project scope with no result.
  2. I'm not importing a .m file by accident.
  3. The Compile Sources of the Build Phases project settings doesn't include any duplicate file.
  4. The framework headers references in Headers of the Build Phases project settings link to the proper files.
  5. I tried to clean the project, empty the Derived Data folder, quit and relaunch Xcode.
  6. I added the -ObjC linker flag (in this case the duplicate symbols goes from five to only one).
  7. I switched the No Common Blocks compiler setting to NO, though it has the same error with or without it.
  8. I created a new empty project and imported the framework there. In this case I was able to build, so the problem must resides in my SDK.

Could someone please give me some help?

Dree
  • 702
  • 9
  • 29
  • isn't it? http://stackoverflow.com/questions/16427024/duplicate-symbols-for-architecture-armv7 – Alexander B Nov 04 '15 at 09:20
  • search in Build Settings-> "Framework Search Paths" or "Libarary Search Paths" about iSMP framework. if any wrong link exist remove it. Or in your project dir may content two iSMP framework but one not be included! – larva Nov 04 '15 at 09:30
  • the problem is nothing to do with headers. This problem occurs at the linker stage of build. If you filter the build transcript on the offending _IPDJobStatus symbol, it will be there at least twice. Either in your compile source build phase, or relating to the framework or static lib you are importing, that symbol - the .o file - is there twice. Check your build phases and the transcript to identify the source of the offending file. – Max MacLeod Nov 10 '15 at 09:37
  • I tried to search for that symbol throughout the whole project (both on my SDK and on my static lib), but I cannot find it. Also, in these five cases, the first file is always `IPDDevice`. – Dree Nov 10 '15 at 10:05
  • You should tell who provide the framework to modify it. There must be a global variable with the same name in each of the two files, tell him that put a `static` modifier in front of every variable to limit its scope. – KudoCC Nov 10 '15 at 10:12
  • as the error detailed in the question shows, that symbol is within file IPDDevice.o. So it is IPDDevice.o that occurs twice. As I say check your phases and your build transcript – Max MacLeod Nov 10 '15 at 12:50
  • In my Build Phases, I haven't the `IPDDevice.m` compile source because that file refers to a framework class (so I only have the `.h` file and I see no `_IPDJobStatus` inside of it). From the build transcript, I see that the five duplicate symbol errors all refer to this symbol being found in the `IPDDevice.m` and other five files all belonging to the framework. However, if I try to make an SDK sample project and add the static library and the framework there, I am able to compile without errors. – Dree Nov 10 '15 at 13:35
  • Its pretty clear from the error that the duplicate symbol is in the *framework* not your app. Did you build the framework yourself? did you clean all your targets? – Brad Allred Nov 16 '15 at 18:54

4 Answers4

2

You can check your project directory may be there available framework. If available then delete it.

Keyur Hirani
  • 1,607
  • 14
  • 22
  • There's no duplicate framework within my project directory. – Dree Nov 04 '15 at 11:46
  • You didn't give the right answer, but nobody else did either. Anyway, I am forced to give this bounty and I chose you. Reputation system on this site sometimes works like the Mafia. – Dree Nov 17 '15 at 08:47
1

I was able to solve the same problem with the following code.

Add this to the Library Search Paths in Build Settings and make sure you select recursive, delete other library paths which might be absolute paths.

$(PROJECT_DIR) 

May be it will help you.

1

You can not make constant type variables of same name & type in two or more classes.

_IPDJobStatus is this constant type variable?

change it to some other name for different classes.

Here you can see the same issue

Community
  • 1
  • 1
M Zubair Shamshad
  • 2,741
  • 3
  • 23
  • 45
  • I haven't declared that symbol in my SDK. I didn't manage to find it in my project nor in the header files of the framework. – Dree Nov 10 '15 at 10:55
  • remove that framework and clean the project. now run and test. check if it works or not? – M Zubair Shamshad Nov 10 '15 at 11:24
  • If not, then there must be a reference of that deleted file. 1) go to build phase, 2) Link binary with libraries, 3) select your framework and press minus button to remove it – M Zubair Shamshad Nov 10 '15 at 11:25
  • if yes, then you can add this framework again and now it should be okay. – M Zubair Shamshad Nov 10 '15 at 11:31
  • I did what you suggested. If I try to remove the framework, I got an error from a header of the static lib telling me it can't find the `iPD.h` file. – Dree Nov 10 '15 at 11:40
  • Going to Target > Build Settings > Search paths and removing the offending paths from Framework Search Paths and Library Search Paths will be helpful. – M Zubair Shamshad Nov 11 '15 at 06:25
0

It means in you project multiple copy of same View Controller instance (i,e means duplicate).

Possible observation:

This IPDJobStatus variable contains in the class IPDDevice or IPDAdministration of the framework is duplicate. Please check this.

Note: You should not have/create a class which already have in any other framework either Xcode's default or 3rd party framework.

For example: UIkit framework have class name "UIApplication" (i.e UIApplication.h, and UIApplication.m). So, if you create you class name "UIApplication". this error will occur. Same case for also 3rd party framework.

Jamil
  • 2,977
  • 1
  • 13
  • 23