Electron100 / butane

An ORM for Rust with a focus on simplicity and on writing Rust, not SQL
Apache License 2.0
93 stars 13 forks source link

butane-cli on windows exit silently without init database #7

Closed jackymao closed 3 years ago

jackymao commented 3 years ago

Hi Electron100,

Firstly thank you very much for building the Butane, the features and getting started code looks really exciting.

I am following the getting started tutorial on Windows, and meet problem on installing butane_cli.

When I run "cargo install butane_cli" at the first time, there is an error:

linking with link.exe failed: exit code: 1181
= note: LINK : fatal error LNK1181: cannot open input file 'sqlite3.lib'

so I use Developer Command Prompt for VS 2019 and downloaded the source code from sqlite official site, (download amalgamaation, dll-win64-x64, tools, extract these three in the same folder and run Developer Command Prompt and build in this folder. Thanks to itdevwu's blog ) and build the sqlite3.lib:

Developer Command Prompt for VS 2019.lnk

lib /DEF:sqlite3.def /OUT:sqlite3.lib /MACHINE:x64  

and then copy the generated sqlite3.lib into ".rustup\toolchains\stable-x86_64-pc-windows-msvc\lib\rustlib\x86_64-pc-windows-msvc\lib"

now I can install butane_cli and get the butane.exe file.

cargo install butane_cli  

and meet the final problem I can't solve:
when I run

butane init sqlite example.db

it does not generate example.db file and the .butane folder, and the command exit silently.

I have tried many other ways to update the sqlite3.lib and rebuild the butane_cli, still get no example.db showing.

Would you please help check and advice what I can do for now. Many thanks!

Best regards, Jacky


Sorry Electron100, spend you so much time reading this issue. I finally realized the problem and solved it as below:

copy the file sqlite3.dll into the ".cargo\bin" folder

The command "butane init sqlite example.db" works fine now.

Should I close this issue or is there a way to set the Cargo feature "sqlite-bundled" similar as below:

cargo install diesel_cli --no-default-features --features "sqlite-bundled"

Thanks again.

Electron100 commented 3 years ago

Hi @jackymao, thanks for the kind words. I'm glad you were able to get unblocked, but I do agree that a sqlite-bundled feature could make things smoother on Windows. I don't develop primarily on Windows myself, but I do have access to Windows machines, so I'll try this out later this week.

jackymao commented 3 years ago

Thank you very much for prompt reply @Electron100 , this makes me feel warmly welcomed on using Butane.

Since we are talking about Butane on Windows, I meet another small issue on butane_cli, please help also check it when you working on the Windows issue.

When I try to make a new post using butane_cli, following the getting started, "cargo run --bin write_post", the showing back information seems stacked 2 lines into one line. After trying to comment the line "s.pop() // Drop the newline" in src/bin/write_post.rs, it will looks better although it showing in 2 lines, but I think this line of code was set here to merge the 2 showing line on one line properly, unfortunately the windows system just make the lines stacked.

Have a nice day. And nice weekend.

Electron100 commented 3 years ago

Published 0.4.1 with the sqlite-bundled feature