Xcode Error : No such file or directory when building - ios

I've read similar threads but wasn't able to find a solution to my issue.
When I start my project, I first saved it in a folder with blank space in its name (let name it "My Project")
Lets also simplify the path through my project as a simple folder : "My path" (yes, there was blank spaces in the hierarchy).
I used to have issues while building my project, especially with the Library search path in Build settings, regularly coming back with xcode updates or/and duplication of project for keeping a historical.
To solved that, I've replaced all the blank spaces with underscores. So now my project's folder name is "My_Project" and the path "My_path".
These changes have also been performed in the Build Settings of my project.
But today, I have an error I can't get rid of.
When I build my project, every file compile perfectly, but during the "copying" process, I get this kind of error.
/!\Copy AFNetworking ...in /Users/admin/Desktop/My_path/My Project/Product-name/Sub Folder
CpResource /Users/admin/Desktop/My_path/My\ Project/Product-name/Sub\ Folder/AFNetworking /Users/admin/Library/Developer/Xcode/DerivedData/Product-name-gkplyeugxcxhijajdvpxutaodxmz/Build/Products/Release-iphoneos/Product-name.app/AFNetworking
cd /Users/admin/Desktop/My_path/My_Project/Product-name
export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin"
builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -strip-debug-symbols -strip-tool /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/strip -resolve-src-symlinks /Users/admin/Desktop/My_path/My\ Project/Product-name/Sub\ Folder/AFNetworking /Users/admin/Library/Developer/Xcode/DerivedData/Product-name-gkplyeugxcxhijajdvpxutaodxmz/Build/Products/Release-iphoneos/Product-name.app
-------------------------------------
error: /Users/admin/Desktop/My_path/My Project/Product-name/Sub Folder/AFNetworking: No such file or directory
I don't find in my target's Build Settings any field where blank spaces haven't been replaced by underscores.
Any help appreciated.
(I'm using Xcode 7.2, OS X El Capitan 10.11.2)

I finally find somewhat by chance an answer to my problem.
I've opened the .xcodeproj file in finder, and then edit project.pbxproj.
In this file, I've founded a line :
84635D6F1C22F90100C55AB2 /* AFNetworking */ = {isa = PBXFileReference; lastKnownFileType = folder; name = AFNetworking; path = "/Users/admin/Desktop/My_path/My Project/Product-name/Sub Folder/AFNetworking"; sourceTree = "<absolute>"; };
And retyping it properly made the trick.

This medium post helped me: https://freakycoder.com/ios-notes-47-how-to-solve-xcode-no-such-file-or-directory-error-514106eaf287
Needed to remove the resource under Copy Bundle Resource during the Build Phase

Related

Why have I errors when installing from Luarocks?

I am the developer of this small library: https://github.com/martin-damien/babel and I have a problem with Luarocks releases.
From source
When I install from source with Luarocks I have no problem:
$ luarocks make --local rockspecs/babel-1.2-2.rockspec
From internet
But when deployed (using: tag master, add new rockspec release and publish to Luarocks), I can't install using
$ luarocks install --local babel
Because I encounter the following error:
Installing https://luarocks.org/babel-1.2-2.src.rock...
Using https://luarocks.org/babel-1.2-2.src.rock... switching to 'build' > mode
stat: malsukcesis eltrovi statinformon pri «locales/zh-HK.lua»: No such > file or directory
Error: Build error: Failed installing locales/zh-HK.lua in /home/damien/.luarocks/lib/luarocks/rocks/babel/1.2-2/lua/locales/zh-HK.lua: locales/zh-HK.lua: No such file or directory
As you can see in https://github.com/martin-damien/babel/issues/14 the error occure on different files (but until now, only with locale files, not with the babel.lua file).
I have no idea why it randomly crash like this, so if someone know why or have an idea from where it could come from...
Thanks in advance,
Damien
The location of the files in the build.modules table is (from the docs on the rockspec format):
relative to source.dir
Where source.dir is
source.dir (string) - the name of the directory created when the source archive is unpacked. Can be omitted if it can be inferred from the source.file field. Example: "luasocket-2.0.1"
and source.file is
source.file (string) - the filename of the source archive. Can be omitted if it can be inferred from the source.url field. Example: "luasocket-2.0.1.tar.gz"
You don't specify source.dir or source.file in your rockspec but you do set source.url (because you have to).
So you have source.url = https://github.com/martin-damien/babel/archive/v1.2-2.zip which (presumably) ends up with source.file = v1.2-2.zip and then source.dir = v1.2-2 but your zip file extracts into a babel-1.2 so luarocks can't find your source files. (The screenshot in the linked issue seems to indicate that luarocks uses source.file = v1.2.zip and the archive extracts to babel-1.2 but I'm not sure how that's possible.)
Add dir = "babel-1.2" to your rockspec's source table an I expect it will work.

Fixing nested Base.lproj/Base.lproj made new files unlocalizable

I have a strange nested Base.lproj situation, where my filesystem looks like this:
ProjectName
Base.lproj
Authentication.storyboard
SidebarViewController.xib
Base.lproj // <-- What?????
LoginViewController.xib
en-US.lproj // <-- What????
LoginViewController.strings
SidebarViewController.strings
en-US.lproj
Authentication.strings
When I copied LoginViewController.xib into the top-level Base.lproj and unchecked/rechecked the English checkbox on SidebarViewController.xib, I can delete the nested Base and en-US folders and build successfully.
It's fixed! But wait...
I create a new file (e.g. Dummy.storyboard), it is added to the correct folder:
ProjectName
Base.lproj
Authentication.storyboard
SidebarViewController.xib
LoginViewController.xib
Dummy.storyboard
en-US.lproj
Authentication.strings
LoginViewController.strings
SidebarViewController.strings
BUT when I check English in the Localization section, I get this error:
The file path ~/project_ios.git/ProjectName/ProjectName/en.lproj/Dummy.storyboard is invalid. The expected prefix is ~/project_ios.git/ProjectName/ProjectName/Base.lproj
What am I missing? I cleaned the build, deleted Xcode's DerivedData directory, and intermediate build projects directory, and nothing is making a difference.

XCode 4 - libsqlite3.dylib: No such file or directory

I am trying to compile a iOS application that uses SQlite in Xcode 4 (for Snow Leopard) and I am getting the following error -
error: /Apps/Cocktails/libsqlite3.dylib: No such file or directory
I copied the file libsqlite3.dylib into the Xcode project but the error won't go away. How do I resolve the error ?
EDIT - Here is the complete error log
CpResource libsqlite3.0.dylib /Users/ashishagarwal/Library/Developer/Xcode/DerivedData/Cocktails-gzqdmwrvzqciekgjzxnriugcxwwm/Build/Products/Debug-iphonesimulator/Cocktails.app/libsqlite3.0.dylib
cd /Apps/Cocktails
setenv PATH "/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin:/Developer/usr/bin:/usr/bin:/bin:/usr/sbin:/sbin"
builtin-copy -exclude .DS_Store -exclude CVS -exclude .svn -exclude .git -exclude .hg -resolve-src-symlinks /Apps/Cocktails/libsqlite3.0.dylib /Users/ashishagarwal/Library/Developer/Xcode/DerivedData/Cocktails-gzqdmwrvzqciekgjzxnriugcxwwm/Build/Products/Debug-iphonesimulator/Cocktails.app
error: /Apps/Cocktails/libsqlite3.dylib: No such file or directory
It looks your library is missing libsqlite3.dylib and
libsqlite3.0.dylib, so copy these files from any other computer and place these files in your computer.
Procedure:
1:Open xcode on the computer where these files exists, add libsqlite3.0.dylib in your project from link binary with libraries.
2: Right click on the libsqlite3.0.dylib and show in finder.
3: Copy two files libsqlite3.0.dylib and libsqlite3.dylib and place on the same location on other computer where these files are missing.
Here you go, I had the same problem and solved in this way.

How to Integrate Qt4 qm files into binary using cmake and QRC?

I have a Qt4 CMake project and I'd like to integrate the QM files for i18n into the output binary. These are the rules I have so far for generating the TS and QM files:
set(myapp_TRANSLATIONS
i18n/myapp_de.ts
)
set(FILES_TO_TRANSLATE
${myapp_SRCS}
${myapp_MOC_HDRS}
)
QT4_CREATE_TRANSLATION(QM_FILES ${FILES_TO_TRANSLATE} ${myapp_TRANSLATIONS})
QT4_ADD_TRANSLATION(QM ${myapp_TRANSLATIONS})
I tried the following to add the QM files to the executable:
add_executable(myapp ${myapp_SRCS} ${myapp_MOC_SRCS} ${myapp_RCC_SRCS} ${QM})
This is the initialization from main.cpp:
QTranslator qtTranslator;
qtTranslator.load("qt_" + QLocale::system().name(), QLibraryInfo::location(QLibraryInfo::TranslationsPath));
app.installTranslator(&qtTranslator);
QTranslator appTranslator;
appTranslator.load("myapp_" + QLocale::system().name());
app.installTranslator(&appTranslator);
However, strings mypp shows that the translations are not going into the binary.
Update: I added each qm file to a i18n/translations.qrc:
<!DOCTYPE RCC><RCC version="1.0">
<qresource prefix="/resources">
<file>myapp_de.qm</file>
<file> ... .qm</file>
</qresource>
</RCC>
and using
QT4_ADD_RESOURCES(myapp_QM_RCC_SRCS i18n/translations.qrc)
and adding myapp_QM_RCC_SRCS to the executable dependencies.
But this fails during build time thanks to the fact that CMake does a shadow build (building outside the source dir) but parses the QRC files for dependencies expecting the referenced files relative to the QRC file (nice feature but there's no make rule how to build the QM file at that location). The QM files are in ${CMAKE_CURRENT_BINARY_DIR} (where they belong using shadow building) but expects it in ${CMAKE_CURRENT_SOURCE_DIR} (where non-generated files should be - so both locations would be correct, depending on situation).
I had the exact same problem. I came up with the following solution:
Create a QRC file that contains only the expected QM files, and give it a different prefix so it won't conflict with your other resources:
<RCC>
<qresource prefix="/translators">
<file>myapp_en.qm</file>
</qresource>
</RCC>
Add a CMake rule to copy the QRC file to the output directory and then another rule to run the resource compiler:
# Change 'myapp_en' to be the base file name of the qrc file.
SET( trans_file myapp_en )
SET( trans_srcfile ${CMAKE_CURRENT_SOURCE_DIR}/${trans_file}.qrc)
SET( trans_infile ${CMAKE_CURRENT_BINARY_DIR}/${trans_file}.qrc)
SET( trans_outfile ${CMAKE_CURRENT_BINARY_DIR}/qrc_${trans_file}.cxx)
# Copy the QRC file to the output directory, because the files listed in the
# qrc file are relative to that directory.
ADD_CUSTOM_COMMAND(
OUTPUT ${trans_infile}
COMMAND ${CMAKE_COMMAND} -E copy ${trans_srcfile} ${trans_infile}
MAIN_DEPENDENCY ${trans_srcfile}
)
# Run the resource compiler (rcc_options should already be set). We can't
# use QT4_ADD_RESOURCES because the qrc file may not exist yet.
ADD_CUSTOM_COMMAND(
OUTPUT ${trans_outfile}
COMMAND ${QT_RCC_EXECUTABLE}
ARGS ${rcc_options} -name ${trans_file} -o ${trans_outfile} ${trans_infile}
MAIN_DEPENDENCY ${trans_infile}
DEPENDS ${qm_files}
)
# Add compiled resources to executable dependency list
ADD_EXECUTABLE( ${APP_NAME} ... ${trans_outfile} )
Use ${Qt5Core_RCC_EXECUTABLE} instead of ${QT_RCC_EXECUTABLE} if you use Qt 5.
I have found a very simple way to do it in CMake 3.0 (and, maybe, earlier) without ADD_CUSTOM_COMMAND and other complications.
First, you should create a QRC file with all .qm files listed ( thanks, the_fly_123 ):
<RCC>
<qresource prefix="/translators">
<file>myapp_en.qm</file>
</qresource>
</RCC>
Then you can copy this QRC file into the output directory using configure_file and use standard Qt routines to build and add it:
# Change lang.qrc to the name of QRC file, created on the previous step
set(lang_qrc "lang.qrc")
configure_file(${lang_qrc} ${lang_qrc} COPYONLY)
qt5_add_translation(myapp_QM ${myapp_TRANSLATIONS})
qt5_add_resources(myapp_QM_RC ${CMAKE_CURRENT_BINARY_DIR}/${lang_qrc})
Then include ${myapp_QM_RC} in add_executable along with other sources.
Note: For Qt4 replace all qt5_ prefixes with qt4_
My solution is to generate ts.qrc XML file with compiled translations from scratch and then complie it with app.
Here is example:
file(GLOB QRC_FILES *.qrc)
file(GLOB TS_FILES ts/*.ts)
...
# Option for updating translations
option(UPDATE_TRANSLATIONS "Update source translation ts/*.ts files (WARNING: make clean will delete the source *.ts files. Danger!)" OFF)
if(UPDATE_TRANSLATIONS)
qt4_create_translation(QM_FILES ${TS_FILES})
endif()
...
# Compiling translations *.ts -> *.qm
qt4_add_translation(QM_FILES ${TS_FILES})
...
# Create translations QRC file - ts.qrc
set(TRANSLATIONS_QRC "${CMAKE_CURRENT_BINARY_DIR}/ts.qrc")
file(WRITE ${TRANSLATIONS_QRC} "<RCC>\n\t<qresource prefix=\"/ts\">")
foreach(QM_FILE ${QM_FILES})
get_filename_component(QM_FILE_NAME ${QM_FILE} NAME)
file(APPEND ${TRANSLATIONS_QRC} "\n\t\t<file alias=\"${QM_FILE_NAME}\">${QM_FILE_NAME}</file>")
endforeach()
file(APPEND ${TRANSLATIONS_QRC} "\n\t</qresource>\n</RCC>")
list(APPEND QRC_FILES ${TRANSLATIONS_QRC})
...
# Compiling *.qrc files
qt4_add_resources(QRC_SRCS ${QRC_FILES})
...
# Add compiled resources to executable dependency list
add_executable(${APP_NAME} ... ${QRC_SRCS})
File tree:
/ - source code root
/rc.qrc - contains app icons etc.
/ts/appname_*.ts - application translations
...
/build - build root
/build/appname_*.qm - compiled translations
/build/ts.qrc - translations rescources
/build/Release/qrc_rc.cxx - compiled icon etc. resources
/build/Release/qrc_ts.cxx - compiled translation resources
Files in ts dir initially generated by lupdate tool.
You need to use Qt resources system to include your translation directly into your application binary. Use QT4_ADD_RESOURCES macro to do this. There is some example how to use it: http://www.qtcentre.org/wiki/index.php?title=Compiling_Qt4_apps_with_CMake

scons: source directory does not get copied into build directory

Part of my build process is to create a tar file of an input directory, located at src/bundle/bundle. In src/bundle/SConscript:
Import('*')
bundleDir = Dir("bundle")
jsontar = Command("bundle.tar", bundleDir,
"/home/dbender/bin/mkvgconf $SOURCE $TARGET")
in my SConstruct:
SConscript(Split('src/bundle/SConscript'),
exports='bin_env lib_env', build_dir='tmp/bundle')
When attempting to build:
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
/home/dbender/bin/mkvgconf tmp/bundle/bundle tmp/bundle/bundle.tar
Input directory tmp/bundle/bundle not found!
scons: *** [tmp/bundle/bundle.tar] Error 1
scons: building terminated because of errors.
Clearly scons is not copying the src/bundle/bundle to tmp/bundle/bundle, but I am stumped as to why.
Footnotes:
Using absolute pathname for mkvgconf is bad practice but just intermediate until I have this problem solved.
SCons doesn't know anything about the contents of your input src/bundle/bundle - only the program mkvgconf knows what it does with that directory.
One solution is to add an explicit dependency in the SConscript:
import os
Depends('bundle.tar', Glob(str(bundleDir) + os.path.sep + '*'))
That also means that when you update the contents of the bundle directory, the mkvgconf script will be rerun.
PS. you might want to change the build_dir argument name to variant_dir, as the former is deprecated in favor of the latter in recent SCons releases.

Resources