samhh / bukubrow-host

Host application for the Bukubrow WebExtension
GNU General Public License v3.0
110 stars 7 forks source link

Windows support #5

Open samhh opened 5 years ago

samhh commented 5 years ago
farzadmf commented 5 years ago

I was trying to see if I can do something about it, and I was wondering if anything was started for this? If not, any lead or tip would be appreciated :) ;p

samhh commented 5 years ago

Hey @farzadmf!

Nope, nothing has been started on this yet. The post from someone else in that referenced issue above (old repo for the host - also it used to be written in Go, but that's irrelevant) might help.

First place I'd start is here, then just battle errors and issues as you hit them. I can help with the code if needed, but I know nothing about Windows as a development platform, hence the lack of support to this point.

farzadmf commented 5 years ago

Thank you @SamHH for the reply, I think that's a good starting point. For now, I was able to build a Windows exe file locally (on Windows) and create the zip file. I will check if I can create the file on Linux on my home computer, and continue from there

farzadmf commented 5 years ago

Hi @SamHH

I'm not very familiar with rust 😛; I thought you might be able to help me. On Windows, I could easily build the project for target x86_64-pc-windows-msvc. After searching the internet, I added using rustup target add x86_64-pc-windows-msvc, however, when I want to build, it fails with this message (sorry it's long, I just copy/pasted to whole thing!):

Compiling proc-macro2 v0.4.19
Compiling pkg-config v0.3.14
Compiling winapi v0.3.6
Compiling cc v1.0.25
Compiling unicode-xid v0.1.0
Compiling memchr v2.2.0
Compiling ryu v0.2.6
Compiling serde v1.0.79
Compiling linked-hash-map v0.4.2
Compiling unicode-width v0.1.5
Compiling byteorder v1.3.1
Compiling libc v0.2.43
Compiling cfg-if v0.1.5
Compiling fallible-streaming-iterator v0.1.9
Compiling bitflags v1.0.4
Compiling widestring v0.4.0
Compiling vec_map v0.8.1
Compiling itoa v0.4.3
Compiling strsim v0.8.0
Compiling fallible-iterator v0.2.0
Compiling lru-cache v0.1.1
Compiling textwrap v0.11.0
Compiling quote v0.6.8
Compiling syn v0.15.6
Compiling libsqlite3-sys v0.15.0
error: failed to run custom build command for `libsqlite3-sys v0.15.0`

Caused by:
process didn't exit successfully: `/home/farzad/bin/temp/temp-github/bukubrow-host/target/release/build/libsqlite3-sys-74da27a490a84adf/build-script-build` (exit code: 101)
--- stdout
cargo:rerun-if-env-changed=SQLITE_MAX_VARIABLE_NUMBER
cargo:rerun-if-env-changed=SQLITE_MAX_EXPR_DEPTH
TARGET = Some("x86_64-pc-windows-msvc")
OPT_LEVEL = Some("3")
HOST = Some("x86_64-unknown-linux-gnu")
CC_x86_64-pc-windows-msvc = None
CC_x86_64_pc_windows_msvc = None
TARGET_CC = None
CC = None
CROSS_COMPILE = None
CFLAGS_x86_64-pc-windows-msvc = None
CFLAGS_x86_64_pc_windows_msvc = None
TARGET_CFLAGS = None
CFLAGS = None
DEBUG = Some("false")
running: "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-Wall" "-Wextra" "-DSQLITE_CORE" "-DSQLITE_DEFAULT_FOREIGN_KEYS=1" "-DSQLITE_ENABLE_API_ARMOR" "-DSQLITE_ENABLE_COLUMN_METADATA" "-DSQLITE_ENABLE_DBSTAT_VTAB" "-DSQLITE_ENABLE_FTS3" "-DSQLITE_ENABLE_FTS3_PARENTHESIS" "-DSQLITE_ENABLE_FTS5" "-DSQLITE_ENABLE_JSON1" "-DSQLITE_ENABLE_LOAD_EXTENSION=1" "-DSQLITE_ENABLE_MEMORY_MANAGEMENT" "-DSQLITE_ENABLE_RTREE" "-DSQLITE_ENABLE_STAT2" "-DSQLITE_ENABLE_STAT4" "-DSQLITE_HAVE_ISNAN" "-DSQLITE_SOUNDEX" "-DSQLITE_THREADSAFE=1" "-DSQLITE_USE_URI" "-DHAVE_USLEEP=1" "/Fo/home/farzad/bin/temp/temp-github/bukubrow-host/target/x86_64-pc-windows-msvc/release/build/libsqlite3-sys-26abfe4612b4a8af/out/sqlite3/sqlite3.o" "/c" "sqlite3/sqlite3.c"
cargo:warning=cc: error: /Fo/home/farzad/bin/temp/temp-github/bukubrow-host/target/x86_64-pc-windows-msvc/release/build/libsqlite3-sys-26abfe4612b4a8af/out/sqlite3/sqlite3.o: No such file or directory
cargo:warning=cc: error: /c: No such file or directory
exit code: 1

--- stderr
thread 'main' panicked at '

