title: j2objc error adding guava (When.o is missing)
body: <p>I'm playing with j2objc to see if I can use guava in my project.</p>
  
  <p>My project is quite simple: A single view application configured for j2obcj (<a href="https://github.com/google/j2objc/wiki/Xcode-Build-Rules" rel="nofollow">https://github.com/google/j2objc/wiki/Xcode-Build-Rules</a>) with a custom line added to the <code>appDelegete.m</code></p>
  
  <pre><code>#include "java/util/ArrayList.h"
  #include "com/google/common/collect/Lists.h"
  [...]
  [ComGoogleCommonCollectLists newArrayList];
  </code></pre>
  
  <p>Trying to compile it generates the error:</p>
  
  <pre><code>Undefined symbols for architecture x86_64:
    "_JavaxAnnotationMetaWhenEnum_initialized", referenced from:
        +[ComGoogleCommonBaseCharMatcher __annotations_removeFromWithJavaLangCharSequence_] in libguava.a(CharMatcher.o)
        +[ComGoogleCommonBaseCharMatcher __annotations_retainFromWithJavaLangCharSequence_] in libguava.a(CharMatcher.o)
        +[ComGoogleCommonBaseCharMatcher __annotations_replaceFromWithJavaLangCharSequence_withChar_] in libguava.a(CharMatcher.o)
        +[ComGoogleCommonBaseCharMatcher __annotations_replaceFromWithJavaLangCharSequence_withJavaLangCharSequence_] in libguava.a(CharMatcher.o)
        +[ComGoogleCommonBaseCharMatcher __annotations_trimFromWithJavaLangCharSequence_] in libguava.a(CharMatcher.o)
        +[ComGoogleCommonBaseCharMatcher __annotations_trimLeadingFromWithJavaLangCharSequence_] in libguava.a(CharMatcher.o)
        +[ComGoogleCommonBaseCharMatcher __annotations_trimTrailingFromWithJavaLangCharSequence_] in libguava.a(CharMatcher.o)
        ...
    "_JavaxAnnotationMetaWhenEnum_values_", referenced from:
        +[ComGoogleCommonBaseCharMatcher __annotations_removeFromWithJavaLangCharSequence_] in libguava.a(CharMatcher.o)
        +[ComGoogleCommonBaseCharMatcher __annotations_retainFromWithJavaLangCharSequence_] in libguava.a(CharMatcher.o)
        +[ComGoogleCommonBaseCharMatcher __annotations_replaceFromWithJavaLangCharSequence_withChar_] in libguava.a(CharMatcher.o)
        +[ComGoogleCommonBaseCharMatcher __annotations_replaceFromWithJavaLangCharSequence_withJavaLangCharSequence_] in libguava.a(CharMatcher.o)
        +[ComGoogleCommonBaseCharMatcher __annotations_trimFromWithJavaLangCharSequence_] in libguava.a(CharMatcher.o)
        +[ComGoogleCommonBaseCharMatcher __annotations_trimLeadingFromWithJavaLangCharSequence_] in libguava.a(CharMatcher.o)
        +[ComGoogleCommonBaseCharMatcher __annotations_trimTrailingFromWithJavaLangCharSequence_] in libguava.a(CharMatcher.o)
        ...
    "_OBJC_CLASS_$_JavaxAnnotationCheckForNull", referenced from:
        objc-class-ref in libguava.a(Ints.o)
        objc-class-ref in libguava.a(AndroidInteger.o)
    "_OBJC_CLASS_$_JavaxAnnotationCheckReturnValue", referenced from:
        objc-class-ref in libguava.a(CharMatcher.o)
        objc-class-ref in libguava.a(Joiner.o)
        objc-class-ref in libguava.a(Splitter.o)
        objc-class-ref in libguava.a(CacheBuilder.o)
        objc-class-ref in libguava.a(BaseEncoding.o)
        objc-class-ref in libguava.a(UnsignedLong.o)
        objc-class-ref in libguava.a(UnsignedInteger.o)
        ...
    "_OBJC_CLASS_$_JavaxAnnotationMetaWhenEnum", referenced from:
        objc-class-ref in libguava.a(CharMatcher.o)
        objc-class-ref in libguava.a(Joiner.o)
        objc-class-ref in libguava.a(Splitter.o)
        objc-class-ref in libguava.a(CacheBuilder.o)
        objc-class-ref in libguava.a(BaseEncoding.o)
        objc-class-ref in libguava.a(UnsignedLong.o)
        objc-class-ref in libguava.a(UnsignedInteger.o)
        ...
    "_OBJC_CLASS_$_JavaxAnnotationNullable", referenced from:
        objc-class-ref in libguava.a(Equivalence.o)
        objc-class-ref in libguava.a(FunctionalEquivalence.o)
        objc-class-ref in libguava.a(Functions.o)
        objc-class-ref in libguava.a(Joiner.o)
        objc-class-ref in libguava.a(Objects.o)
        objc-class-ref in libguava.a(Optional.o)
        objc-class-ref in libguava.a(PairwiseEquivalence.o)
        ...
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation) 
  </code></pre>
  
  <p>It looks like there is a problem while linking, there is no <code>When.o</code> in <code>libjre_emul.a</code>.</p>
  
  <p>I've tried running the following line without any issues, just to check that the <code>javax</code> package was there</p>
  
  <pre><code>#include "javax/xml/parsers/SAXParser.h"
  [...]
  [[JavaxXmlParsersSAXParser alloc] init];
  </code></pre>
  
  <p>Also checked that <code>SAXParser.i</code> is in <code>libjre_emul</code></p>
  
  <pre><code>$ otool -o lib/libjre_emul.a  | grep .o\): | grep SAXParser
  lib/libjre_emul.a(SAXParser.o):
  lib/libjre_emul.a(SAXParserFactory.o):
  lib/libjre_emul.a(SAXParserFactoryImpl.o):
  lib/libjre_emul.a(SAXParserImpl.o):
  </code></pre>
  
  <p>But in the case of trying <code>When</code></p>
  
  <pre><code>#include "javax/annotation/meta/When.h"
  [...]
  [JavaxAnnotationMetaWhenEnum values];
  </code></pre>
  
  <p>I got an error similar to the one with guava</p>
  
  <pre><code>Undefined symbols for architecture x86_64:
    "_OBJC_CLASS_$_JavaxAnnotationMetaWhenEnum", referenced from:
        objc-class-ref in AppDelegate.o
  ld: symbol(s) not found for architecture x86_64
  clang: error: linker command failed with exit code 1 (use -v to see invocation)
  </code></pre>
  
  <p>After checking <code>libjre_emul</code> there is no <code>When.o</code> </p>
  
  <pre><code>otool -o lib/libjre_emul.a  | grep .o\): | grep When
  </code></pre>
  
  <p>My settings are:</p>
  
  <pre><code>J2OBJC_HOME = ./bin/j2objc-0.9.5;
  HEADER_SEARCH_PATHS = $(inherited) "${J2OBJC_HOME}/include";
  LIBRARY_SEARCH_PATHS = $(inherited) "${J2OBJC_HOME}/lib";
  OTHER_LDFLAGS = $(inherited) -l"z" -l"jre_emul" -l"guava" -l"icucore" -framework "Security" -ObjC;
  </code></pre>
  
  <p>I've tried different version (0.9.5, 0.9.4, 0.9.3, 0.9) but the error remains.</p>
  
  <p>In conclusion, as far as I know there is no way of using guava with j2objc, because it depends on missing symbols. </p>
  
  <p>Can anyone prove me wrong, hopefully? I really want to start using j2objc in a real project!</p>
  
  <p>Thanks in advance! Merry Christmas!</p>