0

I'm creating a Wrapper library project which uses another Native-C library. I'm able to use the Wrapper library functions in other applications, through which am able to accessing the functions, which are present in Native-C library.

Now, in Wrapper Library project, when I added 'Unit Testing' (using OCUnit, ), it is giving the errors for all the functions which are present in Native C library. The error is coming while executing the Unit Testing only.

The error it shows is,

**Undefined symbols for architecture i386: "_SQMT_FUNC_close", referenced from: _funcClose in libWrapperLibraryAlter.a(wrapperAPI.o)

  ld: symbol(s) not found for architecture i386

clang: error: linker command failed with exit code 1 (use -v to see invocation)**

The function, 'funcClose' is present in current Wrapper Library project (.m file). The function, 'SQMT_FUNC_close' is present in Native-C library project (.c file).

Unit test execution shows error for all the Native-C functions.

Kindly help in resolving this issue.

The Lirary path:

**/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -arch i386 -bundle -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk -L/work/Final_code/test/iOS/Debug-iphonesimulator -L/work/Final_code/test/iOS/iOSWrapper/../../Product/Library/iOS/Release-iphoneos -F/work/Final_code/test/iOS/Debug-iphonesimulator -F/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.1.sdk/Developer/Library/Frameworks -F/Applications/Xcode.app/Contents/Developer/Library/Frameworks -filelist /work/Final_code/test/iOS/Build/Intermediates/iOSWrapper.build/Debug-iphonesimulator/wrapperTests.build/Objects-normal/i386/wrapperTests.LinkFileList -Xlinker -objc_abi_version -Xlinker 2 -fobjc-arc -fobjc-link-runtime -Xlinker -no_implicit_dylibs -mios-simulator-version-min=5.0 -liOSWrapper -lHomeLittle -framework SenTestingKit -framework Foundation -framework UIKit -o /work/Final_code/iOS/Debug-iphonesimulator/wrapperTests.octest/wrapperTests**

iOSWrapper - is the current wrapper library that i'm testing. HomeLittle - is the Native C library

Arun
  • 75
  • 1
  • 7
  • Can you just add -L -l? your native library should have a name lib, then you add it like -l – exebook Mar 20 '13 at 03:11
  • exebook : i added the library path. please check. – Arun Mar 20 '13 at 03:30
  • Can you check if compiler reports `cannot find library HomeLittle` before it goes to `undefined symbols`? – exebook Mar 20 '13 at 03:33
  • Are you sure HomeLittle is actually compiled into libHomeLittle.o? you can also check the libHomeLittle.o arch. (You can find how to do that on SO) – exebook Mar 20 '13 at 03:35
  • exebook : Before giving the error, the following warning was present. ld: warning: ignoring file /work/Final_code/Product/Library/iOS/Release-iphoneos/libHomeLittle.a, missing required architecture i386 in file /work/Final_code/Product/Library/iOS/Release-iphoneos/libHomeLittle.a (2 slices) – Arun Mar 20 '13 at 04:06
  • yeah, that's definitly it, your library is present but compiled for other architecture. Probably for the real device, and you are compiling for simulator which is other type of cpu. I hit that many times. libHomeLittle.a. Recompile the lib for simulator. See here please how to determine the result. http://stackoverflow.com/questions/1085137/how-do-i-determine-the-target-architecture-of-static-library-a-on-mac-os-x – exebook Mar 20 '13 at 05:35
  • exebook : you are right! initially i tried executing the unit test on device only. Since it gave the error, 'Logic Testing Unavailable', i switched it to Simulator. After I recompiled the native library in simulator, now the unit test is gone for simulator. But still the, 'Logic Testing Unavailable' message is coming for the device. – Arun Mar 20 '13 at 06:12

0 Answers0