Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Strange issue with compilation and iOS Simulator #1276

Closed
acavestro opened this issue Aug 21, 2014 · 16 comments
Closed

Strange issue with compilation and iOS Simulator #1276

acavestro opened this issue Aug 21, 2014 · 16 comments

Comments

@acavestro
Copy link

Hi,
I'm trying to learn HaxeFlixel with the fabulous tutorial on HF website. It compiles without problems on Flash, Windows, Mac and Android.

The first time I tried to compile it for iOS with lime test ios - simulator, I got a strange error message that said something like "Can't find asset/ directory". I googled a bit and I find out a fix that could probably work. I edit my AssetPaths.hx from:

 @:build(flixel.system.FlxAssets.buildFileReferences("assets", true))

to

#if ios
    @:build(flixel.system.FlxAssets.buildFileReferences("../assets", true))
#else
    @:build(flixel.system.FlxAssets.buildFileReferences("assets", true))
#end

I tried again and this time the compilation was successful but when iOS Simulator started and I clicked on "Play", app crashed with this message:

Assets.hx:547: [openfl.Assets] There is no String asset with an ID of      "../assets/assets/data/level_001.oel"

I googled another bit but this time I didn't find a solution.

  • XCode 5.1.1 with iOS Simulator 7.1 (with command line tools)
  • haxelib and all the packages are update
  • lime update ios and xcode compilation failed

Thanks in advance

Antonio

@Gama11
Copy link
Member

Gama11 commented Aug 21, 2014

You don't technically need the AssetPaths macro, it's just for convenience - the string path to the asset will do just fine.

I'm not sure why "assets" as a parameter is causing an error. Is this issue exclusive to the iOS simulator?

@acavestro
Copy link
Author

Thanks for you answer :)

Well, I've restored AssetPaths to original version and I've tried to compile with "lime test ios": it can't find asset directory again. This is the full log:

macbook:project user$ lime test ios
Build settings from command line:
    PLATFORM_NAME = iphoneos
    SDKROOT = iphoneos7.1

=== BUILD LEGACY TARGET Build Haxe OF PROJECT Project WITH CONFIGURATION Release ===

Check dependencies

