5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

openFrameworks for iOSがXcode6でビルド出来ない問題を修正

Last updated at Posted at 2014-12-03

ofrubyをXcode6でビルドしようとしたら変なリンクエラーが出た。

ld: warning: ignoring file ../../../libs/FreeImage/lib/ios/freeimage.a, missing required architecture i386 in file ../../../libs/FreeImage/lib/ios/freeimage.a (2 slices)
ld: warning: ignoring file ../../../libs/glu/lib/ios/glu-ios.a, missing required architecture i386 in file ../../../libs/glu/lib/ios/glu-ios.a (2 slices)
Undefined symbols for architecture i386:
  "_fwrite$UNIX2003", referenced from:
      _WriteProc(void*, unsigned int, unsigned int, void*) in freeimage.a(FreeImageIO.o-i386)
      LibRaw::dcraw_thumb_writer(char const*) in freeimage.a(libraw_cxx.o-i386)
      _opj_image_create in freeimage.a(image.o-i386)
      _png_default_write_data in freeimage.a(pngwio.o-i386)
      LibRaw::ppm_thumb() in freeimage.a(dcraw_common.o-i386)
      LibRaw::jpeg_thumb_writer(__sFILE*, char*, int) in freeimage.a(dcraw_common.o-i386)
      LibRaw::write_ppm_tiff() in freeimage.a(dcraw_common.o-i386)
      ...
  "_mktime$UNIX2003", referenced from:
      LibRaw::get_timestamp(int) in freeimage.a(dcraw_common.o-i386)
      LibRaw::parse_rollei() in freeimage.a(dcraw_common.o-i386)
      LibRaw::parse_riff() in freeimage.a(dcraw_common.o-i386)
  "_strerror$UNIX2003", referenced from:
      Iex::throwErrnoExc(std::string const&, int) in freeimage.a(IexThrowErrnoExc.o-i386)
  "_strtod$UNIX2003", referenced from:
      _png_handle_sCAL in freeimage.a(pngrutil.o-i386)
ld: symbol(s) not found for architecture i386
clang: error: linker command failed with exit code 1 (use -v to see invocation)

_fwrite$UNIX2003ってなんだ・・・ :sweat: 検索してみた。

FreeImage has undefined symbols for i386 for Xcode 6 beta 6 + iOS Simulator · Issue #3178

extern "C" {
    size_t fwrite$UNIX2003( const void *a, size_t b, size_t c, FILE *d )
    {
        return fwrite(a, b, c, d);
    }
    char* strerror$UNIX2003( int errnum )
    {
        return strerror(errnum);
    }
    time_t mktime$UNIX2003(struct tm * a)
    {
        return mktime(a);
    }
    double strtod$UNIX2003(const char * a, char ** b) {
        return strtod(a, b);
    }
}

上のようにダミーの関数定義を追加すればよいらしい。ofrubyのmain.mmに関数を追加したら動くようになった。

8ee9073 · ongaeshi/ofruby-ios

これでiOS8でもofrubyが動きそうだ。

5
5
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5
5

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?