I recently upgraded my Xcode command line tools and now I get errors when compiling stuff that compiled before the upgrade.
tools/px.c:7:10: fatal error: 'unistd.h' file not found
#include <unistd.h>
^~~~~~~~~~
Before this upgrade, whenever I installed a new release of Xcode, I had to install the command line tools and additionally
/Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
After the latest upgrade, that file and the directory containing it does not exist any more.
I was able to find the package on another machine where I have not yet upgraded.
Nevertheless the issue remain unsolved.
Related
I have a C++ project that have been compiling fine until now, I did not install any update of my system or XCode but I get this error:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/wchar.h:123:15: fatal error: 'wchar.h' file not found
This file does exist on my system, so I suppose it's the CMake env paths that are no longer set up properly in the console?
Edit: if I clean my build dir and regenerate the whole CMake project, it is working again, but I still find this behaviour very unpleasant.
This has happened just when there was an available update for MacOS 13.0, and probably XCode updates going with it. But I did not install any of them yet, and my compilation is already broken.
What is happening so that the dev env is changed anyway?
I remember I had likewise issues last time there was an OS update.
Is any configuration needed to "secure" a dev env on MacOS?
Are all OS updates going to screw my XCode includes etc?
I tried using goczmq on windows 10, but it doesn't work even if I installed czmq using vcpkg.
Steps I tried was:
vcpkg install czmq which automatically installed zeromq as well.
It seems to work on visual studio 2022, but not for goczmq which returns the following error.
....\github.com\zeromq\goczmq#v4.1.0+incompatible\auth.go:4:10: fatal error: czmq.h: No such file or directory
4 | #include "czmq.h"
| ^~~~~~~~
Not sure if I missed some steps or if I need to do something extra?
MacOS Mojave Version 10.14 (18A389).
Today I updated Xcode to version 10.0 (10A255). End when I try to build my Qt project I get an error:
clang: warning: no such sysroot directory: '/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.13.sdk' [-Wmissing-sysroot]
In file included from ../greed/timediagram.cpp:1:
In file included from ../../../Qt/5.9.1/clang_64/lib/QtGui.framework/Headers/QtGui:3:
In file included from /Users/arsenyspiridonov/Qt/5.9.1/clang_64/lib/QtGui.framework/Headers/QtGuiDepends:3:
In file included from /Users/arsenyspiridonov/Qt/5.9.1/clang_64/lib/QtCore.framework/Headers/QtCore:4:
In file included from ../../../Qt/5.9.1/clang_64/lib/QtCore.framework/Headers/qglobal.h:47:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/utility:202:
In file included from /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/cstring:61:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1/string.h:61:15: fatal error: 'string.h' file not found
#include_next <string.h>
^~~~~~~~~~
1 error generated.
make: *** [timediagram.o] Error 1
16:13:47: Процесс «/usr/bin/make» завершился с кодом 2.
Ошибка при сборке/установке проекта greed (комплект: Desktop Qt 5.9.1 clang 64bit)
Во время выполнения этапа «Сборка»
What's the problem? How to fix it?
add 'QMAKE_MAC_SDK = macosx10.14' to your .pro file, and manually delete .qmake.stash from your build directory (or directories).
In my case I updated xcode to the last version, so instead of have on the folder the version 10.13, I had MacOSX10.14.sdk ( that is a symbolic link to the folder MacOSX.sdk)
so, you can solve the problem with this code on terminal:
sudo ln -s MacOSX.sdk/ MacOSX10.13.sdk
positioned on the current folder.
I hope it helps.
I just reinstalled Qt. All is Ok now
This helped me:
Close the project in Qt Creator.
Delete the .pro.user file in your code directory.
Add QMAKE_MAC_SDK = macosx10.14 and QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.14 to your .pro file in a text editor (not in Qt Creator). Replace 10.14 with whatever MacOS version you want to build for.
Re-open the project in Qt Creator. It will reconfigure.
Build.
Adding to sellen's Answer: If you have trouble locating your .qmake.stash file, or if you don't have a .qmake.stash file in your build folder, try locating it using the terminal:
find /path/to/base/folder -name ".qmake.stash"
In my case I had a .qmake.stash file in my build parent folder, but not in my build folder. Not sure how it got there but somehow QMake picked it up and as soon as I deleted it and restarted Qt Creator things started to work again.
the fast solution is to create new shotcut in /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs folder, you can copy the exist shortcut, them change the name you need.
This happen to me recently and my Xcode needed to update. So I would recommend quitting xcode and trying to update your current version to see if that fixes your problem.
I am using macOS.
I am trying to build the code of mozilla-central.
While running the command ./mach build, the build fails at the compile step. Here are the relevant stack traces:
stack backtrace:
0:20.24 0: 0x10436b5ff - std::sys::unix::backtrace::tracing::imp::unwind_backtrace::hed04c7a1477ef1e3
0:20.24 1: 0x10434499d - std::sys_common::backtrace::print::h336400f22676933f
0:20.24 2: 0x104373bd3 - std::panicking::default_hook::{{closure}}::h0d6700a02d682978
0:20.24 3: 0x10437395c - std::panicking::default_hook::h90363c6d6ac04260
0:20.24 4: 0x1043742fb - std::panicking::rust_panic_with_hook::h81c4f3add25e6667
0:20.24 5: 0x1043740ce - std::panicking::continue_panic_fmt::hfa057b7c1de88179
0:20.24 6: 0x104374020 - std::panicking::begin_panic_fmt::hd1123702300ea9f2
0:20.24 7: 0x1035f4e6d - build_script_build::build_gecko::bindings::write_binding_file::h2d9a397b93e6a614
0:20.24 8: 0x1035f651c - build_script_build::build_gecko::bindings::generate_bindings::ha066bc11b076e01d
0:20.24 9: 0x1043808fe - __rust_maybe_catch_panic
0:20.24 10: 0x1035eea9f - std::panicking::try::hcbd901ede6e8004c
0:20.32 11: 0x1035e335c - <F as alloc::boxed::FnBox<A>>::call_box::h638a7c5eb8c94414
0:20.33 12: 0x104373037 - std::sys_common::thread::start_thread::h78b1dd404be976ad
0:20.33 13: 0x1043436c8 - std::sys::unix::thread::Thread::new::thread_start::h27c6becca8cf44e0
0:20.33 14: 0x7fff636208cc - _pthread_body
0:20.33 15: 0x7fff6362083e - _pthread_start
0:20.33 /usr/local/Cellar/llvm/6.0.1/include/c++/v1/stdio.h:108:15: fatal error: 'stdio.h' file not found
0:20.33 /usr/local/Cellar/llvm/6.0.1/include/c++/v1/stdio.h:108:15: fatal error: 'stdio.h' file not found, err: true
0:20.37 thread '<unnamed>' panicked at 'Failed to generate bindings
According to me, the root cause is:
/usr/local/Cellar/llvm/6.0.1/include/c++/v1/stdio.h:108:15: fatal error: 'stdio.h' file not found, err: true
The solution listed online was to install xcode command line tools using:
xcode-select --install
I have already done this.
Try setting SDKROOT explicitly to the system SDK:
export SDKROOT=$(xcrun --sdk macosx --show-sdk-path)
Doing it avoids the need for creating symlinks in /usr.
This error seem recurrent, for example, if you installed another compiler (e.g. gcc from brew). Setting SDKROOT became so common that it might be a good idea to add it to ~/.bash_profile.
The root reason is due to a missing /usr/include directory.
Installing command-line tools (xcode-select --install), sometimes, will not automatically add it.
The Link shows the correct way:
After installing command-line tools
Install the package at:
# run this in Terminal
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
After that,
you should have a directory /usr/include with header files
I had the same problem for compiling R packages, and running xcode-select --install and macOS_SDK_headers_for_macOS_10.14.pkg did not solve the problem.
I discovered that there seems to be some confusion from Apples side between macOS 10.14 and 10.15, since I'm running Mojave (10.14) with the latest xcode 11.0 (11A420a), and when clang compiles it looks for the MacOSX10.14.sdk sysroot directory in
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
but there only MacOSX10.15.sdk is present (along with other stuff). I fixed this with
pushd /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/
sudo ln -s MacOSX.sdk MacOSX10.14.sdk
popd
Now I can install packages in RStudio again.
This is a comment to Rick Li. It’s too long to fit into comment area.
The solution provided by Rick Li isn’t necessary the correct way. It’s only the easiest way. According to Xcode 10 release note:
…If you are the maintainer of such software, we encourage you to update your project to work with the SDK or file a bug report for issues that are preventing you from doing so. As a workaround, an extra package is provided which will install the headers to the base system. In a future release, this package will no longer be provided. …
So the right way is to contact Mozilla team that their application won’t build without hack. It will break eventually.
If you don’t take this seriously, it would bite you in future. I still recall that Apple deprecated 32-bit application on macOS 10.13 (High Sierra). Now they formally disabled it in macOS 10.15 (Catalina) and I hear about people crying everywhere. Be responsible of your choice.
I had the same problem. Tried to install the command-line tools via xcode-select --install but it didn't worked out for me.
After more research i found out that you can download the command-line tools on Apples official developer support site (Link)
Search for command and download first suggestion.
Run the .dmg file and see if works.
Worked out great for me!
I had the same problem (suddenly) compiling my own project - not finding <stdio.h> and <wchar.h>.
Running xcode-select --install said
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
The following steps worked for me:
Open Xcode once and allow it installing necessary components
Remove the CMake cache files and retry cmake and build
I'm on macOS Big Sur 11.2.3 with Xcode version 12.5.
Add -isysroot with needed MaсOSX version
It work for me: MacOS Big Sure 11.4 & XCode 12.5.1
Know latest MacOS SDK version path by command:
xcrun --sdk macosx --show-sdk-path
Add path result to -isysroot:
-isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.3.sdk
UPD: if solution above did not help, try put -I to include from MacOS SDK
-I$(MACOSSDK)/usr/include\
-I$(MACOSSDK)/usr/include/c++\
-I$(MACOSSDK)/usr/include/c++/v1\
-I$(MACOSSDK)/usr/include/c++/v1/ext\
-Wnonportable-include-path
Command Line Tools Path Setting
I saw that "Command Line Tools" is not set in the xcode settings, as shown in the figure, click to select the Xcode path, and then compile, there is no such error.
I have downloaded Chess.app from opensource.apple.com. When I run xcodebuild install I get an error:
fatal error: 'CoreFoundation/CFLogUtilities.h' file not found
#import <CoreFoundation/CFLogUtilities.h>
^ 1 error generated.
The same error occurs when Building within XCode.
I have looked in /System/Library/Frameworks/CoreFoundation.framework/Versions/A/Headers/ and, sure enough, CFLogUtilities.h is not present. I see that it's available to download from Apple's Open Source Website, but I feel like if it's linked in an app bundled with the OS, it should be installed by default, or at least after installing XCode + Command Line Tools.
Do I have to manually download and bundle the header file in order to build the project, or am I missing something?
I don't know what OS version you are using, but to compile this on 10.9 simply change CFLogUtilities.h to CoreFoundation.h.
you also either need to build the CrashReporterClient.a library and add it to the project, or remove it from the "link with libraries" build setting for the target.
a shell script will fail because iconcompiler is missing, but you can comment out that script line with a # and run just fine. I will leave it as an exercise to you to figure out how best to restore the app icon.