Home > Blockchain >  Cannot run program "xcodebuild" in Eclipse on MacBook using the example codenameone projec
Cannot run program "xcodebuild" in Eclipse on MacBook using the example codenameone projec

Time:01-24

I am trying to build an iOS Xcode project in Eclipse on MacBook Pro using codename one's example project. Shai and Steve at Codename One have helped to solve the cocoapods installation issue (Failed to build iOS Xcode project in Eclipse using the example codenameone project). In a subsequent build/run, another error showed up: "Cannot run program "xcodebuild" (in directory "/Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build"): error=2, No such file or directory"

I can execute "xcodebuild" from the command line. There is no file under the "/Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build" directory. I looked at all text files under the project tree but did not find how to fix this issue. I don't know whether the subsequent error on "failed to run retrolambda" is a result of the xcodebuild error.

Thank you for your help.

[[1;36mDEBUG[m] (f) project = MavenProject: com.example.mycnoapp:mycnoapp-ios:1.0-SNAPSHOT @ /Users/user2016/Downloads/mycnoapp/ios/pom.xml
[[1;36mDEBUG[m] (f) remoteRepositories = [ id: central
url: https://repo.maven.apache.org/maven2
layout: default
snapshots: [enabled => false, update => daily]
releases: [enabled => true, update => daily]
blocked: false
]
[[1;36mDEBUG[m] (f) stubberIncludes = **
[[1;36mDEBUG[m] -- end configuration --
[[1;36mDEBUG[m] Classpath Elements: [/Users/user2016/Downloads/mycnoapp/ios/target/classes, /Users/user2016/Downloads/mycnoapp/common/target/mycnoapp-common-1.0-SNAPSHOT.jar]
[[1;36mDEBUG[m] Found jar file with dependencies at /Users/user2016/Downloads/mycnoapp/ios/target/mycnoapp-ios-1.0-SNAPSHOT-ios-source-jar-with-dependencies.jar. Will use that one unless it is out of date.
[[1;36mDEBUG[m] Designer is up to date
[[1;34mINFO[m] Running ANT build target ios-source
[[1;34mINFO[m] Generating Xcode Project to /Users/user2016/Downloads/mycnoapp/ios/target/mycnoapp-ios-1.0-SNAPSHOT-ios-source...
[[1;34mINFO[m] Executing with timeout -1
[[1;34mINFO[m] 1.11.3

[[1;34mINFO[m] Process return code is 0
[[1;34mINFO[m] Pods version: 1.11.3

[[1;34mINFO[m] Request Args: 
[[1;34mINFO[m] -----------------
[[1;34mINFO[m] hyp.beamId=733db829-5aa1-46e9-959b-d9a3f1926c2f
[[1;34mINFO[m] java.version=17
[[1;34mINFO[m] maven.codenameone-maven-plugin=7.0.86
[[1;34mINFO[m] ios.newStorageLocation=true
[[1;34mINFO[m] maven.codenameone-core.version=LATEST
[[1;34mINFO[m] -------------------
[[1;34mINFO[m] Executing with timeout -1
[[1;34mINFO[m] Problem getting Xcode version: Cannot run program "xcodebuild" (in directory "/Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build"): error=2, No such file or directory
java.io.IOException: Cannot run program "xcodebuild" (in directory "/Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build"): error=2, No such file or directory
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1143)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073)
at com.codename1.builders.Executor.executeProcess(Executor.java:1613)
at com.codename1.builders.Executor.execStringWithThrow(Executor.java:1479)
at com.codename1.builders.Executor.execString(Executor.java:1490)
at com.codename1.builders.IPhoneBuilder.getXcodeVersion(IPhoneBuilder.java:2462)
at com.codename1.builders.IPhoneBuilder.build(IPhoneBuilder.java:278)
at com.codename1.maven.CN1BuildMojo.doIOSLocalBuild(CN1BuildMojo.java:1014)
at com.codename1.maven.CN1BuildMojo.createAntProject(CN1BuildMojo.java:564)
at com.codename1.maven.CN1BuildMojo.executeImpl(CN1BuildMojo.java:116)
at com.codename1.maven.AbstractCN1Mojo.execute(AbstractCN1Mojo.java:195)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2(MojoExecutor.java:370)
at org.apache.maven.lifecycle.internal.MojoExecutor.doExecute(MojoExecutor.java:351)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:215)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:171)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:163)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:294)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:192)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:105)
at org.apache.maven.cli.MavenCli.execute(MavenCli.java:960)
at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:293)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:196)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:568)
at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:282)
at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:225)
at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:406)
at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:347)
Caused by: java.io.IOException: error=2, No such file or directory
at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:314)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:244)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1110)
... 34 more
[[1;36mDEBUG[m] Xcode version is 10
[[1;34mINFO[m] Executing: 
[[1;34mINFO[m] /Users/user2016/.p2/pool/plugins/org.eclipse.justj.openjdk.hotspot.jre.full.macosx.x86_64_17.0.5.v20221102-0933/jre/bin/java -Dretrolambda.inputDir=/Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/classes -Dretrolambda.classpath=/Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/classes:/Users/user2016/.m2/repository/com/codenameone/codenameone-core/7.0.86/codenameone-core-7.0.86.jar -Dretrolambda.outputDir=/Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/classes_retrolamda -Dretrolambda.bytecodeVersion=49 -Dretrolambda.defaultMethods=true -jar /Users/user2016/.m2/repository/net/orfjackal/retrolambda/retrolambda/2.5.7/retrolambda-2.5.7.jar 
[[1;34mINFO[m] Executing with timeout -1
[[1;34mINFO[m] Retrolambda 2.5.7

[[1;34mINFO[m] 00:00 INFO: Bytecode version: 49 (Java 5)
00:00 INFO: Default methods: true

[[1;34mINFO[m] 00:00 INFO: Input directory: /Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/classes

[[1;34mINFO[m] 00:00 INFO: Output directory: /Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/classes_retrolamda

[[1;34mINFO[m] 00:00 INFO: Classpath: [/Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build/classes, /Users/user2016/.m2/repository/com/codenameone/codenameone-core/7.0.86/codenameone-core-7.0.86.jar]

[[1;34mINFO[m] 00:00 INFO: Included files: all

[[1;34mINFO[m] 00:00 INFO: JVM version: 17.0.5

[[1;34mINFO[m] 00:00 INFO: Agent enabled: false

[[1;34mINFO[m] 00:00 INFO: javac hacks: false

[[1;34mINFO[m] 00:00 ERROR: Failed to run Retrolambda
java.lang.IllegalStateException: Cannot initialize dumper; unexpected JDK implementation. Please run Retrolambda using the Java agent (enable forking in the Maven plugin).
at net.orfjackal.retrolambda.lambdas.LambdaClassDumper.install(LambdaClassDumper.java:38)
at net.orfjackal.retrolambda.Retrolambda.run(Retrolambda.java:67)
at net.orfjackal.retrolambda.Main.main(Main.java:28)
Suppressed: java.lang.RuntimeException: java.lang.IllegalAccessException: class net.orfjackal.retrolambda.lambdas.LambdaClassDumper cannot access a member of class java.lang.invoke.InnerClassLambdaMetafactory (in module java.base) with modifiers "private static final"
at net.orfjackal.retrolambda.lambdas.LambdaClassDumper.uninstall(LambdaClassDumper.java:48)
at net.orfjackal.retrolambda.lambdas.LambdaClassDumper.close(LambdaClassDumper.java:55)
at net.orfjackal.retrolambda.Retrolambda.run(Retrolambda.java:102)
... 1 more
Caused by: java.lang.IllegalAccessException: class net.orfjackal.retrolambda.lambdas.LambdaClassDumper cannot access a member of class java.lang.invoke.InnerClassLambdaMetafactory (in module java.base) with modifiers "private static final"
at java.base/jdk.internal.reflect.Reflection.newIllegalAccessException(Reflection.java:392)
at java.base/java.lang.reflect.AccessibleObject.checkAccess(AccessibleObject.java:674)
at java.base/java.lang.reflect.Field.checkAccess(Field.java:1102)
at java.base/java.lang.reflect.Field.set(Field.java:797)
at net.orfjackal.retrolambda.lambdas.LambdaClassDumper.uninstall(LambdaClassDumper.java:46)
... 3 more
Caused by: java.lang.RuntimeException: Failed to make a field non-final (private static final java.lang.invoke.ProxyClassesDumper java.lang.invoke.InnerClassLambdaMetafactory.dumper). This known to fail on Java 12 and newer. Prefer using Java 8 or try using the Java agent (fork=true in the Maven plugin).
at net.orfjackal.retrolambda.lambdas.LambdaClassDumper.makeNonFinal(LambdaClassDumper.java:65)
at net.orfjackal.retrolambda.lambdas.LambdaClassDumper.install(LambdaClassDumper.java:32)
... 2 more
Caused by: java.lang.NoSuchFieldException: modifiers
at java.base/java.lang.Class.getDeclaredField(Class.java:2610)
at net.orfjackal.retrolambda.lambdas.LambdaClassDumper.makeNonFinal(LambdaClassDumper.java:60)
... 3 more

[[1;34mINFO[m] Process return code is 1
[[1;34mINFO[m] [1m------------------------------------------------------------------------[m
[[1;34mINFO[m] [1mReactor Summary for mycnoapp 1.0-SNAPSHOT:[m
[[1;34mINFO[m] 
[[1;34mINFO[m] mycnoapp ........................................... [1;32mSUCCESS[m [ 0.014 s]
[[1;34mINFO[m] mycnoapp-common .................................... [1;32mSUCCESS[m [ 11.667 s]
[[1;34mINFO[m] mycnoapp-ios ....................................... [1;31mFAILURE[m [ 1.903 s]
[[1;34mINFO[m] [1m------------------------------------------------------------------------[m
[[1;34mINFO[m] [1;31mBUILD FAILURE[m
[[1;34mINFO[m] [1m------------------------------------------------------------------------[m
[[1;34mINFO[m] Total time: 13.807 s
[[1;34mINFO[m] Finished at: 2023-01-22T14:59:44-05:00
[[1;34mINFO[m] [1m------------------------------------------------------------------------[m
[[1;31mERROR[m] Failed to execute goal [32mcom.codenameone:codenameone-maven-plugin:7.0.86:build[m [1m(build-ios)[m on project [36mmycnoapp-ios[m: [1;31miOS build failed[m -> [1m[Help 1][m
[1;31morg.apache.maven.lifecycle.LifecycleExecutionException[m: [1;31mFailed to execute goal [32mcom.codenameone:codenameone-maven-plugin:7.0.86:build[m [1m(build-ios)[m on project [36mmycnoapp-ios[m: [1;31miOS build failed[m[m
[1mat[m org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 ([1mMojoExecutor.java:375[m)
[1mat[m org.apache.maven.lifecycle.internal.MojoExecutor.doExecute ([1mMojoExecutor.java:351[m)
[1mat[m org.apache.maven.lifecycle.internal.MojoExecutor.execute ([1mMojoExecutor.java:215[m)
[1mat[m org.apache.maven.lifecycle.internal.MojoExecutor.execute ([1mMojoExecutor.java:171[m)
[1mat[m org.apache.maven.lifecycle.internal.MojoExecutor.execute ([1mMojoExecutor.java:163[m)
[1mat[m org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject ([1mLifecycleModuleBuilder.java:117[m)
[1mat[m org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject ([1mLifecycleModuleBuilder.java:81[m)
[1mat[m org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build ([1mSingleThreadedBuilder.java:56[m)
[1mat[m org.apache.maven.lifecycle.internal.LifecycleStarter.execute ([1mLifecycleStarter.java:128[m)
[1mat[m org.apache.maven.DefaultMaven.doExecute ([1mDefaultMaven.java:294[m)
[1mat[m org.apache.maven.DefaultMaven.doExecute ([1mDefaultMaven.java:192[m)
[1mat[m org.apache.maven.DefaultMaven.execute ([1mDefaultMaven.java:105[m)
[1mat[m org.apache.maven.cli.MavenCli.execute ([1mMavenCli.java:960[m)
[1mat[m org.apache.maven.cli.MavenCli.doMain ([1mMavenCli.java:293[m)
[1mat[m org.apache.maven.cli.MavenCli.main ([1mMavenCli.java:196[m)
[1mat[m jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 ([1mNative Method[m)
[1mat[m jdk.internal.reflect.NativeMethodAccessorImpl.invoke ([1mNativeMethodAccessorImpl.java:77[m)
[1mat[m jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke ([1mDelegatingMethodAccessorImpl.java:43[m)
[1mat[m java.lang.reflect.Method.invoke ([1mMethod.java:568[m)
[1mat[m org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced ([1mLauncher.java:282[m)
[1mat[m org.codehaus.plexus.classworlds.launcher.Launcher.launch ([1mLauncher.java:225[m)
[1mat[m org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode ([1mLauncher.java:406[m)
[1mat[m org.codehaus.plexus.classworlds.launcher.Launcher.main ([1mLauncher.java:347[m)
[1mCaused by[m: org.apache.maven.plugin.MojoExecutionException: [1;31miOS build failed[m
[1mat[m com.codename1.maven.CN1BuildMojo.doIOSLocalBuild ([1mCN1BuildMojo.java:1016[m)
[1mat[m com.codename1.maven.CN1BuildMojo.createAntProject ([1mCN1BuildMojo.java:564[m)
[1mat[m com.codename1.maven.CN1BuildMojo.executeImpl ([1mCN1BuildMojo.java:116[m)
[1mat[m com.codename1.maven.AbstractCN1Mojo.execute ([1mAbstractCN1Mojo.java:195[m)
[1mat[m org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo ([1mDefaultBuildPluginManager.java:137[m)
[1mat[m org.apache.maven.lifecycle.internal.MojoExecutor.doExecute2 ([1mMojoExecutor.java:370[m)
[1mat[m org.apache.maven.lifecycle.internal.MojoExecutor.doExecute ([1mMojoExecutor.java:351[m)
[1mat[m org.apache.maven.lifecycle.internal.MojoExecutor.execute ([1mMojoExecutor.java:215[m)
[1mat[m org.apache.maven.lifecycle.internal.MojoExecutor.execute ([1mMojoExecutor.java:171[m)
[1mat[m org.apache.maven.lifecycle.internal.MojoExecutor.execute ([1mMojoExecutor.java:163[m)
[1mat[m org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject ([1mLifecycleModuleBuilder.java:117[m)
[1mat[m org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject ([1mLifecycleModuleBuilder.java:81[m)
[1mat[m org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build ([1mSingleThreadedBuilder.java:56[m)
[1mat[m org.apache.maven.lifecycle.internal.LifecycleStarter.execute ([1mLifecycleStarter.java:128[m)
[1mat[m org.apache.maven.DefaultMaven.doExecute ([1mDefaultMaven.java:294[m)
[1mat[m org.apache.maven.DefaultMaven.doExecute ([1mDefaultMaven.java:192[m)
[1mat[m org.apache.maven.DefaultMaven.execute ([1mDefaultMaven.java:105[m)
[1mat[m org.apache.maven.cli.MavenCli.execute ([1mMavenCli.java:960[m)
[1mat[m org.apache.maven.cli.MavenCli.doMain ([1mMavenCli.java:293[m)
[1mat[m org.apache.maven.cli.MavenCli.main ([1mMavenCli.java:196[m)
[1mat[m jdk.internal.reflect.NativeMethodAccessorImpl.invoke0 ([1mNative Method[m)
[1mat[m jdk.internal.reflect.NativeMethodAccessorImpl.invoke ([1mNativeMethodAccessorImpl.java:77[m)
[1mat[m jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke ([1mDelegatingMethodAccessorImpl.java:43[m)
[1mat[m java.lang.reflect.Method.invoke ([1mMethod.java:568[m)
[1mat[m org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced ([1mLauncher.java:282[m)
[1mat[m org.codehaus.plexus.classworlds.launcher.Launcher.launch ([1mLauncher.java:225[m)
[1mat[m org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode ([1mLauncher.java:406[m)
[1mat[m org.codehaus.plexus.classworlds.launcher.Launcher.main ([1mLauncher.java:347[m)
[[1;31mERROR[m] 
[[1;31mERROR[m] 
[[1;31mERROR[m] For more information about the errors and possible solutions, please read the following articles:
[[1;31mERROR[m] [1m[Help 1][m http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
[[1;31mERROR[m] 
[[1;31mERROR[m] After correcting the problems, you can resume the build with the command
[[1;31mERROR[m] [1mmvn <args> -rf :mycnoapp-ios[m

I tried "Build iOS Xcode Project" in Eclipse on the example project (named "myCNOApp") generated by Codename One's initializer. The build failed with the first error message as java.io.IOException: Cannot run program "xcodebuild" (in directory "/Users/user2016/Downloads/mycnoapp/ios/target/codenameone/antProject/dist/ios-build"): error=2, No such file or directory

CodePudding user response:

You need to use JDK 11 to run the build. Not a newer version as support for older versions was removed from newer JDKs causing failures. I noticed you're using JDK 17 which is problematic in this case.

  • Related