ExternalBuildToolExecution Build\ Haxe
    cd /Users/user/project/export/ios/Project/haxe
    export ACTION=
    export ALTERNATE_GROUP=staff
    export ALTERNATE_MODE=u+w,go-w,a+rX
    export ALTERNATE_OWNER=user
    export ALWAYS_SEARCH_USER_PATHS=NO
    export APPLE_INTERNAL_DEVELOPER_DIR=/AppleInternal/Developer
    export APPLE_INTERNAL_DIR=/AppleInternal
    export APPLE_INTERNAL_DOCUMENTATION_DIR=/AppleInternal/Documentation
    export APPLE_INTERNAL_LIBRARY_DIR=/AppleInternal/Library
    export APPLE_INTERNAL_TOOLS=/AppleInternal/Developer/Tools
    export APPLY_RULES_IN_COPY_FILES=NO
    export ARCHS=armv7
    export AVAILABLE_PLATFORMS="iphonesimulator macosx iphoneos"
    export BUILD_COMPONENTS="headers build"
    export BUILD_DIR=/Users/user/project/export/ios/build
    export BUILD_ROOT=/Users/user/project/export/ios/build
    export BUILD_STYLE=
    export BUILD_VARIANTS=normal
    export BUILT_PRODUCTS_DIR=/Users/user/project/export/ios/build/Release-iphoneos
    export CACHE_ROOT=/var/folders/3w/ls7c73m96w958rp5n94mdrc80000gp/C/com.apple.DeveloperTools/5.1.1-5B1008/Xcode
    export CLANG_CXX_LANGUAGE_STANDARD=gnu++0x
    export CLANG_ENABLE_OBJC_ARC=YES
    export CLANG_WARN__DUPLICATE_METHOD_MATCH=YES
    export CLASS_FILE_DIR="/Users/user/project/export/ios/build/Project.build/Release-iphoneos/Build Haxe.build/JavaClasses"
    export CLONE_HEADERS=NO
    export CODE_SIGNING_ALLOWED=NO
    export CODE_SIGN_IDENTITY="iPhone Developer"
    export COLOR_DIAGNOSTICS=YES
    export CONFIGURATION=Release
    export CONFIGURATION_BUILD_DIR=/Users/user/project/export/ios/build/Release-iphoneos
    export CONFIGURATION_TEMP_DIR=/Users/user/project/export/ios/build/Project.build/Release-iphoneos
    export COPYING_PRESERVES_HFS_DATA=NO
    export COPY_PHASE_STRIP=YES
    export CREATE_INFOPLIST_SECTION_IN_BINARY=NO
    export DEAD_CODE_STRIPPING=YES
    export DEBUGGING_SYMBOLS=YES
    export DEBUG_INFORMATION_FORMAT=dwarf-with-dsym
    export DEFAULT_COMPILER=com.apple.compilers.llvm.clang.1_0
    export DEFAULT_KEXT_INSTALL_PATH=/System/Library/Extensions
    export DEPLOYMENT_LOCATION=NO
    export DEPLOYMENT_POSTPROCESSING=NO
    export DERIVED_FILES_DIR=
    export DERIVED_FILE_DIR="/Users/user/project/export/ios/build/Project.build/Release-iphoneos/Build Haxe.build/DerivedSources"
    export DERIVED_SOURCES_DIR="/Users/user/project/export/ios/build/Project.build/Release-iphoneos/Build Haxe.build/DerivedSources"
    export DEVELOPER_APPLICATIONS_DIR=/Applications/Xcode.app/Contents/Developer/Applications
    export DEVELOPER_BIN_DIR=/Applications/Xcode.app/Contents/Developer/usr/bin
    export DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
    export DEVELOPER_FRAMEWORKS_DIR=/Applications/Xcode.app/Contents/Developer/Library/Frameworks
    export DEVELOPER_FRAMEWORKS_DIR_QUOTED=/Applications/Xcode.app/Contents/Developer/Library/Frameworks
    export DEVELOPER_LIBRARY_DIR=/Applications/Xcode.app/Contents/Developer/Library
    export DEVELOPER_SDK_DIR=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs
    export DEVELOPER_TOOLS_DIR=/Applications/Xcode.app/Contents/Developer/Tools
    export DEVELOPER_USR_DIR=/Applications/Xcode.app/Contents/Developer/usr
    export DEVELOPMENT_LANGUAGE=English
    export DO_HEADER_SCANNING_IN_JAM=NO
    export DSTROOT=/tmp/Project.dst
    export DT_TOOLCHAIN_DIR=/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain
    export DWARF_DSYM_FILE_NAME=.dSYM
    export DWARF_DSYM_FILE_SHOULD_ACCOMPANY_PRODUCT=NO
    export DWARF_DSYM_FOLDER_PATH=/Users/user/project/export/ios/build/Release-iphoneos
    export EMBEDDED_PROFILE_NAME=embedded.mobileprovision
    export ENABLE_HEADER_DEPENDENCIES=YES
    export EXCLUDED_INSTALLSRC_SUBDIRECTORY_PATTERNS=".DS_Store .svn .git .hg CVS"
    export EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES="*.nib *.lproj *.framework *.gch *.xcode* (*) .DS_Store CVS .svn .git .hg"
    export FILE_LIST="/Users/user/project/export/ios/build/Project.build/Release-iphoneos/Build Haxe.build/Objects/LinkFileList"
    export FRAMEWORK_VERSION=A
    export GCC3_VERSION=3.3
    export GCC_C_LANGUAGE_STANDARD=gnu99
    export GCC_VERSION=com.apple.compilers.llvm.clang.1_0
    export GCC_WARN_ABOUT_RETURN_TYPE=YES
    export GCC_WARN_UNINITIALIZED_AUTOS=YES
    export GCC_WARN_UNUSED_VARIABLE=YES
    export GENERATE_MASTER_OBJECT_FILE=NO
    export GENERATE_PKGINFO_FILE=NO
    export GID=20
    export GROUP=staff
    export HEADERMAP_INCLUDES_FLAT_ENTRIES_FOR_TARGET_BEING_BUILT=YES
    export HEADERMAP_INCLUDES_FRAMEWORK_ENTRIES_FOR_ALL_PRODUCT_TYPES=YES
    export HEADERMAP_INCLUDES_NONPUBLIC_NONPRIVATE_HEADERS=YES
    export HEADERMAP_INCLUDES_PROJECT_HEADERS=YES
    export HEADER_SEARCH_PATHS=" /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include"
    export INFOPLIST_EXPAND_BUILD_SETTINGS=YES
    export INFOPLIST_OUTPUT_FORMAT=binary
    export INFOPLIST_PREPROCESS=NO
    export INSTALL_DIR=/tmp/Project.dst
    export INSTALL_GROUP=staff
    export INSTALL_MODE_FLAG=u+w,go-w,a+rX
    export INSTALL_OWNER=user
    export INSTALL_ROOT=/tmp/Project.dst
    export IPHONEOS_DEPLOYMENT_TARGET=5
    export JAVA_APP_STUB=/System/Library/Frameworks/JavaVM.framework/Resources/MacOS/JavaApplicationStub
    export JAVA_ARCHIVE_CLASSES=YES
    export JAVA_ARCHIVE_TYPE=JAR
    export JAVA_COMPILER=/usr/bin/javac
    export JAVA_FRAMEWORK_RESOURCES_DIRS=Resources
    export JAVA_JAR_FLAGS=cv
    export JAVA_SOURCE_SUBDIR=.
    export JAVA_USE_DEPENDENCIES=YES
    export JAVA_ZIP_FLAGS=-urg
    export KEEP_PRIVATE_EXTERNS=NO
    export LD_DEPENDENCY_INFO_FILE=//_dependency_info.dat
    export LD_GENERATE_MAP_FILE=NO
    export LD_MAP_FILE_PATH="/Users/user/project/export/ios/build/Project.build/Release-iphoneos/Build Haxe.build/-LinkMap--.txt"
    export LD_NO_PIE=NO
    export LD_QUOTE_LINKER_ARGUMENTS_FOR_COMPILER_DRIVER=YES
    export LEGACY_DEVELOPER_DIR=/Applications/Xcode.app/Contents/PlugIns/Xcode3Core.ideplugin/Contents/SharedSupport/Developer
    export LIBRARY_FLAG_NOSPACE=YES
    export LIBRARY_KEXT_INSTALL_PATH=/Library/Extensions
    export LINKER_DISPLAYS_MANGLED_NAMES=NO
    export LINK_WITH_STANDARD_LIBRARIES=YES
    export LOCAL_ADMIN_APPS_DIR=/Applications/Utilities
    export LOCAL_APPS_DIR=/Applications
    export LOCAL_DEVELOPER_DIR=/Library/Developer
    export LOCAL_LIBRARY_DIR=/Library
    export MAC_OS_X_PRODUCT_BUILD_VERSION=13E28
    export MAC_OS_X_VERSION_ACTUAL=1094
    export MAC_OS_X_VERSION_MAJOR=1090
    export MAC_OS_X_VERSION_MINOR=0904
    export OBJECT_FILE_DIR="/Users/user/project/export/ios/build/Project.build/Release-iphoneos/Build Haxe.build/Objects"
    export OBJROOT=/Users/user/project/export/ios/build
    export ONLY_ACTIVE_ARCH=NO
    export OPTIMIZATION_LEVEL=0
    export OS=MACOS
    export OTHER_CFLAGS=-DNS_BLOCK_ASSERTIONS=1
    export OTHER_CPLUSPLUSFLAGS=-DNS_BLOCK_ASSERTIONS=1
    export PATH="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin:/Applications/Xcode.app/Contents/Developer/usr/bin:/usr/local/mysql/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/opt/X11/bin:/usr/local/git/bin:/usr/texbin"
    export PATH_PREFIXES_EXCLUDED_FROM_HEADER_DEPENDENCIES="/usr/include /usr/local/include /System/Library/Frameworks /System/Library/PrivateFrameworks /Applications/Xcode.app/Contents/Developer/Headers /Applications/Xcode.app/Contents/Developer/SDKs /Applications/Xcode.app/Contents/Developer/Platforms"
    export PLATFORM_NAME=iphoneos
    export PLIST_FILE_OUTPUT_FORMAT=binary
    export PRECOMPS_INCLUDE_HEADERS_FROM_BUILT_PRODUCTS_DIR=YES
    export PRECOMP_DESTINATION_DIR="/Users/user/project/export/ios/build/Project.build/Release-iphoneos/Build Haxe.build/PrefixHeaders"
    export PRESERVE_DEAD_CODE_INITS_AND_TERMS=NO
    export PRODUCT_NAME=
    export PROFILING_CODE=NO
    export PROJECT=Project
    export PROJECT_DERIVED_FILE_DIR=/Users/user/project/export/ios/build/Project.build/DerivedSources
    export PROJECT_DIR=/Users/user/project/export/ios
    export PROJECT_FILE_PATH=/Users/user/project/export/ios/Project.xcodeproj
    export PROJECT_NAME=Project
    export PROJECT_TEMP_DIR=/Users/user/project/export/ios/build/Project.build
    export PROJECT_TEMP_ROOT=/Users/user/project/export/ios/build
    export REMOVE_CVS_FROM_RESOURCES=YES
    export REMOVE_GIT_FROM_RESOURCES=YES
    export REMOVE_HG_FROM_RESOURCES=YES
    export REMOVE_SVN_FROM_RESOURCES=YES
    export SCAN_ALL_SOURCE_FILES_FOR_INCLUDES=NO
    export SDKROOT=/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS7.1.sdk
    export SEPARATE_STRIP=NO
    export SEPARATE_SYMBOL_EDIT=NO
    export SHARED_DERIVED_FILE_DIR=/Users/user/project/export/ios/build/Release-iphoneos/DerivedSources
    export SHARED_PRECOMPS_DIR=/var/folders/3w/ls7c73m96w958rp5n94mdrc80000gp/C/com.apple.DeveloperTools/5.1.1-5B1008/Xcode/SharedPrecompiledHeaders
    export SKIP_INSTALL=YES
    export SOURCE_ROOT=/Users/user/project/export/ios
    export SRCROOT=/Users/user/project/export/ios
    export STRINGS_FILE_OUTPUT_ENCODING=binary
    export STRIP_INSTALLED_PRODUCT=YES
    export STRIP_STYLE=all
    export SUPPORTED_PLATFORMS="iphonesimulator iphoneos"
    export SYMROOT=/Users/user/project/export/ios/build
    export SYSTEM_ADMIN_APPS_DIR=/Applications/Utilities
    export SYSTEM_APPS_DIR=/Applications
    export SYSTEM_CORE_SERVICES_DIR=/System/Library/CoreServices
    export SYSTEM_DEMOS_DIR=/Applications/Extras
    export SYSTEM_DEVELOPER_APPS_DIR=/Applications/Xcode.app/Contents/Developer/Applications
    export SYSTEM_DEVELOPER_BIN_DIR=/Applications/Xcode.app/Contents/Developer/usr/bin
    export SYSTEM_DEVELOPER_DEMOS_DIR="/Applications/Xcode.app/Contents/Developer/Applications/Utilities/Built Examples"
    export SYSTEM_DEVELOPER_DIR=/Applications/Xcode.app/Contents/Developer
    export SYSTEM_DEVELOPER_DOC_DIR="/Applications/Xcode.app/Contents/Developer/ADC Reference Library"
    export SYSTEM_DEVELOPER_GRAPHICS_TOOLS_DIR="/Applications/Xcode.app/Contents/Developer/Applications/Graphics Tools"
    export SYSTEM_DEVELOPER_JAVA_TOOLS_DIR="/Applications/Xcode.app/Contents/Developer/Applications/Java Tools"
    export SYSTEM_DEVELOPER_PERFORMANCE_TOOLS_DIR="/Applications/Xcode.app/Contents/Developer/Applications/Performance Tools"
    export SYSTEM_DEVELOPER_RELEASENOTES_DIR="/Applications/Xcode.app/Contents/Developer/ADC Reference Library/releasenotes"
    export SYSTEM_DEVELOPER_TOOLS=/Applications/Xcode.app/Contents/Developer/Tools
    export SYSTEM_DEVELOPER_TOOLS_DOC_DIR="/Applications/Xcode.app/Contents/Developer/ADC Reference Library/documentation/DeveloperTools"
    export SYSTEM_DEVELOPER_TOOLS_RELEASENOTES_DIR="/Applications/Xcode.app/Contents/Developer/ADC Reference Library/releasenotes/DeveloperTools"
    export SYSTEM_DEVELOPER_USR_DIR=/Applications/Xcode.app/Contents/Developer/usr
    export SYSTEM_DEVELOPER_UTILITIES_DIR=/Applications/Xcode.app/Contents/Developer/Applications/Utilities
    export SYSTEM_DOCUMENTATION_DIR=/Library/Documentation
    export SYSTEM_KEXT_INSTALL_PATH=/System/Library/Extensions
    export SYSTEM_LIBRARY_DIR=/System/Library
    export TARGETED_DEVICE_FAMILY=1,2
    export TARGETNAME="Build Haxe"
    export TARGET_BUILD_DIR=/Users/user/project/export/ios/build/Release-iphoneos
    export TARGET_NAME="Build Haxe"
    export TARGET_TEMP_DIR="/Users/user/project/export/ios/build/Project.build/Release-iphoneos/Build Haxe.build"
    export TEMP_DIR="/Users/user/project/export/ios/build/Project.build/Release-iphoneos/Build Haxe.build"
    export TEMP_FILES_DIR=
    export TEMP_FILE_DIR="/Users/user/project/export/ios/build/Project.build/Release-iphoneos/Build Haxe.build"
    export TEMP_ROOT=/Users/user/project/export/ios/build
    export TOOLCHAINS=com.apple.dt.toolchain.iOS7_1
    export UID=502
    export USER=user
    export USER_APPS_DIR=/Users/user/Applications
    export USER_LIBRARY_DIR=/Users/user/Library
    export VALIDATE_PRODUCT=YES
    export VALID_ARCHS="armv7 i386"
    export XCODE_APP_SUPPORT_DIR=/Applications/Xcode.app/Contents/Developer/Library/Xcode
    export XCODE_PRODUCT_BUILD_VERSION=5B1008
    export XCODE_VERSION_ACTUAL=0511
    export XCODE_VERSION_MAJOR=0500
    export XCODE_VERSION_MINOR=0510
    export ZERO_LINK=NO
    export arch=armv7
    export diagnostic_message_length=80
    export variant=normal
    /Applications/Xcode.app/Contents/Developer/usr/bin/make
Haxe armv7 build CONFIG : Release-iphoneos
haxe Build.hxml -D HXCPP_ARMV7 -cpp build/Release-iphoneos 
/usr/lib/haxe/std/neko/_std/sys/FileSystem.hx:85: characters 27-57 : assets/: No such file or directory
/usr/lib/haxe/flixel/3,3,5/flixel/system/FlxAssets.hx:72: characters 22-57 : Called from
/usr/lib/haxe/flixel/3,3,5/flixel/system/FlxAssets.hx:52: characters 44-106 : Called from
../../../../source/AssetPaths.hx:4: characters 3-8 : Called from
Aborted
make: *** [build-haxe-armv7] Error 1package;

Unfortunately, I haven't an Apple Developer Certificate, so, even if the compilation succeeds, I won't be able to sign the app, test it in a phone and verify it doesn't crash at runtime.

@modjke
Copy link
Contributor

modjke commented Sep 10, 2014

Aaaaaand it's time for a dirty hax (pun intended).
This trouble has to be settled with Context.resolvePath, but there some crazy stuff going while targeting ios, so where is no other way than using workaround.
Here it is, replace original FlxAssets.hx with it.
https://gist.github.com/modjke/263de43baf224e83056e

@Gama11
Copy link
Member

Gama11 commented Sep 10, 2014

