mruby / mruby

Lightweight Ruby

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

'/LIBPATH' issue

gvanem opened this issue · comments

I just discovered mruby, cloned it into f:\MinGW32\src\Languages\mruby,
built it with MSVC using rake.bat --build-all --trace -v and tested it a bit.
Seems way cool!

But I discovered that the generated bin/mruby-config.bat outputs this for --ldflags:

/NOLOGO /DEBUG /INCREMENTAL:NO /OPT:ICF /OPT:REF 
/LIBPATH:F:\MinGW32\src\Languages\mruby\build\host\bin\/lib

How is link.exe (from bin\mruby-config.bat --ld) supposed to understand this host\bin\/lib part?
Where does it come from? It better be:

/LIBPATH:F:\MinGW32\src\Languages\mruby\build\host\bin\..\lib

or expanded to f:\MinGW32\src\Languages\mruby\build\host\lib.

I couldn't reproduce, just as a reference.

I checked with the latest development version and could not confirm the problem.
I also do not see the \/ characters.

I tried GitHub Actions and it compiles without any problems.
https://github.com/dearblue/mruby/actions/runs/7668737364/job/20901140806#step:7:28

I also do not see the / characters.

This comes from a dirname command. I have Cygwin64 installed.
The generated build/host/lib/libmruby.flags.mak have:

MRUBY_PACKAGE_DIR_GNU := $(shell dirname "$(lastword $(MAKEFILE_LIST))")
MRUBY_PACKAGE_DIR != dirname "$(MRUBY_PACKAGE_DIR_GNU)"

But what directory is this invoked in? Current or build/host/lib?

I built via this .bat-file:

@echo off
setlocal
rm -f vc14*.pdb
rm -fr build bin
set CL=-wd4244 -wd4267
call rake.bat --build-all --trace --verbose -f Rakefile %$ >&> build.log

But failed to see from the trace what directory was used.

In the case of the mruby-config.bat file, the MRUBY_PACKAGE_DIR variable is set in the same file.

The changes in this part were made by me, and I just checked them on FreeBSD+Wine and on GitHub Actions.
11513ba#diff-e286817b515dced924ff9828936c47c2ab125746d603081628673d5d9c2540a2

I would like to fix it if I could find the cause of the output of host\bin\/lib, but unfortunately I can't do anything about it because I can't check it myself.

I am not a batch file expert but I suspect set MRUBY_PACKAGE_DIR=%~f1 in line 12 of mruby-config.bat template converts path separators in MRUBY_PACKAGE_DIR to \, then later it is joined with /lib.
I have no idea how to fix this though.

I have no idea how to fix this though.

How about moving it to <ROOT>\build\host\mruby-config.bat? Then it shows almost correctly:
/LIBPATH:F:\MinGW32\src\Languages\mruby\build\host\/lib - should not hurt.

But effin ugly CMD syntax in that .bat-file.

@gvanem,
Could you please check this patch?
dearblue@8f3997b

I would appreciate it if you could try one of the following methods.

  • Run git checkout --detach origin/master and git pull https://github.com/dearblue/mruby.git 8f3997b842e182548d85e947dc7ba7deb41695b6, and rake clean all
  • Or, edit the existing build/host/bin/mruby-config.bat file directly
  • Or, download and extract artifact from https://github.com/dearblue/mruby/actions/runs/7931398518

I did all the steps in the first item. Seems to be OK now:

f:\MinGW32\src\Languages\mruby> bin\mruby-config.bat --ldflags
/NOLOGO /DEBUG /INCREMENTAL:NO /OPT:ICF /OPT:REF /LIBPATH:F:\MinGW32\src\Languages\mruby\build\host\bin\../lib

But yet to be tested on some package. Which and how should I try? (I'm really a n00b WRT Ruby/Mruby).

Thank you for confirming.
I will change the commit message and create a pull request.


But yet to be tested on some package.

If that means "complete mruby test", try rake MRUBY_CONFIG=ci/msvc test.
However, the bin/mruby-config test unfortunately still does not exist.

Which and how should I try? (I'm really a n00b WRT Ruby/Mruby).

This may not be an appropriate induction, but the discussion is just opening up about the direction of documentation for beginners.
#6170