mattn/mruby-onig-regexp

ld: symbol(s) not found for architecture x86_64

Closed this issue · 3 comments

How can I integrate this mrbgem to run in IOS and Android device? I can compiled all code without errors. But when I execute the code for test on my Macbook, the error "ld: symbol(s) not found for architecture x86_64" occurs. Thanks!!

@torsakch I don't know if you're still working on this but you need to build onigmo or oniguruma for all architecture used in iOS development.
And x86_64 seems to be the simulator of iOS so you need to build either of onig library with x86_64 that iOS simulator build accepts to make it link.

Closing since no response from the issue submitter.

I'm having this issue too, build_config.rb is simply:

MRuby::Build.new do |conf|
  toolchain :clang
  conf.gem :mgem => 'mruby-onig-regexp'
  conf.gembox 'default'
end

also tried

CC = `xcrun -find clang`.strip
def sdk_path(device); `xcrun --sdk #{device} --show-sdk-path`.strip end
MACOS_FLAGS = %W(-Os -arch x86_64 -isysroot #{sdk_path 'macosx'})

MRuby::Build.new do |conf|
  toolchain :clang
  conf.gem :mgem => 'mruby-onig-regexp'
  conf.gembox 'default'

  conf.cc do |cc|
    cc.command = CC
    cc.flags = MACOS_FLAGS
  end

  conf.linker do |linker|
    linker.command = CC
    linker.flags = MACOS_FLAGS
  end
end

compile and running machine is the same macOS machine (not trying iOS or anything special)

to compile mruby, I'm running

  rake deep_clean
  rake all

don't know if it's relevant, but building ruby files like

./mruby/bin/mrbc \
  -g \
  -Bapp \
  -o./app.c \
  app.rb

and trying to compile the binary using

clang output.c \
  -o./output \
  -I./mruby/include \
  -lmruby \
  -L./mruby/build/host/lib/

and also tried

$(xcrun -find clang) output.c \
  -o./output \
  -I./mruby/include \
  -lmruby \
  -L./mruby/build/host/lib/ \
  -Os -arch x86_64 -isysroot $(xcrun --sdk macosx --show-sdk-path)