I have two targets -- an iOS target and a macOS target. On the iOS target, it first fails to find the file called for by the line
#include "i386/types.h"
in the file types.h. On the macOS target, it fails to find almost all of the headers imported by AppKit.h -- starting with the line
#import <AppKit/AppKitDefines.h>
Interestingly, it did find Foundation.h.
What went wrong, and how can I fix it?
EDIT: I know the files are present on my machine, because other projects find them no problem.
Well, i386 doen't make any sense on IOS so likely some settings have been messed up by having both types of targets...
So start a new project, add only the targets and see if that works out?
Related
I have a workspace with multiple targets.
Each target has its own prefix.pch file.
Prefix-Header is entered in Build Settings and Precompile Prefix Header is set to YES.
The app compiles and runs fine when I run it on my device.
There are no errors when I just build the app.
But when I try to archive it, I get a compile error saying:
No such file or directory: '/Users/me/Library/Developer/Xcode/DerivedData/myApp-dcmvkatguqcxgjfyrqcunbsfuxcd/Build/Intermediates.noindex/ArchiveIntermediates/myAppTarget/PrecompiledHeaders/SharedPrecompiledHeaders/13524936819627194222/myAppTarget-Prefix.pch'
And indeed, when I open this folder on my hd, I can't see the pch-file. There are, however, similar files there:
myAppTarget-Prefix.pch.d
myAppTarget-Prefix.pch.dia
myAppTarget-Prefix.pch.gch
I tried everything I found on SO and elsewhere, but nothing helped.
I have Cocoapods installed and use them in this project, but I don't think that error is related to that (they seem to compile fine).
XCode 12.4
Seems like I figured it out.
The culprit was a totally unrelated build-setting.
In Other C Flags my settings differed in debug and release.
I had $(inherited) in both of them, but in the release setting I additionally had -isystem - which apparently is already included in $(inherited). That caused a multitude of errors that ended with the prefix.pch not being copied...
Here's a frustrating one. My project builds perfectly in 8.x versions of XCode, and yet in 9.x versions, it fails consistently in the linker phase, as the linker is unable to find the .o file for a seemingly random class.
For example, in one build it will be unable to find the intermediate object file for my UIWindow subclass:
In other builds, other files may be identified as the culprit, with the same "file not found" linker error.
So, clearly there is a disconnect in the linker phase. I can understand that. But I cannot make it work to save my life.
Here's what DIDN'T work:
• Deleting derived data
• Cleaning and option-cleaning
• In the .swift file inspector, removing the file from the target and re-adding to target
• Renaming the target
• Deleting the supposedly erroneous files from the project, and moving to trash, then re-adding the files to the project and target.
• Switching advanced workspace settings for Build Settings from "XCode default" to "Legacy"
• Updating XCode from 9.0 to 9.0.1
• Deintegrating Cocoapods and reinstalling them
Jeez.
So, none of the usual suspects are at play here.
Additional details :
• When I look in the folder specified in the linker error message, the .o files are NOT THERE. (Are they not being created? Is there a setting for that?)
• Using Mac OS High Sierra on a MacBook Pro Retina 15
So there's my conundrum.
Does anyone know why XCode 9 would either not be creating .o files, or would be unable to find those files, for a project that build perfectly in previous versions of XCode?
Thanks!
The only solution I found was admittedly pretty painful. I created a new project and then re-imported all the files and dependencies into the new project. Then setup all the build settings, etc. At that point the project was back to building and working fine.
If this happened again, I would try deleting the .xcworkspace file and re-generating it with pod install first before starting a new project.
May this not happen to you.
I have come back to working on a school project after a short hiatus. However, I can't get it to build anymore. We were provided with the following cmake file:
cmake_minimum_required(VERSION 2.8)
PROJECT(astro)
SET(VTK_DIR /Users/hank/Hartree/VTK/install/lib/cmake/vtk-6.0)
find_package(VTK REQUIRED)
include(${VTK_USE_FILE})
add_executable(astro MACOSX_BUNDLE astro)
SET(CMAKE_CXX_LINK_FLAGS "-framework OpenGL")
if(VTK_LIBRARIES)
target_link_libraries(astro ${VTK_LIBRARIES})
else()
target_link_libraries(astro vtkHybrid)
endif()
After running cmake and trying to compile the project with make, I get the following error:
*** No rule to make target >'/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Deve>loper/SDKs/MacOSX10.12.sdk/System/Library/Frameworks/OpenGL.framework', >needed by 'astro.app/Contents/MacOS/astro'. Stop.
I think I updated my os and xcode during my break from the project, and that caused the issue. I don't know a whole lot about cmake or makefiles, but I think that somehow the path to openGL is getting messed up. Poking through my file system I have found the paths
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk,
and
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk,
and I have been able to find the OpenGL frameworks in those directories, but there is no MacOSX10.12.sdk directory.
I found the following similar questions here and here. However, I have not been using Qt, and when I run xcode-select -pit prints the correct path /Applications/Xcode.app/Contents/Developer
Any ideas how to fix this?
I received exactly the same error when installing an application from source code. I solved this problem by duplicate the "MacOSX10.13.sdk" directory in
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
and rename it "MacOSX10.12.sdk".
I am not an expert in MacOSX or cmake, therefore my answer may not be the best solution and may even cause problems, but it does solve this problem for me. If anyone knows the correct way to do, I'd like to know it.
Here are what I tried:
At beginning, cmake can not find "CMAKE_OSX_SYSROOT" after configuration.
I first changed the cmake settings to
CMAKE_OSX_DEPLOYMENT_TARGET:STRING=10.12
CMAKE_OSX_SYSROOT:STRING=macosx10.13
but this does not work. Same error.
Then I updated my Mac to MacOSX 10.13 High Sierra. This time cmake can correctly set
CMAKE_OSX_SYSROOT:PATH=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk
but still generates the same error. Therefore I believe the problem comes from the application source code.
I googled how to install MacOSX10.12.sdk and find this post:SDKs.
The easiest way may be finding the old sdk from TimeMachine. But I just bought my Mac and it doesn't have the old version sdk. Therefore I simply duplicate and rename the sdk to try, and it works. I think putting the sym link of the real MacOSX10.12.sdk in the folder will be the best solution to this problem.
After several hours of investigation I am stuck with this one. After migrating from Swift to Swift2 I manage to deal with all the errors, but in the end I got clang error:
ld: file not found:
-L/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/swift/iphonesimulator
clang: error: linker command failed with exit code 1 (use -v to see
invocation)
I am not really sure why does this happen nor how I can resolve it. Some of you got similar problem ?
I tried :
close/open XCode
clean build
clean build folder
delete derived data
tried to add another device (Devices screen, add simulator)
tried to build for iOS device ( same error, just instead of iphonesimulator i got iphoneos )
opened particular folder, everything is there
I am able to open iOS simulator from code
EDIT, Oct-9-2015:
After a bit more investigation, I found out following:
Pods compile correctly. Every one of them.
If I remove iphonesimulator/iphoneos they don't work
Tried to clear Library path, set it to various differenet values - no success (Library path because of -L at the start).
Found out that swiftCore is somehow missing in path:
Unable to find swiftCore; please set SWIFT_LIBRARY_PATH (currently '')
to the folder containing swiftCore.
Building from terminal to get more info about the error.
Tried to restart computer, reinstall XCode and other most common things
Tried other project - working without problem(project without pods)
Seems like this will be a diary till I commit suicide...
After 2 days of losing my mind, finally got to the solution. Hope it will save someones day :)
First, I decided to recreate the project file and pods to see if there is something wrong with them. It turned out they are fine. Project build without any issue.
So, clearly, problem was in the project/workspace file. I started comparing flag by flag, and ended up in changing the following:
Duplicate Pods_X.framework - removed one
CLANG_ALLOW_NON_MODULAR_INCLUDES_IN_FRAMEWORK_MODULES = NO - was YES before
GCC_SYMBOLS_PRIVATE_EXTERN = YES; - was no for debug
SWIFT_OPTIMIZATION_LEVEL = "-Onone"; - was something long before
If someone knows why this flags could produce something that painfull I will be happy to find out...
I'm having this problem building a project using oauth in Xcode. It's a Mac App.
Do I have to patch llvm or something? I hope not...
Is there anywhere I can set this option in xcode?
Thanks!
You'll have to patch your source code so it does not use -I-, which has been deprecated for a long time. It's rather strange that an Xcode project is using that option, but sometimes build systems do strange things, I guess.
Just had the same error message. Apparently my mistake was to rename the source root folder (the one containing the xcodeproj bundle) to something containing a space! Once I renamed the folder to something without spaces, Xcode had no problem building the app.