GithubHelp home page GithubHelp logo

Comments (8)

mattn avatar mattn commented on July 24, 2024

ここ

でエラーが出ているようなのですが、環境変数 OS には Windows_NT を設定されておられますか?

from mruby-onig-regexp.

mattn avatar mattn commented on July 24, 2024

あ、失礼しました。条件が逆ですね。cross-compiler 用の make や lib を使わないといけないんですね。

from mruby-onig-regexp.

bu-kurokky avatar bu-kurokky commented on July 24, 2024

cross-compiler 用の make や lib を使わないといけないんですね。

色々交錯させて、すいません。そうですMac上でmingwの64bitのバイナリの生成が目的なのであくまでMacにcross-complier用にtarを落としてチャレンジしています。

from mruby-onig-regexp.

mattn avatar mattn commented on July 24, 2024

すみません。クロスコンパイラ用のコマンド名を教えて頂けますか。xxx-make や xxx-gcc という名前かと思います。

from mruby-onig-regexp.

bu-kurokky avatar bu-kurokky commented on July 24, 2024

x86_64-w64-mingw32-gcc になると思います。
rakeからのログを貼っておきます。

$rake
autotools /Users/kurokky/darkmode/mruby/test_project/mruby/build/x86_64-w64-mingw32/mrbgems/mruby-onig-regexp/onigmo-6.2.0 
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for x86_64-w64-mingw32-strip... x86_64-w64-mingw32-strip
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking for x86_64-w64-mingw32-gcc... x86_64-w64-mingw32-gcc -g -std=gnu99 -O3 -Wall -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wwrite-strings
checking whether the C compiler works... yes
checking for C compiler default output file name... a.exe
checking for suffix of executables... .exe
checking whether we are cross compiling... yes
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether x86_64-w64-mingw32-gcc -g -std=gnu99 -O3 -Wall -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wwrite-strings accepts -g... yes
checking for x86_64-w64-mingw32-gcc -g -std=gnu99 -O3 -Wall -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wwrite-strings option to accept ISO C89... none needed
checking whether x86_64-w64-mingw32-gcc -g -std=gnu99 -O3 -Wall -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wwrite-strings understands -c and -o together... yes
checking for style of include used by make... GNU
checking dependency style of x86_64-w64-mingw32-gcc -g -std=gnu99 -O3 -Wall -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wwrite-strings... gcc3
checking build system type... x86_64-apple-darwin21.2.0
checking host system type... x86_64-w64-mingw32
checking how to print strings... printf
checking for a sed that does not truncate output... /usr/local/bin/gsed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by x86_64-w64-mingw32-gcc -g -std=gnu99 -O3 -Wall -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wwrite-strings... x86_64-w64-mingw32-gcc -L/usr/local/opt/zlib/lib
checking if the linker (x86_64-w64-mingw32-gcc -L/usr/local/opt/zlib/lib) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/local/bin/x86_64-w64-mingw32-nm -B
checking the name lister (/usr/local/bin/x86_64-w64-mingw32-nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 786432
checking how to convert x86_64-apple-darwin21.2.0 file names to x86_64-w64-mingw32 format... func_convert_file_nix_to_w32
checking how to convert x86_64-apple-darwin21.2.0 file names to toolchain format... func_convert_file_noop
checking for x86_64-w64-mingw32-gcc -L/usr/local/opt/zlib/lib option to reload object files... -r
checking for x86_64-w64-mingw32-objdump... x86_64-w64-mingw32-objdump
checking how to recognize dependent libraries... file_magic ^x86 archive import|^x86 DLL
checking for x86_64-w64-mingw32-dlltool... x86_64-w64-mingw32-dlltool
checking how to associate runtime and link libraries... func_cygming_dll_for_implib
checking for x86_64-w64-mingw32-ar... x86_64-w64-mingw32-gcc-ar
checking for archiver @FILE support... @
checking for x86_64-w64-mingw32-strip... (cached) x86_64-w64-mingw32-strip
checking for x86_64-w64-mingw32-ranlib... x86_64-w64-mingw32-ranlib
checking command to parse /usr/local/bin/x86_64-w64-mingw32-nm -B output from x86_64-w64-mingw32-gcc -g -std=gnu99 -O3 -Wall -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wwrite-strings object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for x86_64-w64-mingw32-mt... no
checking for mt... no
checking if : is a manifest tool... no
checking how to run the C preprocessor... x86_64-w64-mingw32-gcc -g -std=gnu99 -O3 -Wall -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wwrite-strings -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking for dlfcn.h... no
checking for objdir... .libs
checking if x86_64-w64-mingw32-gcc -g -std=gnu99 -O3 -Wall -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wwrite-strings supports -fno-rtti -fno-exceptions... no
checking for x86_64-w64-mingw32-gcc -g -std=gnu99 -O3 -Wall -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wwrite-strings option to produce PIC... -DDLL_EXPORT -DPIC
checking if x86_64-w64-mingw32-gcc -g -std=gnu99 -O3 -Wall -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wwrite-strings PIC flag -DDLL_EXPORT -DPIC works... yes
checking if x86_64-w64-mingw32-gcc -g -std=gnu99 -O3 -Wall -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wwrite-strings static flag -static works... yes
checking if x86_64-w64-mingw32-gcc -g -std=gnu99 -O3 -Wall -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wwrite-strings supports -c -o file.o... yes
checking if x86_64-w64-mingw32-gcc -g -std=gnu99 -O3 -Wall -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wwrite-strings supports -c -o file.o... (cached) yes
checking whether the x86_64-w64-mingw32-gcc -g -std=gnu99 -O3 -Wall -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wwrite-strings linker (x86_64-w64-mingw32-gcc -L/usr/local/opt/zlib/lib) supports shared libraries... yes
checking dynamic linker characteristics... Win32 ld.exe
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... no
checking whether to build static libraries... yes
checking whether make sets $(MAKE)... (cached) yes
checking for python3... python3
checking for ANSI C header files... (cached) yes
checking sys/time.h usability... yes
checking sys/time.h presence... yes
checking for sys/time.h... yes
checking for unistd.h... (cached) yes
checking sys/times.h usability... no
checking sys/times.h presence... no
checking for sys/times.h... no
checking for stdint.h... (cached) yes
checking size of int... 4
checking size of short... 2
checking size of long... 4
checking size of void*... 8
checking size of long long... 8
checking for an ANSI C-conforming const... yes
checking whether time.h and sys/time.h may both be included... yes
checking for size_t... yes
checking for working alloca.h... no
checking for alloca... yes
checking for working memcmp... no
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
config.status: creating onigmo-config
config.status: creating sample/Makefile
config.status: creating config.h
config.status: config.h is unchanged
config.status: executing depfiles commands
config.status: executing libtool commands
config.status: executing default commands
/Applications/Xcode.app/Contents/Developer/usr/bin/make  all-recursive
Making all in .
/bin/sh ./libtool  --tag=CC   --mode=link x86_64-w64-mingw32-gcc -g -std=gnu99 -O3 -Wall -Werror-implicit-function-declaration -Wdeclaration-after-statement -Wwrite-strings -Wall -g -O2 -version-info 6:5:0 -no-undefined -L/usr/local/opt/zlib/lib -o libonigmo.la -rpath /usr/local/lib regerror.lo regparse.lo regext.lo regcomp.lo regexec.lo reggnu.lo regenc.lo regsyntax.lo regtrav.lo regversion.lo st.lo regposix.lo regposerr.lo enc/unicode.lo enc/ascii.lo enc/utf_8.lo enc/utf_16be.lo enc/utf_16le.lo enc/utf_32be.lo enc/utf_32le.lo enc/euc_jp.lo enc/shift_jis.lo enc/windows_31j.lo enc/iso_8859_1.lo enc/iso_8859_2.lo enc/iso_8859_3.lo enc/iso_8859_4.lo enc/iso_8859_5.lo enc/iso_8859_6.lo enc/iso_8859_7.lo enc/iso_8859_8.lo enc/iso_8859_9.lo enc/iso_8859_10.lo enc/iso_8859_11.lo enc/iso_8859_13.lo enc/iso_8859_14.lo enc/iso_8859_15.lo enc/iso_8859_16.lo enc/euc_tw.lo enc/euc_kr.lo enc/big5.lo enc/gb18030.lo enc/koi8_r.lo enc/koi8_u.lo enc/windows_1250.lo enc/windows_1251.lo enc/windows_1252.lo enc/windows_1253.lo enc/windows_1254.lo enc/windows_1257.lo  
libtool: link: lib -OUT:.libs/libonigmo.lib  regerror.o regparse.o regext.o regcomp.o regexec.o reggnu.o regenc.o regsyntax.o regtrav.o regversion.o st.o regposix.o regposerr.o enc/unicode.o enc/ascii.o enc/utf_8.o enc/utf_16be.o enc/utf_16le.o enc/utf_32be.o enc/utf_32le.o enc/euc_jp.o enc/shift_jis.o enc/windows_31j.o enc/iso_8859_1.o enc/iso_8859_2.o enc/iso_8859_3.o enc/iso_8859_4.o enc/iso_8859_5.o enc/iso_8859_6.o enc/iso_8859_7.o enc/iso_8859_8.o enc/iso_8859_9.o enc/iso_8859_10.o enc/iso_8859_11.o enc/iso_8859_13.o enc/iso_8859_14.o enc/iso_8859_15.o enc/iso_8859_16.o enc/euc_tw.o enc/euc_kr.o enc/big5.o enc/gb18030.o enc/koi8_r.o enc/koi8_u.o enc/windows_1250.o enc/windows_1251.o enc/windows_1252.o enc/windows_1253.o enc/windows_1254.o enc/windows_1257.o
./libtool: line 1727: lib: command not found
make[2]: *** [libonigmo.la] Error 127
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
rake aborted!
make -j1 failed

from mruby-onig-regexp.

mattn avatar mattn commented on July 24, 2024

解せないのがクロスコンパイルなので mingw 系が使われるはずなんですが、-OUT: という Visual Studio 系のフラグが使われてるんですよね。クロスコンパイルする際に環境変数 CC 等を設定されておられますか?

from mruby-onig-regexp.

bu-kurokky avatar bu-kurokky commented on July 24, 2024

build_config.rbも特に明示的に指定していないんですよね。
Rakefileもmruby-cliで生成されたものをそのまま未編集で使っているので…
で、もし環境変数依存であればmruby-pcre-regexpも同じくエラーになると思うのですが、こちらはbuildちゃんと通っちゃうんですよね。

def gem_config(conf)
  #conf.gembox 'default'
  conf.gembox 'full-core'
  conf.gem :mgem => 'mruby-getopts'
  conf.gem :github => 'iij/mruby-io'
  conf.gem :github => 'iij/mruby-dir'
  conf.gem :github => 'iij/mruby-iijson'
  conf.gem :github => 'iij/mruby-pack'
  conf.gem :github => 'gromnitsky/mruby-dir-glob'
  conf.gem :github => 'bamchoh/mruby-expat'
  conf.gem :github => 'mattn/mruby-onig-regexp'
  #conf.gem :github => 'mattn/mruby-pcre-regexp' #←こちらだとbuildできる
  conf.gem File.expand_path(File.dirname(__FILE__))
end

MRuby::Build.new do |conf|
  toolchain :clang
  conf.enable_bintest
  conf.enable_debug
  conf.enable_test
  gem_config(conf)
end


MRuby::CrossBuild.new('x86_64-w64-mingw32') do |conf|
  toolchain :gcc
  [conf.cc, conf.linker].each do |cc|
    cc.command = 'x86_64-w64-mingw32-gcc'
  end
  conf.cxx.command      = 'x86_64-w64-mingw32-cpp'
  conf.archiver.command = 'x86_64-w64-mingw32-gcc-ar'
  conf.exts.executable  = ".exe"

  conf.build_target     = 'x86_64-pc-linux-gnu'
  conf.host_target      = 'x86_64-w64-mingw32'
  gem_config(conf)
end

from mruby-onig-regexp.

buty4649 avatar buty4649 commented on July 24, 2024

横から失礼します。
こちらの問題ですが、x86_64-w64-mingw32-gccをインストールしたWSL環境でも発生して悩んでいたところ、こちらのissueをみつけたのでコメントさせていただきます。

原因がたぶんわかった(間違っていたらすみません。。)ので共有させていただきます。
結論から書きますとmingwをhostに指定している場合libコマンドを使うような特別な処理がconfigureに組み込まれているようです。
以下はconfigureの該当部分の抜粋です(👈は注釈です)。

# L9589付近
	case $host_os in aix4.[012]|aix4.[012].*) 👈 host情報で分岐
