Fix build error in cross-build with presym
Fix the following issues.
*
*
MODIFY
build_config/cross-32bit.rb
build_config/cross-32bit.rb
# Define cross build settings
MRuby::CrossBuild.new('cross-32bit') do |conf|
- toolchain :gcc
+ conf.toolchain :gcc
conf.cc.flags << "-m32"
conf.linker.flags << "-m32"

MODIFY
lib/mruby/build.rb
lib/mruby/build.rb
@@ -515,11 +515,7 @@ EOS
unless mrbcfile_external? || MRuby.targets['host']
# add minimal 'host'
MRuby::Build.new('host') do |conf|
- if ENV['VisualStudioVersion'] || ENV['VSINSTALLDIR']
- toolchain :visualcpp
- else
- toolchain :gcc
- end
+ conf.toolchain
conf.build_mrbc_exec
conf.disable_libmruby
conf.disable_presym
@@ -527,6 +523,10 @@ EOS
end
end
+ def mrbcfile
+ mrbcfile_external? ? super : MRuby::targets['host'].mrbcfile
+ end
+
def run_test
@test_runner.runner_options << verbose_flag
mrbtest = exefile("#{build_dir}/bin/mrbtest")

MODIFY
tasks/presym.rake
tasks/presym.rake
+mrbtest = "#{MRuby::Build.install_dir}/mrbtest"
all_prerequisites = ->(task_name, prereqs) do
Rake::Task[task_name].prerequisites.each do |prereq_name|
next if prereqs[prereq_name]
@@ -18,13 +19,14 @@ MRuby.each_target do |build|
prereqs = {}
pps = []
- mrbtest = "#{build.class.install_dir}/mrbtest"
+ build_dir = "#{build.build_dir}/"
mrbc_build_dir = "#{build.mrbc_build.build_dir}/" if build.mrbc_build
build.products.each do |product|
all_prerequisites.(product, prereqs) unless product == mrbtest
end
prereqs.each_key do |prereq|
next unless File.extname(prereq) == build.exts.object
+ next unless prereq.start_with?(build_dir)
next if mrbc_build_dir && prereq.start_with?(mrbc_build_dir)
pps << prereq.ext(build.exts.preprocessed)
end

Fix build error in cross-build with presym

Fix the following issues.

* https://github.com/mruby/mruby/pull/5220#issuecomment-757204258
* https://github.com/mruby/mruby/pull/5220#issuecomment-757205572