{"id":3794,"date":"2015-12-14T14:17:57","date_gmt":"2015-12-14T14:17:57","guid":{"rendered":"http:\/\/www.readytext.co.uk\/?p=3794"},"modified":"2015-12-18T15:26:24","modified_gmt":"2015-12-18T15:26:24","slug":"a-note-on-a-gotcha-when-building-tex-live-from-source-on-windows","status":"publish","type":"post","link":"https:\/\/www.readytext.co.uk\/?p=3794","title":{"rendered":"A note on a &#8220;gotcha&#8221; when Building TeX Live from source (on Windows) [updated]"},"content":{"rendered":"<h1>Post-publication update: GNU gawk<\/h1>\n<p>Since publication of the article below, subsequent investigations with a member of the TeX Live team have identified the exact cause of the problem: An outdated version of GNU&#8217;s gawk command-line tool (used during compilation). I had been using version 3.1.7 of GNU&#8217;s gawk (supplied with the MSYS distribution I was using) but after updating it to version 4.0.2 the line-ending problem no longer arises. If you are using MSYS on Windows, and want to compile TeX Live&#8230;, check the version of gawk installed on your machine. As I say, you live and (re)learn&#8230;<\/p>\n<h1>Original article<\/h1>\n<p>Just a short note to share the solution to a problem I experienced when trying to compile Tex Live from the C\/C++ source distribution&#8230; on Windows. I have a bit of relevant experience because I regularly compile LuaTeX from source and have built other TeX engines&ndash;including Knuthian TeX from raw WEB code and some versions of XeTeX.<\/p>\n<p><p>So, with that experience, I decided to have a go at building TeX Live from the source file distribution&ndash;it&#8217;s useful to be able to build and use the latest versions of TeX-related software. Using SVN (via the Tortoise SVN client) I checked out the TeX Live source directory and tried to build it using MinGW64\/MSYS64. I read through the notes in <code>README.2building<\/code> (supplied with the TeX Live source) and followed the example to build <code>dvipdfm-x<\/code>. Running the Build\/configure scripts (using the <code>--disable-all-pkgs<\/code> option) worked fine but, sadly, compilation failed with a cascade of errors&#8230; so I wanted to find out why.<\/p>\n<p>Unquestionably, TeX Live is a truly impressive work of considerable complexity and, of course, it should build OK on Windows&ndash;so I figured that the problem must be a relatively minor one to do with my setup. However, tracking it down initially felt like &#8220;looking for a needle in a haystack&#8221;, to quote a well-known English figure of speech. Well, after a couple of days I found the problem&#8230; line endings in some key text files! When I checked out the source via SVN some key files (<code>config.h.in<\/code> and similar <code>*.in<\/code> files) had been saved with Windows line endings (CR+LF) rather than Linux endings of LF only. Running the top-level TeX Live Build\/configure scripts generates a <code>config.status<\/code> shell script file for each component\/sub-system that has to be compiled. As the <code>config.status<\/code> scripts execute, they create a number of temporary files which are processed and deleted on-the-fly. To stop these temporary files being deleted (to assist my bug hunt) I used a simple trick of adding the line <code>alias rm='echo'<\/code> at the start of one of the <code>config.status<\/code> shell scripts (which are generated by <code>configure<\/code>).<\/p>\n<p>I discovered that the <code>config.status<\/code> scripts generate a temporary file called <code>defines.awk<\/code>&ndash;which is a script designed to be executed by the AWK program. The purpose of <code>defines.awk<\/code> is to process &#8220;template&#8221; configuration files (called <code>config.h.in<\/code> (and similar)) to generate various <code>config.h<\/code> files that contain important settings (<code>#define<\/code>s) detected during the configuration process (i.e., during the execution of <code>configure<\/code>). These <code>config.h<\/code> files vary for each program you are building and are essential for successful compilation. Well, it turned out that the <code>defines.awk<\/code> script was failing to correctly parse the <code>config.h.in<\/code> files (and similar) simply because the Windows line endings were causing a vital regular expression (in <code>defines.awk<\/code>) to fail. This resulted in the <code>config.h<\/code> files being a copy of <code>config.h.in<\/code> because none of the text replacements had worked due to failure of the AWK regular expression. Not surprisingly, erroneous <code>config.h<\/code> files caused the spectacular failure of compilation I experienced on my first attempt. Re-saving the <code>config.h.in<\/code> files (and some other <code>*.in<\/code> files) with Linux line endings seems to have solved the problems.<\/p>\n<p><p>And yes, so far all the TeX-related programs I have tried to build have compiled successfully. This is not the first time I have been &#8220;bitten&#8221; through problems caused by Linux\/Widows line endings&#8230; so I guess you always live and (re)learn.<\/p>\n<p> \ufeff<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Post-publication update: GNU gawk Since publication of the article below, subsequent investigations with a member of the TeX Live team have identified the exact cause of the problem: An outdated version of GNU&#8217;s gawk command-line tool (used during compilation). I had been using version 3.1.7 of GNU&#8217;s gawk (supplied with the MSYS distribution I was [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3794","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"blocksy_meta":[],"_links":{"self":[{"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/3794","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3794"}],"version-history":[{"count":29,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/3794\/revisions"}],"predecessor-version":[{"id":3823,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=\/wp\/v2\/posts\/3794\/revisions\/3823"}],"wp:attachment":[{"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3794"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3794"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.readytext.co.uk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3794"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}