The only change there is this?

#if ios
    directory = "../" + directory;
#end

What about mac builds?

@acavestro
Copy link
Author

Well, actually that FlxAssets.hx works! Thanks, you save my life 👍

Mac builds work, I've just tried.

@modjke
Copy link
Contributor

modjke commented Sep 10, 2014

@Gama11
mac builds are fine for me, no issues related to invalid assets paths.
Changes are
#if ios
directory = "../" + directory;
#end

and line 67
kind: FieldType.FVar(macro:String, macro $v{
#if ios
fileRef.value.substr(directory.length)
#else
fileRef.value
#end
}),

@Gama11
Copy link
Member

Gama11 commented Sep 10, 2014

@acavestro Cool, I'm gonna commit these fixes then. Can't test this myself unfortunately.

@modjke Any idea why these are necessary? Especially the substr()-thing seems weird.

@Gama11
Copy link
Member

Gama11 commented Sep 10, 2014

f5f26b1

@Gama11 Gama11 closed this as completed Sep 10, 2014
@modjke
Copy link
Contributor

modjke commented Sep 10, 2014

@Gama11
The thing is, it's a dirty way of fixing it, i'm sure there are better fixes for that case.
Typically, you just need Context.reslovePath for any path that get processed within macro,
but for this particular case Context.resolvePath('assets') returns ../../../../assets/ and this screws up
things even more.
So long story short, firstly i add ../ to make a valid path, and then remove first part of path to make valid references in a bundle.
I will try to do it in a less 'hacky' way, when it's done i'll update my gist and post an update here.

@Gama11
Copy link
Member

Gama11 commented Sep 10, 2014

Wondering if @jgranick has any insight on why this is necessary for iOS builds.

@modjke
Copy link
Contributor

modjke commented Sep 10, 2014

@Gama11 @acavestro
Here ya go, gist updated with a less hacky workaround that deals with
current directory issue on ios build.
https://gist.github.com/modjke/263de43baf224e83056e
Also, i highly recommend sticking with the lastest version.

@Gama11
Copy link
Member

Gama11 commented Sep 10, 2014

@modjke Is there any need to conditionalize the Context.resolvePath()-call?

@modjke
Copy link
Contributor

modjke commented Sep 10, 2014

@Gama11 yes, i'm not sure why, but for any other build target Context.resolvePath() returns an invalid path and resulting AssetPaths remains empty.

@Gama11
Copy link
Member

Gama11 commented Sep 10, 2014

Hm, ok... Wanna open a pull request with the improved verison?

@modjke
Copy link
Contributor

modjke commented Sep 10, 2014

@Gama11 Sure, why not, give me a minute or two, i'm kinda new to github :)

@modjke
Copy link
Contributor

modjke commented Sep 10, 2014

@Gama11 i did it #1294

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants