theos / theos

A cross-platform suite of tools for building and deploying software for iOS and other platforms.
https://theos.dev
Other
4.43k stars 1.08k forks source link

[Bug]: Swift - error: unable to load standard library for target #778

Open Green-pep opened 10 months ago

Green-pep commented 10 months ago

What are the steps to reproduce this issue?

Guys I have problem with make package I create swift project but when I try to compile it's giving me error Makefile:13

I think i am not installed an SDK for IOS or Mac I just follow the installation guide from the offical page.

What happens?

Makefile:13 /aggregate.mk: No such file or directory make: *** No rule to make target '/aggregate.mk'. Stop. export THEOS=~/theos export THEOS_MAKE_PATH=$THEOS/makefiles this is add for ver in bashrc file. Can some one help please

What were you expecting to happen?

I expected to make package to make .deb file for installing to iphone

Paste any relevant logs, error output, etc.

No response

Additional context

No response

What OS are you seeing the problem on?

Linux/WSL

What OS version does it have installed?

Ubuntu

What toolchain and version are you using?

Ubuntu

Which SDK version are you using?

I think i am not installed an SDK for IOS or Mac I just follow the installation guide from the offical page.

What OS is your client device running?

iOS

What OS version does it have installed?

15.7

Which device model is it?

Iphone SE 2016

Which jailbreak is it using (if relevant)?

checkra1n

leptos-null commented 10 months ago

export THEOS_MAKE_PATH=$THEOS/makefiles

May you remove this line and restart your shell? Theos will set this variable for you.

Green-pep commented 10 months ago

I've tried and keep getting the same result as the first attempt. Makefile:13: /aggregate.mk: No such file or directory make: *** No rule to make target '/aggregate.mk'. Stop Am I need to reinstall it or to try make troubleshoot ? Also, I believe it should set up automatically when installed, is that correct? Also i've tried to set directly path in Makefile to /aggregate.mk and didn't work too.

L1ghtmann commented 10 months ago

Would you mind sharing the output of echo $THEOS and your project's Makefile? Thanks!

Green-pep commented 10 months ago

Afcourse Screenshot 2023-11-10 120411 Screenshot 2023-11-10 120458 that subproject is deleted thank you for your assistance

L1ghtmann commented 10 months ago

Huh, how odd. It looks like everything is configured as it should be. I would check that you don't have conflicting environment variables (~/.profile, ~/.bash_profile, ~/.bashrc, etc)

leptos-null commented 10 months ago

It's also interesting that both times $(THEOS_MAKE_PATH)/application.mk seems to be fine, but $(THEOS_MAKE_PATH)/aggregate.mk is not.

May you run ls "${THEOS}/makefiles/aggregate.mk"? And may you link the installation guide you followed?

Green-pep commented 10 months ago

image lol that works, but make is not working image and the installation guide is from the original site https://theos.dev/docs/installation-linux

L1ghtmann commented 10 months ago

It's not working because you're invoking make with sudo. Theos should not be run with root/sudo.

jevinskie commented 10 months ago

Looks like you posted a comment and then deleted it about an issue where it “doesn’t run without sudo” with permission errors. That’s likely because when you ran with sudo in the first place, directories were created that are owned by root that your user can’t access.

Try sudo chown -R spanaka:spanaka ~spanaka/theos to make sure everything under the theos directory is owned (and thus writable) by your user and not root.

Green-pep commented 10 months ago

image I move to another problem, the problem the old was that switft wasn't right configure but now I am facing another problem maybe not correct version of swift ?

L1ghtmann commented 10 months ago

I'm not too familiar with our swift tools, but you can try a newer toolchain.

mv $THEOS/toolchain $THEOS/old-toolchain
mkdir -p $THEOS/toolchain
curl -sL https://github.com/kabiroberai/swift-toolchain-linux/releases/download/v2.3.0/swift-5.8-ubuntu20.04.tar.xz | tar -xJvf - -C $THEOS/toolchain/
Green-pep commented 10 months ago

I run it and change the export = path in bashrc to new toolchain image

jevinskie commented 10 months ago

Please post the logs to a gist instead of screenshotting.

Add MESSAGES=1 to your make invocation to enable verbose logging.

Please post the output of which -a swift and echo $PATH.

If you install the GitHub command line tool and run gh auth first to authenticate the gh tool with GitHub you can then run make troubleshoot which will automatically run a clean and then all targets in verbose mode and upload the results to a GitHub gist that you can link here.

L1ghtmann commented 10 months ago

@SamuraiDjvak please try downloading a newer sdk. We are working on updating ours, but in the meantime you can try these https://github.com/xybp888/iOS-SDKs. Just download one of the newer ones and place it in $THEOS/sdks. Also, you don't need to edit your PATH variable. Theos will handle this for you.

Green-pep commented 10 months ago

this is the link from troubleshooting: https://gist.github.com/SamuraiDjvak/d822171dc54f9ae75a37fcc535d357c7 That newprojectc was deleted from me, so am I need to rework the Makefile and am I need to write there in first row for which IOS am I want the compile?

which -a swift: /usr/share/swift/usr/bin/swift also in echo $PATH /usr/share/swift/usr/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/usr/lib/wsl/lib:/mnt/c/Program Files/WindowsApps/CanonicalGroupLimited.Ubuntu_2204.2.33.0_x64__79rhkp1fndgsc:

Also I upload updated SDK and still having the same issue: ==> Copying resource directories into the application wrapper… ==> Compiling module interface (arm64)… ==> Compiling module interface (armv7)… ==> Compiling module interface (arm64e)… error: emit-module command failed with exit code 1 (use -v to see invocation)

:0: error: unable to load standard library for target 'armv7-apple-ios7.0' make[4]: *** [/home/spanaka/theos/makefiles/instance/rules.mk:350: internal-swift-Newproject2-armv7] Error 1 make[3]: *** [/home/spanaka/theos/makefiles/instance/rules.mk:359: /home/spanaka/newproject2/.theos/obj/debug/armv7/.swift-stamp] Error 2 make[2]: *** [/home/spanaka/theos/makefiles/instance/application.mk:50: /home/spanaka/newproject2/.theos/obj/debug/armv7/Newproject2.app/Newproject2] Error 2 make[2]: *** Waiting for unfinished jobs.... error: emit-module command failed with exit code 1 (use -v to see invocation) /home/spanaka/theos/sdks/iPhoneOS16.4.sdk/usr/lib/swift/Swift.swiftmodule/arm64-apple-ios.swiftinterface:1:1: error: error extracting version from module interface // swift-interface-format-version: 1.0 ^ :0: error: unable to load standard library for target 'arm64-apple-ios7.0' make[4]: *** [/home/spanaka/theos/makefiles/instance/rules.mk:350: internal-swift-Newproject2-arm64] Error 1 make[3]: *** [/home/spanaka/theos/makefiles/instance/rules.mk:359: /home/spanaka/newproject2/.theos/obj/debug/arm64/.swift-stamp] Error 2 make[2]: *** [/home/spanaka/theos/makefiles/instance/application.mk:50: /home/spanaka/newproject2/.theos/obj/debug/arm64/Newproject2.app/Newproject2] Error 2 error: emit-module command failed with exit code 1 (use -v to see invocation) /home/spanaka/theos/sdks/iPhoneOS16.4.sdk/usr/lib/swift/Swift.swiftmodule/arm64e-apple-ios.swiftinterface:1:1: error: error extracting version from module interface // swift-interface-format-version: 1.0 ^ :0: error: unable to load standard library for target 'arm64e-apple-ios7.0' make[4]: *** [/home/spanaka/theos/makefiles/instance/rules.mk:350: internal-swift-Newproject2-arm64e] Error 1 make[3]: *** [/home/spanaka/theos/makefiles/instance/rules.mk:359: /home/spanaka/newproject2/.theos/obj/debug/arm64e/.swift-stamp] Error 2 make[2]: *** [/home/spanaka/theos/makefiles/instance/application.mk:50: /home/spanaka/newproject2/.theos/obj/debug/arm64e/Newproject2.app/Newproject2] Error 2 make[1]: *** [/home/spanaka/theos/makefiles/instance/application.mk:41: internal-application-all_] Error 2 make: *** [/home/spanaka/theos/makefiles/master/rules.mk:146: Newproject2.all.application.variables] Error 2
L1ghtmann commented 10 months ago

Also I upload updated SDK and still having the same issue:

I would try removing the armv7 arch from your Makefile. If ARCHS is not explicitly defined, you can define it with ARCHS = arm64 arm64e at the top of the Makefile. That or you can try bumping your deployment version via the TARGET variable. You can try changing it to TARGET = iphone:clang:latest:12.2, for example.

Green-pep commented 10 months ago
:0: error: unable to load standard library for target 'arm64-apple-ios15.6' error: emit-module command failed with exit code 1 (use -v to see invocation) /home/spanaka/theos/sdks/iPhoneOS16.4.sdk/usr/lib/swift/Swift.swiftmodule/arm64e-apple-ios.swiftinterface:1:1: error: error extracting version from module interface // swift-interface-format-version: 1.0 ^ :0: error: unable to load standard library for target 'arm64e-apple-ios15.6' make[4]: *** [/home/spanaka/theos/makefiles/instance/rules.mk:350: internal-swift-Newproject2-arm64] Error 1 make[3]: *** [/home/spanaka/theos/makefiles/instance/rules.mk:359: /home/spanaka/newproject2/.theos/obj/debug/arm64/.swift-stamp] Error 2 make[2]: *** [/home/spanaka/theos/makefiles/instance/application.mk:50: /home/spanaka/newproject2/.theos/obj/debug/arm64/Newproject2.app/Newproject2] Error 2 make[2]: *** Waiting for unfinished jobs.... make[4]: *** [/home/spanaka/theos/makefiles/instance/rules.mk:350: internal-swift-Newproject2-arm64e] Error 1 make[3]: *** [/home/spanaka/theos/makefiles/instance/rules.mk:359: /home/spanaka/newproject2/.theos/obj/debug/arm64e/.swift-stamp] Error 2 make[2]: *** [/home/spanaka/theos/makefiles/instance/application.mk:50: /home/spanaka/newproject2/.theos/obj/debug/arm64e/Newproject2.app/Newproject2] Error 2 make[1]: *** [/home/spanaka/theos/makefiles/instance/application.mk:41: internal-application-all_] Error 2 make: *** [/home/spanaka/theos/makefiles/master/rules.mk:146: Newproject2.all.application.variables] Error 2 still these two errors for arm64 and arm64e
L1ghtmann commented 9 months ago

@SamuraiDjvak We recently updated our sdk repo. Would you mind trying again after installing iPhoneOS16.5.sdk:

curl -L https://github.com/theos/sdks/releases/download/master-146e41f/iPhoneOS16.5.sdk.tar.xz | tar -xJv -C "$THEOS/sdks"

Edit: no sure it's SDK related, but just want to cover our bases.