-- snip --
# L9792付近
    cygwin* | mingw* | pw32* | cegcc*) 👈 mingwはここに入る
      # When not using gcc, we currently assume that we are using
      # Microsoft Visual C++.
      # hardcode_libdir_flag_spec is actually meaningless, as there is
      # no search path for DLLs.
      case $cc_basename in 👈 ccコマンド?を見てさらに判定
      cl*)
	# Native MSVC
-- snip --
# 9829付近
      *) 👈 cl* 以外のコマンドはこちら
	# Assume MSVC wrapper
	hardcode_libdir_flag_spec=' '
	allow_undefined_flag=unsupported
	# Tell ltmain to make .lib files, not .a files.
	libext=lib
	# Tell ltmain to make .dll files, not .so files.
	shrext_cmds=.dll
	# FIXME: Setting linknames here is a bad hack.
	archive_cmds='$CC -o $lib $libobjs $compiler_flags `func_echo_all "$deplibs" | $SED '\''s/ -lc$//'\''` -link -dll~linknames='
	# The linker will automatically build a .lib file if we build a DLL.
	old_archive_from_new_cmds='true'   👈 old_archive_cmdsを使用するように変更?
	# FIXME: Should let the user specify the lib program.
	old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs' 👈libコマンドを使うように設定している
	enable_shared_with_static_runtimes=yes
	;;
-- snip --

mingwを使っている場合old_archive_from_new_cmdsとold_archive_cmds変数が設定されることで、mingw環境のみlibコマンドが使われるようになるようです。

次にこのコードがどのタイミングで挿入されるのかを調査しました。
(mruby-onig-regexpには同梱されていませんが)autogen.shを実行しconfigureを生成するタイミングで、libtoolにより挿入されているように見えました。
そう判断した理由としては、以下のlibtoolのコードに上記ににた記述があったのと、それがm4ファイルに記述されていたからです。
https://git.savannah.gnu.org/cgit/libtool.git/tree/m4/libtool.m4#n5638

ここからは憶測ですが、configureやlibtoolのコードのコメントに 「FIXME: Should let the user specify the lib program.」っとあるので今までmingwとlibtoolを使ってクロスコンパイルするユースケースが少なくて、問題が表面化していなかったのではないかと思います。

問題部分はわかったのですが、どうやって修正するかは私には見当がつかず。。。
一旦場当たり的ではありますが、configureにパッチをあてるような処理を追加し、手元の環境ではビルドが通ることを確認しております。
ご参考までにご紹介させていだきます。
buty4649@ce9bc7a

from mruby-onig-regexp.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.