Create Xcode project: does not compile

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
the7saint7
Newbie
Posts: 5
Joined: Sat Mar 20, 2021 5:44 pm
Contact:

Create Xcode project: does not compile

#1 Post by the7saint7 »

Using Renpy 7.4.4
xCode 12.4
I used the Tutorial example project -> IOS -> Create Xcode project
Once in Xcode, I used my Apple developer's account.

When I build, I get this error message:
Entry point (_main) undefined. for architecture arm64

I understand that this means a library was not build for arm64, but thats as far as I got.

I also checked the files in prebuilt/release and prebuilt/debug, using "lipo -info libSDL2main.a" and it does say that the library's architecture is arm64

I am lost at that point.

If anybody can help, I would greatly appreciate it.

Edit:
As mentioned lower, the issue is that there is no main function in the app. Adding one fixed the issue. The app now compiles.
But Xcode crashes when trying to run the app on a real device.
With error:
UNCAUGHT EXCEPTION (NSInvalidArgumentException): -[__NSCFNumber _getCString:maxLength:encoding:]: unrecognized selector sent to instance 0xdde7d0478177879b
I don't know why. I'm still trying stuff.

Edit 2:
Seems SDL is suposed to "remaps your main() function to the SDL_main() function with a function macro"
http://sdl.beuc.net/sdl.wiki/FAQ_MacOS_X_SDLMain.m

But: "You must include either SDLMain.m/.h or libSDLmain in your application, because this is the code that defines SDL's entry point. If you fail to do this, it is likely that "_main undefined" will be thrown by the linker."

Which is what's happening.
I doubled checked and the "library search path" is set correctly but it seems that while building, this lib search path is ignored maybe?
Last edited by the7saint7 on Tue Mar 23, 2021 8:18 pm, edited 2 times in total.

rayminator
Miko-Class Veteran
Posts: 793
Joined: Fri Feb 09, 2018 12:05 am
Location: Canada
Contact:

Re: Created Xcode project does not compile

#2 Post by rayminator »

Please post a full traceback and your code so members here can help you better as what is stated in the rules

the7saint7
Newbie
Posts: 5
Joined: Sat Mar 20, 2021 5:44 pm
Contact:

Re: Created Xcode project does not compile

#3 Post by the7saint7 »

Alright. Here is the full trace for the error:

Code: Select all

Ld /Users/dakia/Library/Developer/Xcode/DerivedData/Ren\'Py_Tutorial_Game-ajudguyshtdxuhdthslafygqzxne/Build/Products/Debug-iphoneos/Ren\'Py\ Tutorial\ Game.app/Ren\'Py\ Tutorial\ Game normal (in target 'Ren'Py Tutorial Game' from project 'Ren'Py Tutorial Game')
    cd /Users/dakia/Desktop/ST\ XCode/tutorial
    /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang -target arm64-apple-ios11.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS14.4.sdk -L/Users/dakia/Library/Developer/Xcode/DerivedData/Ren\'Py_Tutorial_Game-ajudguyshtdxuhdthslafygqzxne/Build/Products/Debug-iphoneos -L/Users/dakia/Desktop/ST\ XCode/tutorial/prebuilt/debug/ -F/Users/dakia/Library/Developer/Xcode/DerivedData/Ren\'Py_Tutorial_Game-ajudguyshtdxuhdthslafygqzxne/Build/Products/Debug-iphoneos -filelist /Users/dakia/Library/Developer/Xcode/DerivedData/Ren\'Py_Tutorial_Game-ajudguyshtdxuhdthslafygqzxne/Build/Intermediates.noindex/Ren\'Py\ Tutorial\ Game.build/Debug-iphoneos/Ren\'Py\ Tutorial\ Game.build/Objects-normal/arm64/Ren\'Py\ Tutorial\ Game.LinkFileList -Xlinker -rpath -Xlinker @executable_path/Frameworks -dead_strip -no_dead_strip_inits_and_terms -Xlinker -object_path_lto -Xlinker /Users/dakia/Library/Developer/Xcode/DerivedData/Ren\'Py_Tutorial_Game-ajudguyshtdxuhdthslafygqzxne/Build/Intermediates.noindex/Ren\'Py\ Tutorial\ Game.build/Debug-iphoneos/Ren\'Py\ Tutorial\ Game.build/Objects-normal/arm64/Ren\'Py\ Tutorial\ Game_lto.o -Xlinker -export_dynamic -Xlinker -no_deduplicate -fobjc-arc -fobjc-link-runtime -lrenpython -lrenpy -lpython2.7 -lavformat -lavcodec -lswscale -lswresample -lavutil -lSDL2_image -lSDL2 -ljpeg -lpng16 -lwebp -lfribidi -lfreetype -lffi -lssl -lcrypto -lbz2 -lz -framework CoreMotion -framework GameController -framework ImageIO -framework QuartzCore -framework CoreServices -framework AudioToolbox -framework OpenGLES -framework CoreGraphics -framework Foundation -framework UIKit -Xlinker -no_adhoc_codesign -Xlinker -dependency_info -Xlinker /Users/dakia/Library/Developer/Xcode/DerivedData/Ren\'Py_Tutorial_Game-ajudguyshtdxuhdthslafygqzxne/Build/Intermediates.noindex/Ren\'Py\ Tutorial\ Game.build/Debug-iphoneos/Ren\'Py\ Tutorial\ Game.build/Objects-normal/arm64/Ren\'Py\ Tutorial\ Game_dependency_info.dat -o /Users/dakia/Library/Developer/Xcode/DerivedData/Ren\'Py_Tutorial_Game-ajudguyshtdxuhdthslafygqzxne/Build/Products/Debug-iphoneos/Ren\'Py\ Tutorial\ Game.app/Ren\'Py\ Tutorial\ Game

ld: entry point (_main) undefined. for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

the7saint7
Newbie
Posts: 5
Joined: Sat Mar 20, 2021 5:44 pm
Contact:

Re: Created Xcode project does not compile

#4 Post by the7saint7 »

After some fiddling, I found a clue.

There is no main function.

So, in main.c, I added:

Code: Select all

int main(int argc, char **argv) {
    return SDL_main(argc, argv);
}
Now it compiles and lunches the app.
But it freezes after the launch screen.

I will keep investigating.

the7saint7
Newbie
Posts: 5
Joined: Sat Mar 20, 2021 5:44 pm
Contact:

Re: Create Xcode project: does not compile

#5 Post by the7saint7 »

I still, can't compile the auto generated xcode project from RenPy.
I added my latest findings in "Edit 2" of the original post.

If anyone has any idea what else I could try, I'd really appreciate it.

User avatar
trickster-kaja
Newbie
Posts: 5
Joined: Sun Sep 08, 2019 6:21 pm
Projects: WINTERSANDS
itch: trickster-kaja
Contact:

Re: Create Xcode project: does not compile

#6 Post by trickster-kaja »

HI! Thank you for this topic. I'm having the exact same issue with the auto generated project in xCode so a little bump to it.
Wanted to add a note that after following your research and adding main() function to main.c my app also freezes on launch but the music from main menu actually starts playing.

Have you made any further progress in your research?

Post Reply

Who is online

Users browsing this forum: No registered users