Skip to content

Building ex_doc on Windows with MSVC#131

Closed
chyndman wants to merge 4 commits intoelixir-lang:masterfrom
chyndman:win-nmake-new-makefile
Closed

Building ex_doc on Windows with MSVC#131
chyndman wants to merge 4 commits intoelixir-lang:masterfrom
chyndman:win-nmake-new-makefile

Conversation

@chyndman
Copy link
Copy Markdown
Contributor

@chyndman chyndman commented Jun 9, 2014

These commits allow for a successful build on Windows using Visual Studio's MSVC distribution (bar one snag, detailed later) by following these steps:

  1. Have Erlang and Elixir on system and in Path variable.
  2. Git clone ex_doc into your favorite folder.
  3. Install Visual Studio 2013 (Express should suffice, I'm using Ultimate).
  4. In a Command Prompt run "C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" _ARCH_, where _ARCH_ is either x86 (if you installed 32-bit Erlang) or amd64 (64-bit Erlang).
  5. cd into the ex_doc folder and run mix compile.

Currently, (5) will throw a "permission denied" error. For now, just run mix compile again and all will go well. Similarly run mix test twice, and all tests should pass.

Closes #44

Comment thread Makefile.win Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to detect the erts path dynamically, no? Like we do in the other makefile?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes we do. Nmake doesn't support setting variables to outputs of commands, and it was more important to see that the NIF itself compiles. I'm working on a dynamic path to the erts headers next.

@josevalim
Copy link
Copy Markdown
Member

Thanks, I have added one tiny comment!

@chyndman
Copy link
Copy Markdown
Contributor Author

In these commits, we handle the dynamic paths by having Mix emit another makefile which defines macros that get used in the main makefile. Currently we just write the one necessary line when calling mix compile but it might be beneficial to create a new makefile or makefile.emit task for Mix.

Comment thread Makefile.win Outdated
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't you make something like the following:

  1. Check if the Makefile.mix.win32 is available
  2. If not, you generate one, in the Makefile itself and call exec make priv\markdown.dll

I am not sure exec would work on windows but windows must have an equivalent, no? It basically replaces the current process by the one that will run the given command.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let me try something like that using the equivalent start.

@chyndman
Copy link
Copy Markdown
Contributor Author

Alright, I've rebased on master to remove the File.write call from mix.exs. Instead, the priv\markdown.dll target is defined conditionally based on if a Makefile.auto.win containing the ERTS_INCLUDE_PATH macro exists. If it doesn't exist, it's created and then a recursive call is made for the same target.

@josevalim
Copy link
Copy Markdown
Member

@chyndman I will push the changes that makes ex_doc depend on https://github.com/devinus/markdown today. I think this patch looks great as it is, we just need to move it over and add some docs, maybe to the README, with instructions on requirements for windows. I will ping and close this issue as soon as we move things to the new repo.

@josevalim
Copy link
Copy Markdown
Member

We are closing this one! @chyndman, please send the PR to https://github.com/devinus/markdown!

@josevalim
Copy link
Copy Markdown
Member

❤️

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

Can't compile ExDoc on Windows

2 participants