Wrong execution path of cc in xcodebuild - xcode

I downloaded and installed Xcode 4.2 on Lion. With installed examples, I could build them with Xcode IDE, but I got those error messages when I tried to execute the same project file with xcodebuild.
can't exec '/Developer/Library/Xcode/PrivatePlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/
Developer/Library/Xcode/Plug-ins/LLVM GCC 4.2.xcplugin/Contents/Resources/
cc -arch i386' (No such file or directory)
The problem is that it tries to call "...\cc -arch i386" as a command, but the cc is not in that directory.
What's wrong with this xcodebuild setup? Why xcodebuild tries to call the cc based on the wrong directory information?

During xcodebuild, I need to specify the path of CC, otherwise wrong one got used.
make CC="$PLATFORM_DEVELOPER_BIN_DIR/cc"

Related

Xcode React-Native: linker error - library not found for -lRCTTypeSafety after clean

Xcode 12.3
Cocoapods 1.10.1
React Native CLI 4.13.1
I am having a recurring failure building a React Native app at the linking stage (library not found for -lRCTTypeSafety) in the Xcode "Archive" Build task. ("Product" > "Archive") It fails with the same error when I run the first "Build" after a "Clean Build Folder".
It does not occur when I run the "Build" task, which usually succeeds, but the "first build after a clean" behavior lines up with how the "Archive" task behaves, which appears to run an implicit "clean" first, so they appear to be a similar failure case.
None of the suggested remediations I've found on-line have worked. I am using the workspace, not the project file. FWIW, I have confirmed the same occurs using xcodebuild. (As opposed to the Xcode gui.) xcodebuild clean build fails reliably, as well as xcodebuild archive, but xcodebuild build succeeds if it isn't the first build after a clean.
Several Pod libraries are missing from the linker command when it fails. On a successful run, the xcodebuild build action has the following additional -L flags in the clang linking command that are missing on the failed attempts:
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/DoubleConversion
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/FBReactNativeSpec
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/Folly
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/RCTTypeSafety
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/RNCPicker
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-Core
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-CoreModules
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-RCTAnimation
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-RCTBlob
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-RCTImage
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-RCTLinking
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-RCTNetwork
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-RCTSettings
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-RCTText
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-RCTVibration
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-cxxreact
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-jsi
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-jsiexecutor
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-jsinspector
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/ReactCommon
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/<project>.app
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/Yoga
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/glog
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/react-native-geolocation
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/react-native-maps
-L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/React-Core/AccessibilityResources.bundle
A successful build action has no WriteAuxiliaryFile, CompileC, or Libtool log lines, so it appears that the failed first attempt after a clean is actually building the Pod files correctly, just not providing the necessary paths to the linker command.
The Libtool lines for the missing library from a failed build look like:
Libtool /Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/RCTTypeSafety/libRCTTypeSafety.a normal (in target 'RCTTypeSafety' from project 'Pods')
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static -arch_only arm64 -D -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.3.sdk -L/Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/RCTTypeSafety -filelist /Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Intermediates.noindex/Pods.build/Release-iphoneos/RCTTypeSafety.build/Objects-normal/arm64/RCTTypeSafety.LinkFileList -dependency_info /Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Intermediates.noindex/Pods.build/Release-iphoneos/RCTTypeSafety.build/Objects-normal/arm64/RCTTypeSafety_libtool_dependency_info.dat -o /Users/<user>/Library/Developer/Xcode/DerivedData/<project>-bcgmbzkfkmobskcxnhtpmhoehiux/Build/Products/Release-iphoneos/RCTTypeSafety/libRCTTypeSafety.a
and I've checked that the output file libRCTTypeSafety.a is present in the path specified for the -o flag above. The directory that contains the file is included in the missing -L flags provided, so it really looks like there's just some step between compilation and linking that is getting missed.
Any help would be greatly appreciated!

Can't make FestVox compile due to missing -leststring and missing libeststring.a

So I have installed / compiled speech_tools, and Festival (2.3) using Cygwin on my Win8.1 machine to the point that I can successfully produce speech using this command:
echo "hello world" | \src\main\festival --tts
The next step is for me to get FestVox running. I have downloaded FestVox 2.6 and I have run ./configure; however, the 'make' step is giving me trouble, producing this error:
gcc -O3 -Wall -o phonealign phonealign_main.o -LC:/cygwin64/Festival/build
/speech_tools/lib -lestools -lestbase -leststring -lncurses -lstdc++ -lm -lwinmm -luser32
/usr/bin/ld: cannot find -leststring
collect2: error: ld returned 1 exit status
Makefile:80: recipe for target 'phonealign' failed
So, I looked at my Makefile at where it might be trying to look for this file, and it looks like in that directory (build\speech_tools\lib) I am missing a libeststring.a partner for my libeststring.lib. Both libestbase and libestools have .lib and .a files in that directory.
At what step did I go wrong?? Should a libeststring.a have been created at some point??? When? How can I fix this?
I think the problem is that you should use compiler in Windows instead of gcc within Cygwin. The role in Cygwin for building Festival is to run configure to generate a Makefile for VC. Then run nmake in Windows command line not make within Cygwin.
Cygwin cannot build a native Windows application like what MINGW does. Application build in Cygwin can only run within Cygwin.
*.a is the static library for Linux, which is built by gcc. *.lib is the static library for Windows, which is built by VC.
So I suggest you taking a look at README, INSTALL files in FestVox. To find whether there is description for make a Makefile for Windows like process "3. Make makefile for VC in Cygwin" in my document (http://www.eguidedog.net/doc_build_win_festival.php)
Cameron

C++11 in Qt5 / QtCreator 3.0.1 on OSX

Just downloaded and installed Qt5 on OSX 10.9.2.
When trying to compile some C++11 code using the clang run kit, I get a failure when I try to include cstdint;
fatal error: 'cstdint' file not found
After a lot of googling, it seems that c++11 is not 'enabled' by default which triggers this error. It further seems that the way to enable c++11 has changed in Qt5. It should be as simple as adding CONFIG+=c++11 in "Projects -> Build & Run -> Build Steps -> Additional arguments" if I understand it correctly.
However this makes no difference whatsoever.
So; anyone knows how to enable c++11 using QtCreator with the clang kit?
About QtCreator gives me the following information:
QtCreator 3.0.1
Based on Qt 5.2.1 (Clang 5.0 (Apple), 64 bit)
The compiler output is as follows:
14:25:23: Running steps for project shelly...
14:25:23: Starting: "/Users/m/Qt5.2.1/5.2.1/clang_64/bin/qmake" /Volumes/files/Programmering/shelly/shelly.pro -r -spec macx-clang CONFIG+=debug CONFIG+=x86_64 CONFIG+=declarative_debug CONFIG+=qml_debug CONFIG+=c++11
14:25:23: The process "/Users/m/Qt5.2.1/5.2.1/clang_64/bin/qmake" exited normally.
14:25:23: Starting: "/usr/bin/make"
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -c -pipe -g -gdwarf-2 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -mmacosx-version-min=10.7 -Wall -W -fPIE -DQT_QML_DEBUG -DQT_DECLARATIVE_DEBUG -DQT_OPENGL_LIB -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB -I/Users/m/Qt5.2.1/5.2.1/clang_64/mkspecs/macx-clang -I../shelly -I/Users/m/Qt5.2.1/5.2.1/clang_64/lib/QtOpenGL.framework/Versions/5/Headers -I/Users/m/Qt5.2.1/5.2.1/clang_64/lib/QtWidgets.framework/Versions/5/Headers -I/Users/m/Qt5.2.1/5.2.1/clang_64/lib/QtGui.framework/Versions/5/Headers -I/Users/m/Qt5.2.1/5.2.1/clang_64/lib/QtCore.framework/Versions/5/Headers -I. -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/OpenGL.framework/Versions/A/Headers -I/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk/System/Library/Frameworks/AGL.framework/Headers -I. -I. -F/Users/m/Qt5.2.1/5.2.1/clang_64/lib -o datainterval.o ../shelly/core/datainterval.c++
In file included from ../shelly/core/datainterval.c++:5:
In file included from ../shelly/core/datainterval.h++:9:
../shelly/core/datatime.h++:9:10: fatal error: 'cstdint' file not found
#include <cstdint> // GPL w/runtime exception
^
1 error generated.
make: *** [datainterval.o] Error 1
14:25:24: The process "/usr/bin/make" exited with code 2.
Error while building/deploying project shelly (kit: Desktop Qt 5.2.1 clang 64bit)
When executing step 'Make'
14:25:24: Elapsed time: 00:01.
Update:
Have made an 'minimal recreate' of my problem;
Create a new project, a “Qt Widgets Application”.
Leave everything at its defaults except for the path.
In the created file mainwindow.c++, add the cstdint include statement:
Try to build it (it fails as above)
Add in “Projects” -> “Build & Run” -> “Build Steps” -> “Additional arguments”
CONFIG+=c++11
The “Effective qmake call” line then reads
qmake /Users/m/Documents/ProgrammeringOSX/testC11/testC11.pro -r -spec macx-clang CONFIG+=debug CONFIG+=x86_64 CONFIG+=declarative_debug CONFIG+=qml_debug CONFIG+=c++11
…and the error is still there.
:(
I have the same setup as you, and have used c++11 features after updating the project .pro file with the following line:
CONFIG += c++11
However, I think your solution should accomplish the same thing, so it may be an external configuration issue. I wasn't able to reproduce the error when I included the header file.
Ok,
I seem to have “fixed” it… I got to the point that I was randomly changing parameters just to see what effect it had and all of a sudden this did it:
QMAKE_MACOSX_DEPLOYMENT_TARGET=10.9
(doesn’t matter if I set it in the .pro file or in the GUI)
If I added CONFIG+=c++11, the target was set to 10.7, without it 10.6, so this forces it to 10.9 (tried 10.8 as well, but nope; 10.9 it is).
A funny thing is that I do not need to add CONFIG+=c++11 in the “minimum recreation” version… I guess I will get to that point if I actually add any C++11 code. But baby steps, baby steps!
Another funny thing is that when I changed the target to 10.9, THEN my bogus QMAKE_CXXFLAGS parameters were added and the clang call failed (I guess it heeded my ‘pleaseFailNow’ parameter).
Thank you for your help!
Cheers
/ Daniel

OSX 10.7.4 w/XCode 4.4.1 & GCC (Issues w/compiling straight C/C++)

The issue I'm having is that gcc (and family) don't appear to be properly setup. I have a 10.7.4 machine that I just installed Xcode on (from the app store). I've done no prior development on this machine.
Working w/in Xcode seems to work fine. I can build and compile no problem. However, trying to execute gcc command line fails.
First, I gcc wasn't on my path ... no big deal. I located it and ran as:
/Applications/Xcode.app/Contents/Developer/usr/bin/gcc -dynamiclib -fno-common -o s.dylib s.c
(I'm working on a lib w/some functions...). Anyways, it fails.
s.c:1:19: error: stdio.h: No such file or directory
s.c:2:20: error: stdlib.h: No such file or directory
s.c:3:20: error: string.h: No such file or directory
Surprise! hah, well I searched my machine for stdio.h and I can't find it anywhere. Since I've been out of the OSX game for a bit, I'm assuming I'm missing something -
Basically I want to be able to continue using Xcode but I want to be able to build C/C++/etc on the command line with all the dependencies (.h) in the correct place.
Any thoughts?
There are two main ways to run the compiler from the command line: the Command Line Tools package, and xcrun.
xcrun is particularly good if you just need this occasionally. Just stick "xcrun" at the start, like you'd do with sudo:
xcrun gcc -dynamiclib -fno-common -o s.dylib s.c
This will find the correct version of gcc and set the needed directories, etc. You can specify a specific SDK with --sdk.
If you do this a lot, download and install the Command Line Tools package (Xcode>Open Developer Tool>More Tools...; it also may be available in Preferences>Downloads). This installs a full copy of everything in /usr.
Probably xcrun is not enough if you are using 10.8.
Looking in to the clang documentation I found that you need to include the system root because you do not have your libraries in the standard place but inside Xcode.
using:
xcrun gcc -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk
or:
xcrun clang -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk

Error when building using xcodebuild

I have an xcode Objective-C iPhone static library project. When I build it in xcode I get no errors or warnings. But when I build it using xcodebuild from the command line I get:
"/Developer/usr/bin/gcc" -v -dM -isysroot /Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS3.2.sdk -E -arch armv6 -o - -x objective-c /dev/null
gcc-4.2: error trying to exec '/Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1': execvp: No such file or directory
I cannot find anything that helps me to understand what the issue is, any ideas?
And yes the /Developer/usr/bin/arm-apple-darwin10-gcc-4.2.1 file does exist :-)
For some reason what seemed to fix this for me is actually passing in the architectures to be used.
For instance, this command fails:
/Developer-SDK4/usr/bin/xcodebuild -target ProjectName -configuration Release build PLATFORM_NAME=iphonesimulator BUILDSDK=/Developer-SDK4
But this one works:
/Developer-SDK4/usr/bin/xcodebuild -target ProjectName -configuration Release build PLATFORM_NAME=iphonesimulator BUILDSDK=/Developer-SDK4 ARCHS=i386
Note, this only failed for me when building against the simulator. Building against the device seemed to work just fine.

Resources