{"action":"created","issue":{"url":"https://api.github.com/repos/diesel-rs/diesel/issues/487","repository_url":"https://api.github.com/repos/diesel-rs/diesel","labels_url":"https://api.github.com/repos/diesel-rs/diesel/issues/487/labels{/name}","comments_url":"https://api.github.com/repos/diesel-rs/diesel/issues/487/comments","events_url":"https://api.github.com/repos/diesel-rs/diesel/issues/487/events","html_url":"https://github.com/diesel-rs/diesel/issues/487","id":185624893,"number":487,"title":"Installing diesel_cli on Windows : some assembly required","user":{"login":"Shtong","id":1116681,"avatar_url":"https://avatars.githubusercontent.com/u/1116681?v=3","gravatar_id":"","url":"https://api.github.com/users/Shtong","html_url":"https://github.com/Shtong","followers_url":"https://api.github.com/users/Shtong/followers","following_url":"https://api.github.com/users/Shtong/following{/other_user}","gists_url":"https://api.github.com/users/Shtong/gists{/gist_id}","starred_url":"https://api.github.com/users/Shtong/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Shtong/subscriptions","organizations_url":"https://api.github.com/users/Shtong/orgs","repos_url":"https://api.github.com/users/Shtong/repos","events_url":"https://api.github.com/users/Shtong/events{/privacy}","received_events_url":"https://api.github.com/users/Shtong/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-10-27T10:02:15Z","updated_at":"2016-12-10T11:29:35Z","closed_at":"2016-12-10T11:29:35Z","body":"Hello\n\nI was about to do the Diesel tutorial, but had to do some unexpected work at the \"install diesel_cli\" step, in order to make diesel_cli actually compile.\n\nThe command I wanted to run is: `rustup run nightly cargo install diesel_cli`\n\nMy environment is a Windows 10 x64 with VS14 installed, as well as PostgreSQL 9.6 (installed with the official installer) and the SQlite .dll and .def that I manually downloaded and put into some folder.\n\nWhile I had several errors, they were all pretty similar to this one (missing .lib input files):\n\n```\n   Compiling diesel_cli v0.8.0\n     Running `rustc D:\\\\Users\\\\Shtong\\\\.cargo\\\\registry\\\\src\\\\github.com-1ecc6299db9ec823\\\\diesel_cli-0.8.0\\\\src\\\\main.rs --crate-name diesel --crate-type bin -C opt-level=3 --cfg feature=\\\"postgres\\\" --cfg feature=\\\"default\\\" --cfg feature=\\\"sqlite\\\" --cfg feature=\\\"diesel\\\" -C metadata=29283389226be5db --out-dir D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release --emit=dep-info,link -L dependency=D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps --extern chrono=D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libchrono-7342810e34d1c30d.rlib --extern diesel=D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libdiesel-759af232b86b362b.rlib --extern clap=D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libclap-8f0c0e13919e3e65.rlib --extern dotenv=D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libdotenv-695bff8444756e3d.rlib -L D:\\\\Programs\\\\Sqlite3`\nerror: linking with `link.exe` failed: exit code: 1181\n  |\n  = note: \"D:\\\\Programs\\\\VisualStudio14\\\\VC\\\\bin\\\\amd64\\\\link.exe\" \"/LIBPATH:D:\\\\Programs\\\\VisualStudio14\\\\VC\\\\lib\\\\amd64\" \"/LIBPATH:C:\\\\Program Files (x86)\\\\Windows Kits\\\\10\\\\lib\\\\10.0.10240.0\\\\ucrt\\\\x64\" \"/LIBPATH:C:\\\\Program Files (x86)\\\\Windows Kits\\\\8.1\\\\lib\\\\winv6.3\\\\um\\\\x64\" \"/NOLOGO\" \"/NXCOMPAT\" \"/LIBPATH:D:\\\\Users\\\\Shtong\\\\.multirust\\\\toolchains\\\\nightly-x86_64-pc-windows-msvc\\\\lib\\\\rustlib\\\\x86_64-pc-windows-msvc\\\\lib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\diesel.0.o\" \"/OUT:D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\diesel.exe\" \"/OPT:REF,ICF\" \"/DEBUG\" \"/LIBPATH:D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\" \"/LIBPATH:D:\\\\Programs\\\\Sqlite3\" \"/LIBPATH:D:\\\\Users\\\\Shtong\\\\.multirust\\\\toolchains\\\\nightly-x86_64-pc-windows-msvc\\\\lib\\\\rustlib\\\\x86_64-pc-windows-msvc\\\\lib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libchrono-7342810e34d1c30d.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libdiesel-759af232b86b362b.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libbyteorder-f3f7821512ca2fd0.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libtime-750bfdd52feafcb7.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libpq_sys-d9fc24829db90d4f.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\liblibsqlite3_sys-755891849c290f5c.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libnum-1fa4854b44bb6a54.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libnum_iter-50df698bc905252c.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libnum_integer-52fdddf28cd8e924.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libnum_traits-92bb90166cd1857c.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libdotenv-695bff8444756e3d.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libregex-19c946c0da62af0b.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libutf8_ranges-5c6a6dacba3be7ce.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libregex_syntax-c54ab5597cd8541d.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libaho_corasick-d1dfd931d7cac82f.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libmemchr-c555f740a543880f.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libclap-8f0c0e13919e3e65.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libunicode_segmentation-e3fd0169850011a0.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libterm_size-9fd23557733de795.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libvec_map-d843695eff67d492.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libbitflags-0e272044714c8076.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libunicode_width-bcfd50e6d35d16e0.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\liblibc-ad32fde1bd850538.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libansi_term-aa5dcc2affa8dc75.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libstrsim-b42a694875d9a3b0.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libthread_local-a3c0092e9fb6507d.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libthread_id-bcd46c79a620a618.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libkernel32-df86a08647459244.rlib\" \"D:\\\\Users\\\\Shtong\\\\AppData\\\\Local\\\\Temp\\\\cargo-install.6Y8hTMX3pHdT\\\\release\\\\deps\\\\libwinapi-0889532d327ff4e2.rlib\" \"D:\\\\Users\\\\Shtong\\\\.multirust\\\\toolchains\\\\nightly-x86_64-pc-windows-msvc\\\\lib\\\\rustlib\\\\x86_64-pc-windows-msvc\\\\lib\\\\libstd-6eb85298.rlib\" \"D:\\\\Users\\\\Shtong\\\\.multirust\\\\toolchains\\\\nightly-x86_64-pc-windows-msvc\\\\lib\\\\rustlib\\\\x86_64-pc-windows-msvc\\\\lib\\\\libpanic_unwind-6eb85298.rlib\" \"D:\\\\Users\\\\Shtong\\\\.multirust\\\\toolchains\\\\nightly-x86_64-pc-windows-msvc\\\\lib\\\\rustlib\\\\x86_64-pc-windows-msvc\\\\lib\\\\libunwind-6eb85298.rlib\" \"D:\\\\Users\\\\Shtong\\\\.multirust\\\\toolchains\\\\nightly-x86_64-pc-windows-msvc\\\\lib\\\\rustlib\\\\x86_64-pc-windows-msvc\\\\lib\\\\liblibc-6eb85298.rlib\" \"D:\\\\Users\\\\Shtong\\\\.multirust\\\\toolchains\\\\nightly-x86_64-pc-windows-msvc\\\\lib\\\\rustlib\\\\x86_64-pc-windows-msvc\\\\lib\\\\librand-6eb85298.rlib\" \"D:\\\\Users\\\\Shtong\\\\.multirust\\\\toolchains\\\\nightly-x86_64-pc-windows-msvc\\\\lib\\\\rustlib\\\\x86_64-pc-windows-msvc\\\\lib\\\\libcollections-6eb85298.rlib\" \"D:\\\\Users\\\\Shtong\\\\.multirust\\\\toolchains\\\\nightly-x86_64-pc-windows-msvc\\\\lib\\\\rustlib\\\\x86_64-pc-windows-msvc\\\\lib\\\\liballoc-6eb85298.rlib\" \"D:\\\\Users\\\\Shtong\\\\.multirust\\\\toolchains\\\\nightly-x86_64-pc-windows-msvc\\\\lib\\\\rustlib\\\\x86_64-pc-windows-msvc\\\\lib\\\\liballoc_system-6eb85298.rlib\" \"D:\\\\Users\\\\Shtong\\\\.multirust\\\\toolchains\\\\nightly-x86_64-pc-windows-msvc\\\\lib\\\\rustlib\\\\x86_64-pc-windows-msvc\\\\lib\\\\librustc_unicode-6eb85298.rlib\" \"D:\\\\Users\\\\Shtong\\\\.multirust\\\\toolchains\\\\nightly-x86_64-pc-windows-msvc\\\\lib\\\\rustlib\\\\x86_64-pc-windows-msvc\\\\lib\\\\libcore-6eb85298.rlib\" \"D:\\\\Users\\\\Shtong\\\\.multirust\\\\toolchains\\\\nightly-x86_64-pc-windows-msvc\\\\lib\\\\rustlib\\\\x86_64-pc-windows-msvc\\\\lib\\\\libcompiler_builtins-6eb85298.rlib\" \"pq.lib\" \"sqlite3.lib\" \"sqlite3.lib\" \"sqlite3.lib\" \"msvcrt.lib\" \"kernel32.lib\" \"ws2_32.lib\" \"userenv.lib\" \"shell32.lib\" \"advapi32.lib\" \"msvcrt.lib\"\n  = note: LINK : fatal error LNK1181: cannot open input file 'sqlite3.lib'\n\n\nerror: aborting due to previous error\n\n```\n\nWhat I had to do in order to successfully compile:\n- Set the `SQLITE3_LIB_DIR` envvar to the directory containing the sqlite3 dll. This was not required by diesel itself but by one of its dependencies, and the error message suggested to set that var, so I guess it's not that bad\n- Set `LIB` envvar to both the PostgreSQL lib directory, and the directory containing the Sqlite3 binaries. Required for `link` to find the required libraries\n- Generate the Sqlite3.lib file manually, since it's not contained in the windows precompiled library official download (can be made with `link /lib /def:sqlite3.def /MACHINE:X64` in my case)\n- Rename (or copy) the `libpq.lib` file located in the PostgreSQL lib directory into `pq.lib`\n\nAfter compilation was done, I had to copy the following DLLs in my ~/.cargo/bin\n- sqlite3.dll\n- libpq.dll\n- api-ms-win-crt-heap-l1-1-0.dll\n- api-ms-win-crt-locale-l1-1-0.dll\n- api-ms-win-crt-math-l1-1-0.dll\n- api-ms-win-crt-runtime-l1-1-0.dll\n- api-ms-win-crt-stdio-l1-1-0.dll\n- api-ms-win-crt-string-l1-1-0.dll\n\nI'm not sure if Diesel was designed to build on Windows in the first place (I couldn't find any mention of platform-specific instructions or warnings), but these steps allowed me to build Diesel and successfully run the migrations.\n"},"comment":{"url":"https://api.github.com/repos/diesel-rs/diesel/issues/comments/266201605","html_url":"https://github.com/diesel-rs/diesel/issues/487#issuecomment-266201605","issue_url":"https://api.github.com/repos/diesel-rs/diesel/issues/487","id":266201605,"user":{"login":"sgrif","id":1529387,"avatar_url":"https://avatars.githubusercontent.com/u/1529387?v=3","gravatar_id":"","url":"https://api.github.com/users/sgrif","html_url":"https://github.com/sgrif","followers_url":"https://api.github.com/users/sgrif/followers","following_url":"https://api.github.com/users/sgrif/following{/other_user}","gists_url":"https://api.github.com/users/sgrif/gists{/gist_id}","starred_url":"https://api.github.com/users/sgrif/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sgrif/subscriptions","organizations_url":"https://api.github.com/users/sgrif/orgs","repos_url":"https://api.github.com/users/sgrif/repos","events_url":"https://api.github.com/users/sgrif/events{/privacy}","received_events_url":"https://api.github.com/users/sgrif/received_events","type":"User","site_admin":false},"created_at":"2016-12-10T11:29:35Z","updated_at":"2016-12-10T11:29:35Z","body":"Closing this issue, as any changes to make this easier will happen to https://github.com/sgrif/pq-sys. I will also be releasing a new PG driver early next year which will not depend on libpq, and should make this easier."}}
{"actor":{"display_login":"sgrif"}}