Project

General

Profile

Actions

Bug #17588

closed

Cannot build with library path with spaces on MSVC

Added by jmarrec (Julien Marrec) 8 months ago. Updated about 1 month ago.

Status:
Closed
Priority:
Normal
Assignee:
-
Target version:
-
[ruby-core:102274]

Description

I checked out the ruby_2_7 from github, and I reproduced all steps in the github/workflows/windows.yml with success.

Then I edited the configure command here: https://github.com/ruby/ruby/blob/ruby_2_7/.github/workflows/windows.yml#L60 to include --with-static-linked-ext

..\win32\configure.bat --with-static-linked-ext --disable-install-doc --without-ext=+,dbm,gdbm --enable-bundled-libffi --with-opt-dir=C:/Users/julien/Software/Others/vcpkg/installed/x64-windows --with-openssl-dir="C:/Program Files/OpenSSL-Win64

It is failing with something that looks like it's due to an escaping problem: NMAKE : fatal error U1073: don't know how to make 'Files/OpenSSL-Win64/lib'. I don't know where to look to patch it...

Some more of the build log:

.....
linking static-library readline.lib
extracting ripper.y from ../../../parse.y
compiling compiler ripper.y
generating eventids1.c from ../../../parse.y
generating eventids2table.c from ../../../ext/ripper/eventids2.c
compiling ripper.c
ripper.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
linking static-library ripper.lib
installing default ripper libraries
cp ../../../ext/ripper/lib/ripper/core.rb ../../.ext/common/ripper
cp ../../../ext/ripper/lib/ripper/filter.rb ../../.ext/common/ripper
cp ../../../ext/ripper/lib/ripper/lexer.rb ../../.ext/common/ripper
cp ../../../ext/ripper/lib/ripper/sexp.rb ../../.ext/common/ripper
cp ../../../ext/ripper/lib/ripper.rb ../../.ext/common
checking ../../../parse.y and ../../../ext/ripper/eventids2.c
installing default libraries
cp ../../../ext/rubyvm/lib/forwardable/impl.rb ../../.ext/common/forwardable
compiling ../../../ext/sdbm/_sdbm.c
_sdbm.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/sdbm/init.c
init.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
linking static-library sdbm.lib
generating constant definitions
compiling ../../../ext/socket/init.c
init.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/socket/constants.c
constants.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/socket/basicsocket.c
basicsocket.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/socket/socket.c
socket.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/socket/ipsocket.c
ipsocket.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/socket/tcpsocket.c
tcpsocket.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/socket/tcpserver.c
tcpserver.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/socket/sockssocket.c
sockssocket.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/socket/udpsocket.c
udpsocket.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/socket/unixsocket.c
unixsocket.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/socket/unixserver.c
unixserver.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/socket/option.c
option.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/socket/ancdata.c
ancdata.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/socket/raddrinfo.c
raddrinfo.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/socket/ifaddr.c
ifaddr.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
linking static-library socket.lib
installing default socket libraries
cp ../../../ext/socket/lib/socket.rb ../../.ext/common
compiling ../../../ext/stringio/stringio.c
stringio.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
linking static-library stringio.lib
compiling ../../../ext/strscan/strscan.c
strscan.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
linking static-library strscan.lib
installing default libraries
cp ../../../ext/win32/lib/win32/importer.rb ../../.ext/common/win32
cp ../../../ext/win32/lib/win32/registry.rb ../../.ext/common/win32
cp ../../../ext/win32/lib/win32/resolv.rb ../../.ext/common/win32
cp ../../../ext/win32/lib/win32/resolv9x.rb ../../.ext/common/win32
cp ../../../ext/win32/lib/win32/sspi.rb ../../.ext/common/win32
cp ../../../ext/win32/lib/Win32API.rb ../../.ext/common
compiling ../../../../ext/win32/resolv/resolv.c
resolv.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
linking static-library resolv.lib
compiling ../../../ext/win32ole/win32ole.c
win32ole.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/win32ole/win32ole_error.c
win32ole_error.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/win32ole/win32ole_event.c
win32ole_event.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/win32ole/win32ole_method.c
win32ole_method.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/win32ole/win32ole_param.c
win32ole_param.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/win32ole/win32ole_record.c
win32ole_record.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/win32ole/win32ole_type.c
win32ole_type.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/win32ole/win32ole_typelib.c
win32ole_typelib.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/win32ole/win32ole_variable.c
win32ole_variable.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/win32ole/win32ole_variant.c
win32ole_variant.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
compiling ../../../ext/win32ole/win32ole_variant_m.c
win32ole_variant_m.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
linking static-library win32ole.lib
installing default win32ole libraries
cp ../../../ext/win32ole/lib/win32ole/property.rb ../../.ext/common/win32ole
cp ../../../ext/win32ole/lib/win32ole.rb ../../.ext/common
compiling ../../../ext/zlib/zlib.c
zlib.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
linking static-library zlib.lib
ext/extinit.c updated
compiling ext/extinit.c
extinit.c
C:\Users\julien\Software\Others\ruby\build\.ext\include\x64-mswin64_140\ruby/config.h(22): warning C4117: macro name '_INTEGRAL_MAX_BITS' is reserved, '#define' ignored
NMAKE : fatal error U1073: don't know how to make 'Files/OpenSSL-Win64/lib'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX64\x64\nmake.EXE"' : return code '0x2'
Stop.
NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.28.29333\bin\HostX64\x64\nmake.EXE"' : return code '0x2'
Stop.

Updated by MSP-Greg (Greg L) 8 months ago

It may be a copy paste issue, but does the line you edited (windows.yml#L60) end with a double quote?

Updated by nobu (Nobuyoshi Nakada) 8 months ago

As far as I tried years ago, cl.exe failed to pass library path with spaces to link.exe.

Actions #3

Updated by nobu (Nobuyoshi Nakada) 8 months ago

  • Subject changed from Cannot build 2.7.2 with `--with-static-linked-ext` on MSVC to Cannot build with library path with spaces on MSVC

Updated by jmarrec (Julien Marrec) about 1 month ago

I am revisiting this with the latest master today.

My command has quotes, and I am not changing the --with-openssl-dir="C:/Program Files/OpenSSL-Win64" which works plenty fine without --static-linked-ext

https://github.com/jmarrec/ruby/runs/3320867518?check_suite_focus=true

Workflow for run: https://github.com/jmarrec/ruby/actions/runs/1127227293/workflow : As you can see in that workflow, it issues the problem on the first nmake /k call here: https://github.com/jmarrec/ruby/runs/3320867518?check_suite_focus=true#step:10:1475

Then I issue a second one, and it finally issues another error because it can't find openssl.lib (openssl wasn't statically built via chocolatey, and that's ok).

This problem is specific to --static-linked-ext. Locally (or another CI run) if I install openssl somewhere else, I NEVER can build ruby the first time.

My first thing is I've noticed that if I strap --with-static-linked-ext to the configure options, then no matter what I try, I always have to build ruby twice. There's a dependency issue somewhere.
I always get this: https://ci.appveyor.com/project/ci-commercialbuildings/conan-openstudio-ruby/branch/master/job/e6r53wgvwfyyov1d?fullLog=true#L2240

generating enc.mk
  compiling enc/encinit.c
  encinit.c
NMAKE : fatal error U1073: don't know how to make 'enc/libenc.lib' [C:\Users\appveyor\.conan\data\openstudio_ruby\2.5.5\nrel\stable\build\45b3b9a1aa73fdb3ff32afdc2b2ddc0affca7928\Ruby.vcxproj]
  Stop.

on the first nmake /k command. With a second nmake /k it then works.

There is dependency issue when statically built, and it looks like a race condition as a result.

Updated by xtkoba (Tee KOBAYASHI) about 1 month ago

jmarrec (Julien Marrec) wrote in #note-4:

My first thing is I've noticed that if I strap --with-static-linked-ext to the configure options, then no matter what I try, I always have to build ruby twice. There's a dependency issue somewhere.
I always get this: https://ci.appveyor.com/project/ci-commercialbuildings/conan-openstudio-ruby/branch/master/job/e6r53wgvwfyyov1d?fullLog=true#L2240

generating enc.mk
  compiling enc/encinit.c
  encinit.c
NMAKE : fatal error U1073: don't know how to make 'enc/libenc.lib' [C:\Users\appveyor\.conan\data\openstudio_ruby\2.5.5\nrel\stable\build\45b3b9a1aa73fdb3ff32afdc2b2ddc0affca7928\Ruby.vcxproj]
  Stop.

on the first nmake /k command. With a second nmake /k it then works.

There is dependency issue when statically built, and it looks like a race condition as a result.

This should be fixed in 8a5e161cd9a251054e851d46ccc367609a31c1c7 (#17929).

Updated by jmarrec (Julien Marrec) about 1 month ago

I tried today with master (ac4d53bd461ff386cd45fdd484ffb6b628a251ad). So it isn't fixed by https://bugs.ruby-lang.org/projects/ruby-master/repository/git/revisions/8a5e161cd9a251054e851d46ccc367609a31c1c7

Updated by jmarrec (Julien Marrec) about 1 month ago

I'll try again, I'll report back. I see how your change could have fixed the enc/lib specifically indeed.

Updated by jmarrec (Julien Marrec) about 1 month ago

I think there's an issue somewhere in the configuration for msvc, missing a space between two conf args it seems.

Try 1

..\ruby\win32\configure.bat --disable-install-doc  --enable-bundled-libffi --with-opt-dir=C:/Users/julien/Software/Others/vcpkg/installed/x64-windows-static --with-static-linked-ext --enable-load-relative --with-openssl-dir=C:/openssl

Makefile: NOT OK --with-opt-dir is concatenated with --with-static-linked-ext

!ifndef CONFIGURE_ARGS
configure_args = --disable-install-doc --enable-bundled-libffi --with-opt-dir=C:/Users/julien/Software/Others/vcpkg/installed/x64-windows-static--with-static-linked-ext --enable-load-relative --with-openssl-dir=C:/openssl
!endif

Try 2

--with-opt-dir is last: OK

..\ruby\win32\configure.bat --disable-install-doc  --enable-bundled-libffi --with-static-linked-ext --enable-load-relative --with-openssl-dir=C:/openssl --with-opt-dir=C:/Users/julien/Software/Others/vcpkg/installed/x64-windows-static

Makefile: OK

!ifndef CONFIGURE_ARGS
configure_args = --disable-install-doc --enable-bundled-libffi --with-static-linked-ext --enable-load-relative --with-openssl-dir=C:/openssl --with-opt-dir=C:/Users/julien/Software/Others/vcpkg/installed/x64-windows-static
!endif
Actions #9

Updated by nobu (Nobuyoshi Nakada) about 1 month ago

  • Status changed from Open to Closed

Applied in changeset git|147bdcc436c888a56f81e190d192cd9312015836.


[Win32] put a space before configure options [Bug #17588]

Not to be concatenated with the preceding --with-* option.

Actions

Also available in: Atom PDF