0

I was trying to run a J2OBJC sample from this "https://github.com/yixiang/Xcode-J2ObjC-Example" repository. I am facing some issue while building this project.

the error is listing below.

VERSION_INFO_STRING="\"@(#)PROGRAM:SharedCode  PROJECT:J2ObjCExample-\""
    export WRAP_ASSET_PACKS_IN_SEPARATE_DIRECTORIES=NO
    export XCODE_APP_SUPPORT_DIR=/Applications/Xcode.app/Contents/Developer/Library/Xcode
    export XCODE_PRODUCT_BUILD_VERSION=8E3004b
    export XCODE_VERSION_ACTUAL=0833
    export XCODE_VERSION_MAJOR=0800
    export XCODE_VERSION_MINOR=0830
    export XPCSERVICES_FOLDER_PATH=/XPCServices
    export YACC=yacc
    export arch=x86_64
    export variant=normal
    /bin/sh -c if\ [\ !\ -f\ \"${J2OBJC_HOME}/j2objc\"\ ];\ then\ echo\ \"J2OBJC_HOME\ not\ correctly\ defined\ in\ LibConfig.xcconfig,\ currently\ set\ to\ \'${J2OBJC_HOME}\'\";\ exit\ 1;\ fi;\
\
\"${J2OBJC_HOME}/j2objc\"\ -d\ ${GENERATED_FILES_DIR}\ -sourcepath\ \"${JAVA_SOURCE_PATH}\"\ --no-package-directories\ --no-class-methods\ -g\ ${INPUT_FILE_PATH};\
\
#\ Optionally,\ you\ may\ also\ set\ prefix\ for\ your\ java\ packages\ by\ adding\ --prefix.\
#\ \"${J2OBJC_HOME}/j2objc\"\ -d\ ${GENERATED_FILES_DIR}\ -sourcepath\ \"${JAVA_SOURCE_PATH}\"\ --no-package-directories\ --prefix\ org.j2objc.sample.shared=OJSS\ --no-class-methods\ -g\ ${INPUT_FILE_PATH};

J2OBJC_HOME not correctly defined in LibConfig.xcconfig, currently set to '/Users/******/bin/j2objc'
Command /bin/sh failed with exit code 1

But I can able to echo the $J2OBJC_HOME and getting path too. *****-MacBook-Pro:j2objc-2.0.5 ******$ echo $J2OBJC_HOME /Users/******/bin please help me to resolve this issue. thanks in advance.

Attaching the config files with this question

Config file screenshot added for, am I done it correctly?.

Joseph
  • 99
  • 12
  • 1
    As the sample app's README states (https://github.com/yixiang/Xcode-J2ObjC-Example/blob/master/README.md#prerequisite), you need to set the J2OBJC_HOME variable in two places: J2ObjCExample/AppConfig.xcconfig and SharedCode/LibConfig.xcconfig. – tball Nov 21 '17 at 16:12
  • @tball I am already set the J2OBJC_HOME variable in two places: J2ObjCExample/AppConfig.xcconfig and SharedCode/LibConfig.xcconfig. Is there any J2OBJC version issue? – Joseph Nov 22 '17 at 04:14
  • @tball I have updated the question with latest error and screenshot. – Joseph Nov 22 '17 at 04:38

1 Answers1

0

Here are the steps I took:

  1. Cloned sample project: $ cd ~/src $ git clone https://github.com/yixiang/Xcode-J2ObjC-Example.git $ cd Xcode-J2ObjC-Example
  2. Downloaded j2objc 2.0.5 to ~/Downloads, then clicked to expand it.
  3. Ran open J2ObjCExample/J2ObjCExample.xcodeproj/ to open project in Xcode, version 9.1.
  4. Edited AppConfig.xcconfig and LibConfig.xcconfig, editing the J2OBJC_HOME line in each to read J2OBJC_HOME = ${HOME}/Downloads/j2objc-2.0.5;.
  5. Build, it fails with: j2objc: invalid flag: --no-class-methods Usage: j2objc <options> <source files> use --help for a list of possible options
  6. Selected SharedCode target, then Build Rules, removed --no-class-methods flag.
  7. Translation and compilation succeeds, link fails with missing iconv* symbols.
  8. Selected J2ObjCExample target, Build Phases, Link Binary With Libraries. Clicked +, typed iconv, clicked libiconv.tbd, clicked Add.
  9. Build succeeds and app runs.

I don't know why your current workspace is failing, but recommend you delete it and follow the above steps.

Please note: this example was created by an independent developer, not associated with the j2objc team. If you need further help, consider contacting him directly.

tball
  • 1,984
  • 11
  • 21