Failed to build iOS Xcode project in Eclipse using the example codenameone project

0
40

[ad_1]

I was about to run the simulator in Eclipse on the example project (the initializer) on my MacBook. However when I tried to build the iOS Xcode project, it failed and asked for the installation of cocoapods. I followed the instruction using “sudo gem install cocoapods” but got another error, seeming to complain about the lack of necessary libraries and/or headers. I attached a portion of the stack trace for each error below.

Help is appreciated.

Stack trace when building the iOS Xcode project:

[[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;31mFailed to build ios app[m: Please install Cocoapods in order to generate Xcode projects. E.g. 'sudo gem install cocoapods'. See https://cocoapods.org/ -> [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;31mFailed to build ios app[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;31mFailed to build ios app[m
[1mat[m com.codename1.maven.CN1BuildMojo.doIOSLocalBuild ([1mCN1BuildMojo.java:1039[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)
[1mCaused by[m: com.codename1.builders.BuildException: [1;31mPlease install Cocoapods in order to generate Xcode projects. E.g. 'sudo gem install cocoapods'. See https://cocoapods.org/[m
[1mat[m com.codename1.builders.IPhoneBuilder.build ([1mIPhoneBuilder.java:219[m)
[1mat[m com.codename1.maven.CN1BuildMojo.doIOSLocalBuild ([1mCN1BuildMojo.java:1014[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

Stack trace after “sudo gem install cocoapods”:


A new major version is available for Algolia! Please now use the https://rubygems.org/gems/algolia gem to get the latest features.
Successfully installed algoliasearch-1.27.5
Building native extensions. This could take a while...
ERROR:  Error installing cocoapods:
ERROR: Failed to build gem native extension.
 
    current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20230119-28763-t6bmkj.rb extconf.rb
checking for ffi.h... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.
 
Provided configuration options:
--with-opt-dir
--without-opt-dir
--with-opt-include
--without-opt-include=${opt-dir}/include
--with-opt-lib
--without-opt-lib=${opt-dir}/lib
--with-make-prog
--without-make-prog
--srcdir=.
--curdir
--ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/$(RUBY_BASE_NAME)
--with-ffi_c-dir
--without-ffi_c-dir
--with-ffi_c-include
--without-ffi_c-include=${ffi_c-dir}/include
--with-ffi_c-lib
--without-ffi_c-lib=${ffi_c-dir}/lib
--enable-system-libffi
--disable-system-libffi
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in `block in try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:534:in `with_werror'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:585:in `try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1109:in `block in have_header'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:1108:in `have_header'
from extconf.rb:10:in `system_libffi_usable?'
from extconf.rb:42:in `<main>'
 
To see why this extension failed to compile, please check the mkmf.log which can be found here:
 
  /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-21/2.6.0/ffi-1.15.5/mkmf.log
 
extconf failed, exit code 1
 
Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-21/2.6.0/ffi-1.15.5/gem_make.out

[ad_2]