I'm trying to build a project with the new release of the open source Swift 2.2 compiler and am running into a few issues.
A minimal example like this:
.
├── Package.swift
└── Sources
└── main.swift
Package.swift
import PackageDescription
let package = Package(
name: "foo",
dependencies: []
)
main.swift
print("foo")
run via swift build throws the following:
Compiling Swift Module 'foo' (1 sources)
Linking Executable: .build/debug/foo
Undefined symbols for architecture x86_64:
"__TFSSCfT21_builtinStringLiteralBp8byteSizeBw7isASCIIBi1__SS", referenced from:
_main in main.swift.o
"__TFs5printFTGSaP__9separatorSS10terminatorSS_T_", referenced from:
_main in main.swift.o
"__TIFs5printFTGSaP__9separatorSS10terminatorSS_T_A0_", referenced from:
_main in main.swift.o
"__TIFs5printFTGSaP__9separatorSS10terminatorSS_T_A1_", referenced from:
_main in main.swift.o
"__TMSS", referenced from:
_main in main.swift.o
"__TTSg5P____TFs27_allocateUninitializedArrayurFBwTGSax_Bp_", referenced from:
_main in main.swift.o
"__TZvOs7Process11_unsafeArgvGSpGSpVs4Int8__", referenced from:
_main in main.swift.o
"__TZvOs7Process5_argcVs5Int32", referenced from:
_main in main.swift.o
"_globalinit_33_1BDF70FFC18749BAB495A73B459ED2F0_func5", referenced from:
_main in main.swift.o
"_globalinit_33_1BDF70FFC18749BAB495A73B459ED2F0_token5", referenced from:
_main in main.swift.o
ld: symbol(s) not found for architecture x86_64
<unknown>:0: error: build had 1 command failures
swift-build: exit(1): ["/Library/Developer/Toolchains/swift-2.2-SNAPSHOT-2015-12-01-a.xctoolchain/usr/bin/swift-build-tool", "-f", "/Users/kilian/Desktop/foo/.build/debug/foo.o/llbuild.yaml"]
Swift is Apple Swift version 2.2-dev (LLVM 46be9ff861, Clang 4deb154edc, Swift 778f82939c) Target: x86_64-apple-macosx10.9 as provided on swift.org.
The only troubleshooting info regarding this I can find online corresponds to Xcode and linking other external libraries. Any help here would be much appreciated.
I haven't tried the new open source Swift on my Mac yet, focusing on playing with it on Linux instead. However, one way something like this could happen on Linux is when Clang is not available. In that case swift REPL and swift as an interpreter work fine, but swiftc and swift build fail. Just out of curiosity you may want to try
swiftc main.swift
in your Sources directory. Google for xcode command line tools mac os x or a combination of those search terms. The following, for example, might help:
https://developer.apple.com/library/ios/technotes/tn2339/_index.html
To see if your command tools are available, try clang or gcc from the command line. If you get a message that there are no input files, then the tools are installed (maybe incorrectly). If you get some other error, then the tools aren't there, and that's a very likely cause of your problem.
Hope this helps.
Related
I have a running cocos2d project and a running ios storyboard project that both run without errors , when i try to embed cocos2d project into the main project i have the following errors (After disabling ARC and adding required frameworks ):
Undefined symbols for architecture i386:
"_gzclose", referenced from:
_ccInflateGZipFile in ZipUtils.o
"_gzopen", referenced from:
_ccInflateGZipFile in ZipUtils.o
"_gzread", referenced from:
_ccInflateGZipFile in ZipUtils.o
"_inflate", referenced from:
_inflateMemoryWithHint in ZipUtils.o
"_inflateEnd", referenced from:
_inflateMemoryWithHint in ZipUtils.o
"inflateInit2", referenced from:
_inflateMemoryWithHint in ZipUtils.o
"_uncompress", referenced from:
_ccInflateCCZFile in ZipUtils.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Add the libz.dylib library to the Link Binaries build phase or add -lz as other linker flag in Build Settings. Both will ensure the app is linked with the zip library needed by cocos2d.
I'm porting an app from the iOS side to the Mac side and I'm having an annoying linking error where the linker appears to be trying to use the iOS version of the coredata framework instead of the (x86_64) one. I've deleted the framework and re-added it and know I'm adding the mac version. I've also regenerated my model classes. I'm getting this error:
ld: warning: ignoring file /Users/xxxxx/xcode_projects/xxxxx/CoreData.framework/CoreData, file was built for unsupported file format which is not the architecture being linked (x86_64)
Undefined symbols for architecture x86_64:
"_NSSQLiteStoreType", referenced from:
-[CoreDataSingleton persistentStoreCoordinator] in CoreDataSingleton.o
"_NSInferMappingModelAutomaticallyOption", referenced from:
-[CoreDataSingleton persistentStoreCoordinator] in CoreDataSingleton.o
"_NSMigratePersistentStoresAutomaticallyOption", referenced from:
-[CoreDataSingleton persistentStoreCoordinator] in CoreDataSingleton.o
"_OBJC_CLASS_$_NSManagedObjectContext", referenced from:
objc-class-ref in CoreDataSingleton.o
"_OBJC_CLASS_$_NSManagedObjectModel", referenced from:
objc-class-ref in CoreDataSingleton.o
etc...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
Any suggestions would be helpful, thanks,
Nick
Link errors usually mean you aren't including a framework in the project.
In the "Link Binary With Libraries" section of the "Build Phases" tab of the build settings for your project, make sure CoreData.framework is listed. If not, press the "+" button and select it.
I am new to iPad developer and i want to create ePub file in my project,
I downloaded sample epub file, from here
and im stuck with a problem.
i am getting this errors in my project...
ld: warning: ignoring file /Users/krunal/Downloads/EpubReader/libz.1.2.3.dylib, missing required architecture i386 in file
Undefined symbols for architecture i386:
"_inflateEnd", referenced from:
_unzCloseCurrentFile in unzip.o
"_inflateInit2_", referenced from:
_unzOpenCurrentFile3 in unzip.o
"_get_crc_table", referenced from:
_unzOpenCurrentFile3 in unzip.o
_zipOpenNewFileInZip3 in zip.o
"_crc32", referenced from:
_unzReadCurrentFile in unzip.o
_zipWriteInFileInZip in zip.o
-[ZipArchive addFileToZip:newname:] in ZipArchive.o
"_inflate", referenced from:
_unzReadCurrentFile in unzip.o
"_deflateInit2_", referenced from:
_zipOpenNewFileInZip3 in zip.o
"_deflate", referenced from:
_zipWriteInFileInZip in zip.o
_zipCloseFileInZipRaw in zip.o
"_deflateEnd", referenced from:
_zipCloseFileInZipRaw in zip.o
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)
How to solve this errors, any idea ?
Thanks In Advance !!
The logs seem to indicate that the problem is coming from the libz.1.2.3.dylib framework.
What iOS SDK are you using (and which Xcode version) ?
In your project, click on your target and go to the Build Phases tab, then "Link binary with libraries" section.
Try removing the libz.1.2.3 framework and then re-adding the libz.1.2.5 (click on the little "+" at the bottom of the window and select libz.1.2.5 from the list).
EDIT:
As stated by Abizern in below comment, adding libz.dylib instead of libz.1.2.5.dylib should do the trick. This should link to the latest version of the lib (see this question and answers here).
ld: warning: directory not found for option '-L/Users/photon/Desktop/Walg-19-aug/WalgreensIPAD_1.0.3/iPad/Walgreens/../ZXingWidget/build/Debug-iphonesimulator'
ld: warning: directory not found for option '-L/Users/photon/Desktop/Walg-19-aug/WalgreensIPAD_1.0.3/iPad/Walgreens/../ZXingWidget/build/Debug-iphoneos'
ld: warning: directory not found for option '-L/Users/photon/Desktop/Walg-19-aug/WalgreensIPAD_1.0.3/iPad/Walgreens/../ZXingWidget/build/Release-iphoneos'
ld: warning: ignoring file /Users/photon/Desktop/Walg-19-aug/WalgreensIPAD_1.0.3/iPad/Walgreens/libOmnitureAppMeasurement-iPhoneDevice.a, file was built for unsupported file format which is not the architecture being linked (i386)
ld: warning: ignoring file /Users/photon/Desktop/Walg-19-aug/WalgreensIPAD_1.0.3/iPad/Walgreens/libOmnitureAppMeasurement-iPhoneSimulator_4_0_GM.a, file was built for unsupported file format which is not the architecture being linked (i386)
Undefined symbols for architecture i386:
"_deflateInit2_", referenced from:
-[ASIDataCompressor setupStream] in ASIDataCompressor.o
"_deflateEnd", referenced from:
-[ASIDataCompressor closeStream] in ASIDataCompressor.o
"_deflate", referenced from:
-[ASIDataCompressor compressBytes:length:error:shouldFinish:] in ASIDataCompressor.o
"_inflateInit2_", referenced from:
-[ASIDataDecompressor setupStream] in ASIDataDecompressor.o
"_inflateEnd", referenced from:
-[ASIDataDecompressor closeStream] in ASIDataDecompressor.o
"_inflate", referenced from:
-[ASIDataDecompressor uncompressBytes:length:error:] in ASIDataDecompressor.o
"_OBJC_CLASS_$_OMAppMeasurement", referenced from:
objc-class-ref in OmnitureService.o
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
Command /Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin/g++-4.2 failed with exit code 1
i got this error Even i Included the libz1.2.5.dylib into my project.
I am working in X-Code 4.2 for IOS Beta Version
# All
Any one please tell problem solving.
EDIT : As of Xcode 7 libz.dylib has been renamed to libz.tbd
I fix this problem by add libz.dylib to Link Library.
following this guide:
http://allseeing-i.com/ASIHTTPRequest/Setup-instructions
you need to follow this set of instruction to use this API http://allseeing-i.com/ASIHTTPRequest/Setup-instructions, I am sure you didn't added libz.dylib in your project
Make sure that ALL relevant targets have libz linked. You could be adding it to Target A and trying to compile Target B which is missing it.
Please make sure that you link against libz correctly, eg. check that its included in the "Link Binary With Libraries" build phase of your target.
I'm not a 100% sure, but it says "for architecture i386" ... should be armv6 or armv7...
So i would check your build steps...
In Xcode 8 libz.dylib has been renamed to libz.tbd
Trying to compile a basic program which uses pcap.h. I've set up the environment on my Mac OSX box which uses the iPhone 3.1.3 SDK for an iPhone 3GS. I've also installed libpcap to ~/libpcap so I can tell gcc where to look for the headers using the -I flag. However, it fails with an ld warning saying the file is not of the required architecture.
I'm compiling with the following line:
/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc -I /Users/abnev/libpcap/include -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk -o pcap pcap.c -lpcap
Error's being generated are:
ld: warning: in /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk/usr/lib/libpcap.dylib, file is not of required architecture
Undefined symbols:
"_pcap_geterr", referenced from:
_main in ccOL3e0B.o
_main in ccOL3e0B.o
"_pcap_open_live", referenced from:
_main in ccOL3e0B.o
"_pcap_next", referenced from:
_main in ccOL3e0B.o
"_pcap_lookupdev", referenced from:
_main in ccOL3e0B.o
"_pcap_setfilter", referenced from:
_main in ccOL3e0B.o
"_pcap_lookupnet", referenced from:
_main in ccOL3e0B.o
"_pcap_close", referenced from:
_main in ccOL3e0B.o
"_pcap_compile", referenced from:
_main in ccOL3e0B.o
ld: symbol(s) not found
collect2: ld returned 1 exit status
I assume now that I need to recompile libpcap for the armv6 architecture (iPhone) but checking the ./configure options doesn't help. I've attempted to Google around for this but there is very little out there.
pcap.c isn't the source to libpcap, it's one of the source files to libpcap. You'd have to compile all the source files and build them into a library.
Doing
CFLAGS="-I /Users/abnev/libpcap/include -arch armv6 -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.1.3.sdk" ./configure
might produce a Makefile that would cross-compile libpcap for iOS.
I presume you will be installing libpcap, or the application built using it, on a jailbroken iPhone, at least if you're going to be capturing packets, because you would need root access in order for libpcap to be able to open a BPF device in order to be able to capture.