Internal error occurred: Command "cc" "-O3" "-ffunction-sections" "-fdata-sections" "-fPIC" "-m64" "-Wall" "-Wextra" "-DSQLITE_CORE" "-DSQLITE_DEFAULT_FOREIGN_KEYS=1" "-DSQLITE_ENABLE_API_ARMOR" "-DSQLITE_ENABLE_COLUMN_METADATA" "-DSQLITE_ENABLE_DBSTAT_VTAB" "-DSQLITE_ENABLE_FTS3" "-DSQLITE_ENABLE_FTS3_PARENTHESIS" "-DSQLITE_ENABLE_FTS5" "-DSQLITE_ENABLE_JSON1" "-DSQLITE_ENABLE_LOAD_EXTENSION=1" "-DSQLITE_ENABLE_MEMORY_MANAGEMENT" "-DSQLITE_ENABLE_RTREE" "-DSQLITE_ENABLE_STAT2" "-DSQLITE_ENABLE_STAT4" "-DSQLITE_HAVE_ISNAN" "-DSQLITE_SOUNDEX" "-DSQLITE_THREADSAFE=1" "-DSQLITE_USE_URI" "-DHAVE_USLEEP=1" "/Fo/home/farzad/bin/temp/temp-github/bukubrow-host/target/x86_64-pc-windows-msvc/release/build/libsqlite3-sys-26abfe4612b4a8af/out/sqlite3/sqlite3.o" "/c" "sqlite3/sqlite3.c" with args "cc" did not execute successfully (status code exit code: 1).

', /home/farzad/bin/tools/cargo/registry/src/github.com-1ecc6299db9ec823/cc-1.0.25/src/lib.rs:2260:5
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace.

warning: build failed, waiting for other jobs to finish...
error: build failed

Do you know what's happening? Thank you

samhh commented 5 years ago

Hey @farzadmf, it's very likely that you don't have SQLite installed, or it's something at least related to SQLite - see the README of the dependency we use.

farzadmf commented 5 years ago

Thank you for your replay @SamHH . I did some digging, and, if I'm not mistaken, when we use bundled with rusqlite, it's supposed to use sqlite source bundled with sqlite3-sys.

Here, it's looking for sqlite object file:

.../release/build/libsqlite3-sys-26abfe4612b4a8af/out/sqlite3/sqlite3.o

but it cannot find it. Do you know what's happening or I would need to open an issue with them?

samhh commented 5 years ago

You're right.

First thing to try is just updating the library in Cargo.toml, and if that doesn't help then yeah I'd open an issue over there.

Trisk3lion commented 4 years ago

I got bukubrow to work with Chrome under Windows by running buku and bukubrow under Windows Subsystem for Linux (WSL). Should I do a pull request with instructions to the Readme?

farzadmf commented 4 years ago

I got bukubrow to work with Chrome under Windows by running buku and bukubrow under Windows Subsystem for Linux (WSL). Should I do a pull request with instructions to the Readme?

I for one am very curious 🙂

ABuffEr commented 3 years ago

Hi, I just compiled bukubrow successfully, changing from: rusqlite = { version = "0.19", features = ["bundled"] } to: rusqlite = { version = "0.21.0", features = ["bundled"] } in Cargo.toml, according to this page, and then compiling with: cargo build --release --target=x86_64-pc-windows-gnu (-gnu, not -msvc, is the toolchain I found installed automatically with rust from chocolatey, no idea if it's better) However, @Trisk3lion , I'm interested to your solution too. Hth :)

samhh commented 3 years ago

Currently fails to build in CI: https://github.com/samhh/bukubrow-host/actions/runs/690696823

Curious if anyone with a Windows machine sees the same thing.

Trisk3lion commented 3 years ago

@farzadmf and @ABuffEr sorry for not replying, but here it comes.

  1. Install the bukubrow on the linux side as per instructions in the readme, don't forget to make it executable with: chmod +x bukubrow
  2. We need to add a key to the windows registry, preferable by creating a .reg file and running it:
    [HKEY_CURRENT_USER\Software\Google\Chrome\NativeMessagingHosts\com.samhh.bukubrow]
    @="C:\\path\\to\\bukubrow_manifest.json"
  3. Create the bukubrow_manifest.json file and place it according to the key above:
    {
    "name":"com.samhh.bukubrow",
    "description":"Bukubrow host for the Chrome extension",
    "path":"C:\\path\\to\\bukubrow_wsl.bat",
    "type":"stdio",
    "allowed_origins":["chrome-extension://ghniladkapjacfajiooekgkfopkjblpn/"]
    }
  4. Create the bukubrow_wsl.bat file and place it according to the .json file above:
    @echo off
    bash -c "/home/USER/.local/bin/bukubrow 2>/dev/null"

    I think you could probably switch "bash -c" for "wsl" also.

  5. Profit! (Hopefully)

It even works for Microsoft Edge as well.

farzadmf commented 3 years ago

I don't visit Windows that much these days :stuck_out_tongue: :sunglasses: , but thank you @Trisk3lion for the detailed instructions, and maybe it's a good idea, as you suggested yourself, to create a PR with these instructions. I think it will be useful :slightly_smiling_face: