kostya / lexbor

Fast HTML5 Parser with CSS selectors. This is successor of myhtml and expected to be faster and use less memory.
MIT License
95 stars 14 forks source link

install failed on windows? #28

Closed zw963 closed 1 year ago

zw963 commented 1 year ago

Please check following github actions log.

https://github.com/crystal-china/myip/actions/runs/4906430522/jobs/8760873874

BTW: shards install --without-development works before when i use Crystagiri.

Thanks.

kostya commented 1 year ago

try lexbor 3.1.0, it changed shards build.

zw963 commented 1 year ago

Hi, after update to 3.1.0, github action probably run infinitely, please check https://github.com/crystal-china/myip/actions/runs/4907721593/jobs/8763009656, current job blocked on shards install for 2 hours.

kostya commented 1 year ago

i dont know what the reason, maybe missing cmake dependency

kostya commented 1 year ago

if you have windows, you can run this manually: https://github.com/kostya/lexbor/blob/master/src/ext/build_ext.cr, to see where it hangs. Or you can run all cmd from that script manually in shell.

zw963 commented 1 year ago

yes, I test on virtual box, cmake is not available. so i install cmake use scoop successful. but still exist error, please check following screenshot.

image

kostya commented 1 year ago

i pushed small fix to master, can you check?

zw963 commented 1 year ago

i pushed small fix to master, can you check?

Not work.

image

kostya commented 1 year ago

looks like cmake issue on windows, it cant find compiler, need to google something about CMAKE_C_COMPILER some links suggest adding something like -G “Visual Studio 15 2017” to cmake command. maybe @etra0 can say how he run cmake.

kostya commented 1 year ago

nokolexbor using this options: -DCMAKE_SYSTEM_NAME=Windows -DWIN32=1 -G "MSYS Makefiles", can you check that it works?

etra0 commented 1 year ago

looks like cmake issue on windows, it cant find compiler, need to google something about CMAKE_C_COMPILER some links suggest adding something like -G “Visual Studio 15 2017” to cmake command. maybe @etra0 can say how he run cmake.

I think the initial issue was that it was using "Unix Makefiles", those are unsupported in Windows, in my old script I just let cmake choose the build system instead of specifying one myself. I can't test things right now though, I'm sorry.

etra0 commented 1 year ago

I just tried master and it seems to work on my machine:

Crystal 1.7.2 [29f9ac5] (2023-01-23)

LLVM: 13.0.1
Default target: x86_64-pc-windows-msvc

I haven't tried with latest crystal, though.

zw963 commented 1 year ago

I reboot my win10 and retry again. get same issue, see following screenshot.

image

BTW: my installed windows is a quite new win10 version, with only few software installed, and use scoop to initialize necessary dependencies.

kostya commented 1 year ago

can you check master again?

etra0 commented 1 year ago

@zw963 do you have the windows C/C++ compiler installed in that machine? you have to download it from here https://visualstudio.microsoft.com/downloads/. You don't need to install the IDE but you do have to install the compilers.

zw963 commented 1 year ago

can you check master again?

Still not work, check screenshot.

image

do you have the windows C/C++ compiler installed in that machine? you have to download it from here https://visualstudio.microsoft.com/downloads/.

I don't know, if you said cpp build tools, i guess i installed it. check following screenshot.

image

In fact, i just follow the document here, maybe missing install something use scoop?

kostya commented 1 year ago

this is another error. something about cmake cache. remove folder src/ext/lexbor-c and run script again.

zw963 commented 1 year ago

this is another error. something about cmake cache. remove folder src/ext/lexbor-c and run script again.

image

zw963 commented 1 year ago

I guess there still missing somethings which should be install use scoop, could you please point it out?

kostya commented 1 year ago

I not familiar with windows at all, so i dont know. Interesting if ruby gem nokolexbor installed for you? because i just copy it build flags.

zw963 commented 1 year ago

I not familiar with windows at all, so i dont know. Interesting if ruby gem nokolexbor installed for you? because i just copy it build flags.

Ask question on forum here, maybe someone can help.

https://forum.crystal-lang.org/t/help-on-install-shard-which-need-use-cmake-for-build-on-windows/5644

etra0 commented 1 year ago

latest commit broke the build on my end, too :( please consider doing a revert the commit https://github.com/kostya/lexbor/commit/f25ca193e2cd6fe2ebc8bd32b5703787ce69170a.

The flags I originally used in the script were the same used in one of the crystal Github Actions so these should work fine:

https://github.com/crystal-lang/crystal/blob/c5b81b8c341102e793a5abfe0892cacb23a19ad9/.github/workflows/win.yml#L60-L61

I'd suggest to OP to install Visual Studio from the link I sent instead of scoop, it's highly likely that some things aren't in the path or correctly installed, as it seems it keeps complaining about the C compiler.

kostya commented 1 year ago

i dont know how many architectures windows have, but if 1 or 2, may be easier to prebuild library and just download it.

zw963 commented 1 year ago

I'd suggest to OP to install Visual Studio from the link I sent instead of scoop, it's highly likely that some things aren't in the path or correctly installed, as it seems it keeps complaining about the C compiler.

I expect a way to install all needed dependencies from command line, that is, scoop.

but, if previous commit work well on github action, please revert it, then i can try it in my https://github.com/crystal-china/crystal_hello_world project for test if it work on github action windows-2022

etra0 commented 1 year ago

@zw963 I made a PR to add Windows to the CI to lexbor (https://github.com/kostya/lexbor/pull/29). You can take that as a basis for makinga Github Action. Notice that, currently some of the tests are failing because of the handling of new lines but that should be a separated issue.

zw963 commented 1 year ago

@zw963 I made a PR to add Windows to the CI to lexbor (#29). You can take that as a basis for makinga Github Action. Notice that, currently some of the tests are failing because of the handling of new lines but that should be a separated issue.

Cool, i follow your's guides to fix my workflow, lexbor can be compiled successful on github action use latest master 24446a4, though it still failed on my own win10, but compiled binary from github action is running in my win10, thanks!