Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build error on Windows with HEAD #17

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

Watson1978
Copy link

When I built the master branch code on Windows,
I got the following error.

PS C:\src\calyptia-cmetrics-ruby> ridk exec rake
mkdir -p tmp/x64-mingw-ucrt/cmetrics/3.4.1
cd tmp/x64-mingw-ucrt/cmetrics/3.4.1
C:/Ruby34-x64/bin/ruby.exe -I. ../../../../ext/cmetrics/extconf.rb
checking for whether cmake3 or cmake is usable... cmake
Downloading v0.5.9 (100%)

... (snip) ...

[ 88%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_decode_msgpack.c.obj
bash.exe: warning: could not find /tmp, please create!
C:/src/calyptia-cmetrics-ruby/tmp/x64-mingw-ucrt/cmetrics/3.3.6/tmp/x86_64-w64-mingw32/ports/cmetrics/0.5.9/cmetrics-0.5.9/src/cmt_decode_msgpack.c: In function 'unpack_basic_type_meta':
C:/src/calyptia-cmetrics-ruby/tmp/x64-mingw-ucrt/cmetrics/3.3.6/tmp/x86_64-w64-mingw32/ports/cmetrics/0.5.9/cmetrics-0.5.9/src/cmt_decode_msgpack.c:998:21: error: assignment to 'struct cmt_counter *' from incompatible pointer type 'struct counter *' [-Wincompatible-pointer-types]
  998 |             counter = (struct counter *) decode_context->map->parent;
      |                     ^
make[2]: *** [src/CMakeFiles/cmetrics-static.dir/build.make:410: src/CMakeFiles/cmetrics-static.dir/cmt_decode_msgpack.c.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:435: src/CMakeFiles/cmetrics-static.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
----- end of file -----
*** ../../../../ext/cmetrics/extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include=${opt-dir}/include
        --without-opt-include
        --with-opt-lib=${opt-dir}/lib
        --without-opt-lib
        --with-make-prog
        --without-make-prog
        --srcdir=../../../../ext/cmetrics
        --curdir
        --ruby=C:/Ruby34-x64/bin/$(RUBY_BASE_NAME)
C:/Ruby34-x64/lib/ruby/gems/3.4.0/gems/mini_portile2-2.8.8/lib/mini_portile2/mini_portile.rb:627:in 'block in MiniPortile#execute': Failed to complete compile task (RuntimeError)
        from C:/Ruby34-x64/lib/ruby/gems/3.4.0/gems/mini_portile2-2.8.8/lib/mini_portile2/mini_portile.rb:593:in 'Dir.chdir'
        from C:/Ruby34-x64/lib/ruby/gems/3.4.0/gems/mini_portile2-2.8.8/lib/mini_portile2/mini_portile.rb:593:in 'MiniPortile#execute'
        from C:/Ruby34-x64/lib/ruby/gems/3.4.0/gems/mini_portile2-2.8.8/lib/mini_portile2/mini_portile.rb:194:in 'MiniPortile#compile'
        from ../../../../ext/cmetrics/extconf.rb:121:in 'BuildCMetrics#build'
        from ../../../../ext/cmetrics/extconf.rb:145:in '<main>'
rake aborted!
Command failed with status (1): [C:/Ruby34-x64/bin/ruby.exe -I. ../../../../ext/cmetrics/extconf.rb]

Tasks: TOP => default => compile => compile:x64-mingw-ucrt => compile:cmetrics:x64-mingw-ucrt => copy:cmetrics:x64-mingw-ucrt:3.4.1 => tmp/x64-mingw-ucrt/cmetrics/3.4.1/cmetrics.so => tmp/x64-mingw-ucrt/cmetrics/3.4.1/Makefile
(See full trace by running task with --trace)

This patch will avoid above compile error on Windows.

This patch will avoid following compile error on Windows.

```
PS C:\src\calyptia-cmetrics-ruby> ridk exec rake
mkdir -p tmp/x64-mingw-ucrt/cmetrics/3.4.1
cd tmp/x64-mingw-ucrt/cmetrics/3.4.1
C:/Ruby34-x64/bin/ruby.exe -I. ../../../../ext/cmetrics/extconf.rb
checking for whether cmake3 or cmake is usable... cmake
Downloading v0.5.9 (100%)

... (snip) ...

[ 88%] Building C object src/CMakeFiles/cmetrics-static.dir/cmt_decode_msgpack.c.obj
bash.exe: warning: could not find /tmp, please create!
C:/src/calyptia-cmetrics-ruby/tmp/x64-mingw-ucrt/cmetrics/3.3.6/tmp/x86_64-w64-mingw32/ports/cmetrics/0.5.9/cmetrics-0.5.9/src/cmt_decode_msgpack.c: In function 'unpack_basic_type_meta':
C:/src/calyptia-cmetrics-ruby/tmp/x64-mingw-ucrt/cmetrics/3.3.6/tmp/x86_64-w64-mingw32/ports/cmetrics/0.5.9/cmetrics-0.5.9/src/cmt_decode_msgpack.c:998:21: error: assignment to 'struct cmt_counter *' from incompatible pointer type 'struct counter *' [-Wincompatible-pointer-types]
  998 |             counter = (struct counter *) decode_context->map->parent;
      |                     ^
make[2]: *** [src/CMakeFiles/cmetrics-static.dir/build.make:410: src/CMakeFiles/cmetrics-static.dir/cmt_decode_msgpack.c.obj] Error 1
make[1]: *** [CMakeFiles/Makefile2:435: src/CMakeFiles/cmetrics-static.dir/all] Error 2
make: *** [Makefile:156: all] Error 2
----- end of file -----
*** ../../../../ext/cmetrics/extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers.  Check the mkmf.log file for more details.  You may
need configuration options.

Provided configuration options:
        --with-opt-dir
        --without-opt-dir
        --with-opt-include=${opt-dir}/include
        --without-opt-include
        --with-opt-lib=${opt-dir}/lib
        --without-opt-lib
        --with-make-prog
        --without-make-prog
        --srcdir=../../../../ext/cmetrics
        --curdir
        --ruby=C:/Ruby34-x64/bin/$(RUBY_BASE_NAME)
C:/Ruby34-x64/lib/ruby/gems/3.4.0/gems/mini_portile2-2.8.8/lib/mini_portile2/mini_portile.rb:627:in 'block in MiniPortile#execute': Failed to complete compile task (RuntimeError)
        from C:/Ruby34-x64/lib/ruby/gems/3.4.0/gems/mini_portile2-2.8.8/lib/mini_portile2/mini_portile.rb:593:in 'Dir.chdir'
        from C:/Ruby34-x64/lib/ruby/gems/3.4.0/gems/mini_portile2-2.8.8/lib/mini_portile2/mini_portile.rb:593:in 'MiniPortile#execute'
        from C:/Ruby34-x64/lib/ruby/gems/3.4.0/gems/mini_portile2-2.8.8/lib/mini_portile2/mini_portile.rb:194:in 'MiniPortile#compile'
        from ../../../../ext/cmetrics/extconf.rb:121:in 'BuildCMetrics#build'
        from ../../../../ext/cmetrics/extconf.rb:145:in '<main>'
rake aborted!
Command failed with status (1): [C:/Ruby34-x64/bin/ruby.exe -I. ../../../../ext/cmetrics/extconf.rb]

Tasks: TOP => default => compile => compile:x64-mingw-ucrt => compile:cmetrics:x64-mingw-ucrt => copy:cmetrics:x64-mingw-ucrt:3.4.1 => tmp/x64-mingw-ucrt/cmetrics/3.4.1/cmetrics.so => tmp/x64-mingw-ucrt/cmetrics/3.4.1/Makefile
(See full trace by running task with --trace)
```
@Watson1978 Watson1978 requested a review from a team as a code owner January 26, 2025 09:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant