最新消息:20210816 当前crifan.com域名已被污染,为防止失联,请关注(页面右下角的)公众号

【记录】将Cygwin中的Docbook开发环境,整合到MingW中的MSYS中

默认分类 crifan 2562浏览 0评论

之前是用Cygwin去编译docbook的,已经实现了一套完整的开发环境,但是现在得知了有cygwin的其他替代品,就先去试了试gow,结果失败了。

然后就打算再去试试MSYS,现已安装好了MingW,包括MSYS了,然后就是接着去折腾,尝试把之前Cygwin中的docbook整合到MingW的MSYS中去。


1.尝试了去src目录下,直接make html,结果出错:

$ pwd
/e/Dev_Root/docbook/dev/books/docbook_dev_note/src

Administrator@NYBDHB7EB3XEHP6 /e/Dev_Root/docbook/dev/books/docbook_dev_note/src

$ make html
=============================== cleaning html ==============================
rm -rf ../output/html/single/*
make: *** No rule to make target `/home/develop/docbook/config_root/docbook.mk',
 needed by `../output/html/single/docbook_dev_note.html'.  Stop.

2. 然后就去看看对应的docbook.mk,结果才注意到,原来是上面的路径,无法找到所导致的上面的错误。

所以去更新对应的路径,把相关cygwin的路径,更新为mingw下的路径即可:

# ----------------------- common config -----------------------
# follow config_root and tools_root are soft-link
#CONFIG_ROOT_CYGWIN = /home/develop/docbook/config_root
CONFIG_ROOT_CYGWIN = /E/Dev_Root/docbook/dev/config
#TOOLS_ROOT_CYGWIN = /home/develop/docbook/tools_root
TOOLS_ROOT_CYGWIN = /E/Dev_Root/docbook/tools

然后就可以正常去执行命令了。

3.但是接着又出现xsltproc找不到的问题:

Administrator@NYBDHB7EB3XEHP6 /e/Dev_Root/docbook/dev/books/docbook_dev_note/src
$ make html
=============================== cleaning html ==============================
rm -rf ../output/html/single/*
=============================== generating html ==============================
export XML_CATALOG_FILES="/E/Dev_Root/docbook/dev/config/catalog/catalog.xml" && \
        export XML_DEBUG_CATALOG=1 && \
        xsltproc --xinclude --stringparam callout.graphics 1 --stringparam admon.graphics 1  --stringparam callout.graph
ics.number.limit 30 --stringparam callout.graphics.extension .png --stringparam admon.graphics.extension .png --stringpa
ram html.stylesheet.type text/css  --stringparam callout.graphics.path E:/Dev_Root/docbook/dev/config/images/system/call
outs/ --stringparam admon.graphics.path E:/Dev_Root/docbook/dev/config/images/system/ --stringparam html.stylesheet E:/D
ev_Root/docbook/dev/config/docbook-xsl-ns-1.77.1/html/css/common_html.css -o ../output/html/single/docbook_dev_note.html
 docbook_html_crl.xsl docbook_dev_note.xml
/bin/sh: line 2: xsltproc: command not found
make: *** [../output/html/single/docbook_dev_note.html] Error 127

 

对此,刚以为需要去重新把xsltproc所在路径,添加到当前win7的环境变量PATH下。

但是才想起来,原来是由于之前Cygwin下是有xsltproc的,而当前MingW下没有此程序,所以是需要想办法在MingW下安装xsltproc才对。

然后再参考自己之前写的:

下载windos版本的xsltproc

去把几个xml相关的bin都整合到一起,弄出个libxml文件夹,其下有bin,include,lib,然后把bin路径,添加到PATH中去。

此时,发现了PATH中,是已有了之前gow的路径E:\dev_install_root\Gow\bin;的,所以,怕gow中的一对的程序,包括make等,会影响到后面MingW的程序的正常执行,就先去除掉此gow的路径,再卸载了gow,然后再继续折腾MingW。

4.删除了PATH中的gow的路径,卸载了gow,关闭mingw重新打开。

此时,确定PATH中包含xsltproc所在的libxml\bin路径了:

Administrator@NYBDHB7EB3XEHP6 /e/Dev_Root/docbook/dev/books/docbook_dev_note/src
$ echo $PATH
.:/usr/local/bin:/mingw/bin:/bin:/c/Program Files/Common Files/Microsoft Shared/Windows Live:/c/Program Files (x86)/Comm
on Files/Microsoft Shared/Windows Live:/c/Program Files (x86)/AMD APP/bin/x86_64:/c/Program Files (x86)/AMD APP/bin/x86:
/c/Windows/system32:/c/Windows:/c/Windows/System32/Wbem:/c/Windows/System32/WindowsPowerShell/v1.0/:/c/Program Files (x8
6)/ATI Technologies/ATI.ACE/Core-Static:/c/Program Files (x86)/Windows Live/Shared:/e/dev_install_root/TortoiseSVN/bin:/
c/Program Files (x86)/Microsoft SQL Server/100/Tools/Binn/:/c/Program Files/Microsoft SQL Server/100/Tools/Binn/:/c/Prog
ram Files/Microsoft SQL Server/100/DTS/Binn/:/e/Dev_Root/docbook/tools/libxml/bin:.

Administrator@NYBDHB7EB3XEHP6 /e/Dev_Root/docbook/dev/books/docbook_dev_note/src
$ xsltproc.exe

然后再去执行make html,结果是可以继续执行了。

5.但是又遇到catalog解析错误,具体折腾过程参见:

【已解决】在MingW中的MSYS中,运行xsltproc出现catalog方面的错误:warning: failed to load external entity xxx,cannot parse xxx

6.解决了catalog和xsl的路径问题之后,继续折腾生成其他的格式的文件。

去生成pdf,结果出现找不到fop:

Administrator@NYBDHB7EB3XEHP6 /e/Dev_Root/docbook/dev/books/docbook_dev_note/src
$ make pdf
=============================== generating fo ==============================
export XML_CATALOG_FILES="/E/Dev_Root/docbook/dev/config/catalog/catalog.xml" && \
        export XML_DEBUG_CATALOG=1 && \
        xsltproc --xinclude --stringparam callout.graphics 1 --stringparam admon.graphics 1  --stringparam callout.graph
ics.number.limit 30  --stringparam callout.graphics.extension .svg --stringparam callout.graphics.path /E/Dev_Root/docbo
ok/dev/config/images/system/callouts/ --stringparam admon.graphics.extension .svg --stringparam admon.graphics.path /E/D
ev_Root/docbook/dev/config/images/system/colorsvg/ -o ../output/fo/docbook_dev_note.fo docbook_fo_crl.xsl docbook_dev_no
te.xml
Resolve: sysID docbook_fo_crl.xsl
3892 Parsing catalog e:/Dev_Root/docbook/dev/config/catalog/catalog.xml
e:/Dev_Root/docbook/dev/config/catalog/catalog.xml added to file hash
Resolve URI docbook_fo_crl.xsl
Found URI match docbook_fo_crl.xsl
Resolve: pubID crl.ent sysID https://www.crifan.com/files/res/docbook/entity/crl.ent
Found public match crl.ent
Resolve: pubID crl.ent sysID https://www.crifan.com/files/res/docbook/entity/crl.ent
Found public match crl.ent
Resolve: pubID crl.ent sysID https://www.crifan.com/files/res/docbook/entity/crl.ent
Found public match crl.ent
Resolve: pubID crl.ent sysID https://www.crifan.com/files/res/docbook/entity/crl.ent
Found public match crl.ent
Resolve: pubID crl.ent sysID https://www.crifan.com/files/res/docbook/entity/crl.ent
Found public match crl.ent
Resolve: pubID crl.ent sysID https://www.crifan.com/files/res/docbook/entity/crl.ent
Found public match crl.ent
Resolve: pubID crl.ent sysID https://www.crifan.com/files/res/docbook/entity/crl.ent
Found public match crl.ent
Making portrait pages on A4 paper (210mmx297mm)
Catalogs cleanup
Free catalog entry crl.ent
Free catalog entry E:/Dev_Root/docbook/tools/docbook-xsl-ns-1.77.1/
Free catalog entry docbook_html.xsl
Free catalog entry docbook_fo.xsl
Free catalog entry E:/Dev_Root/docbook/dev/config/docbook-xsl-ns-1.77.1/
Free catalog entry docbook_html_crl.xsl
Free catalog entry chunk_html_crl.xsl
Free catalog entry docbook_htmlhelp_crl.xsl
Free catalog entry docbook_fo_crl.xsl
Free catalog entry e:/Dev_Root/docbook/dev/config/catalog/catalog.xml
Free catalog entry
=============================== generating pdf ==============================
fop --execdebug -c /E/Dev_Root/docbook/dev/config/fop/conf/fop.xconf ../output/fo/docbook_dev_note.fo -pdf ../output/pdf
/docbook_dev_note.pdf
make: fop: Command not found
make: *** [../output/pdf/docbook_dev_note.pdf] Error 127

很明显,是找不到FOP_HOME和bin所在路径,所以去添加相关环境变量:

  • 添加FOP_HOME=E:\Dev_Root\docbook\tools\fop-1.0
  • 添加E:\Dev_Root\docbook\tools\fop-1.0到PATH中

然后再重启MingW,再去进入

/e/Dev_Root/docbook/dev/books/docbook_dev_note/src

去测试,然后就可以继续执行了。

7.但是又找不到java了:

Administrator@NYBDHB7EB3XEHP6 /e/Dev_Root/docbook/dev/books/docbook_dev_note/src
$ make pdf
=============================== generating pdf ==============================
fop --execdebug -c /E/Dev_Root/docbook/dev/config/fop/conf/fop.xconf ../output/fo/docbook_dev_note.fo -pdf ../output/pdf
/docbook_dev_note.pdf
Error: JAVA_HOME is not defined correctly.
  We cannot execute java
make: *** [../output/pdf/docbook_dev_note.pdf] Error 1

所以再去设置java,不对,是安装java。我当前系统还没安装java呢。

下载了最新的JavaSetup7u7.exe,然后安装,其会在线下载安装文件再去安装的。

安装完毕,再去设置环境变量:

  • JAVA_HOME=C:\Program Files (x86)\Java\jre7
  • 把%JAVA_HOME%\bin添加到PATH中

8. 再重启MingW,再测试make fop,结果又出现了那个经典的java.lang.RuntimeException错误,相关折腾过程,参见:

【已解决】Ming/MSYS下运行FOP出错:Unable to start FOP, java.lang.RuntimeException: fop.jar not found in directory

9.至此,算是搞定了html和pdf的make了。剩下的,继续折腾剩下的功能。

去make clean清除所有,结果最后对于webhelp是通过ant实现的,结果是没有找到ant:

Administrator@NYBDHB7EB3XEHP6 /e/Dev_Root/docbook/dev/books/docbook_dev_note/src
$ make clean
=============================== cleaning pdf release ==============================
rm -f ../release/pdf/*
=============================== cleaning rtf release ==============================
rm -f ../release/rtf/*
=============================== cleaning html ==============================
rm -rf ../output/html/single/*
=============================== cleaning html release ==============================
rm -rf ../release/html/*
=============================== cleaning txt release ==============================
rm -f ../release/txt/*
=============================== cleaning htmls release ==============================
rm -rf ../release/htmls/*
=============================== cleaning chm release ==============================
rm -f ../release/chm/*
=============================== cleaning webhelp release ==============================
rm -rf ../release/webhelp/*
=============================== cleaning pdf ==============================
rm -f ../output/fo/docbook_dev_note.fo
rm -f ../output/pdf/docbook_dev_note.pdf
=============================== cleaning rtf ==============================
rm -f ../output/fo/docbook_dev_note.fo
rm -f ../output/rtf/fop/docbook_dev_note.rtf
=============================== cleaning txt ==============================
rm -f ../output/plain_text/w3m/docbook_dev_note.txt
=============================== cleaning htmls ==============================
rm -rf ../output/html/multi/*
=============================== cleaning chm ==============================
rm -rf ../output/htmlhelp/*
=============================== cleaning webhelp ==============================
ant clean
make: ant: Command not found
make: *** [clean_webhelp] Error 127

所以,接着去把ant添加进来。

参考自己的:

【已成功】用Saxon将Docbook生成Webhelp

去添加环境变量:

  • ANT_HOME=E:\Dev_Root\docbook\tools\ant\apache-ant-1.8.4
  • 把%ANT_HOME%\bin添加到PATH中

重启MingW,再去试试,这下可以找到ant了:

=============================== cleaning webhelp ==============================
ant clean
Unable to locate tools.jar. Expected to find it in c:\Program Files (x86)\Java\jre7\lib\tools.jar
Buildfile: e:\Dev_Root\docbook\dev\books\docbook_dev_note\src\build.xml

clean:

BUILD SUCCESSFUL
Total time: 0 seconds

10.接着去尝试编译webhelp,也是可以正常编译的:

Administrator@NYBDHB7EB3XEHP6 /e/Dev_Root/docbook/dev/books/docbook_dev_note/src
$ make webhelp
=============================== generating webhelp ==============================
ant webhelp
Unable to locate tools.jar. Expected to find it in c:\Program Files (x86)\Java\jre7\lib\tools.jar
Buildfile: e:\Dev_Root\docbook\dev\books\docbook_dev_note\src\build.xml

validate:

clean:

chunk:
    [mkdir] Created dir: e:\Dev_Root\docbook\dev\books\docbook_dev_note\output\webhelp
     [xslt] Processing e:\Dev_Root\docbook\dev\books\docbook_dev_note\src\docbook_dev_note.xml to e:\Dev_Root\docbook\de
v\books\docbook_dev_note\output\webhelp\null2087543618
     [xslt] Loading stylesheet E:\Dev_Root\docbook\tools\docbook-xsl-ns-1.77.1\profiling\profile.xsl
     [xslt] Processing e:\Dev_Root\docbook\dev\books\docbook_dev_note\output\webhelp\null2087543618 to e:\Dev_Root\docbo
ok\dev\books\docbook_dev_note\output\webhelp\null615111523
     [xslt] Loading stylesheet E:\Dev_Root\docbook\dev\ant\webhelp\xsl\webhelp_crl.xsl
     [xslt] language: en
     [xslt] Writing ../output/webhelp/content/pr01s01s01.html for sect2
     [xslt] Writing ../output/webhelp/content/pr01s01s02s01.html for sect3
     [xslt] Writing ../output/webhelp/content/pr01s01s02.html for sect2
     [xslt] Writing ../output/webhelp/content/what_is_docbook.html for sect1(what_is_docbook)
     [xslt] Writing ../output/webhelp/content/why_use_docbook.html for sect1(why_use_docbook)
     [xslt] Writing ../output/webhelp/content/preface.html for preface(preface)
     [xslt] Writing ../output/webhelp/content/ch01s01s01.html for sect2
     [xslt] Writing ../output/webhelp/content/ch01s01s02.html for sect2
     [xslt] Writing ../output/webhelp/content/ch01s01.html for sect1
     [xslt] Writing ../output/webhelp/content/ch01s02s01.html for sect2
     [xslt] Writing ../output/webhelp/content/download_xsltproc_win.html for sect2(download_xsltproc_win)
     [xslt] Writing ../output/webhelp/content/download_xsl_ns.html for sect2(download_xsl_ns)
     [xslt] Writing ../output/webhelp/content/download_fop.html for sect3(download_fop)
     [xslt] Writing ../output/webhelp/content/ch01s02s04s02.html for sect3
     [xslt] Writing ../output/webhelp/content/ch01s02s04s03.html for sect3
     [xslt] Writing ../output/webhelp/content/download_fop_add_conf.html for sect2(download_fop_add_conf)
     [xslt] Writing ../output/webhelp/content/ch01s02s05.html for sect2
     [xslt] Writing ../output/webhelp/content/ch01s02s06s01.html for sect3
     [xslt] Writing ../output/webhelp/content/ch01s02s06s02.html for sect3
     [xslt] Writing ../output/webhelp/content/ch01s02s06.html for sect2
     [xslt] Writing ../output/webhelp/content/ch01s02s07s01.html for sect3
     [xslt] Writing ../output/webhelp/content/ch01s02s07s02.html for sect3
     [xslt] Writing ../output/webhelp/content/ch01s02s07s03.html for sect3
     [xslt] Writing ../output/webhelp/content/ch01s02s07.html for sect2
     [xslt] Writing ../output/webhelp/content/pure_win_docbook_dev_env.html for sect1(pure_win_docbook_dev_env)
     [xslt] Writing ../output/webhelp/content/ch01s03s01.html for sect2
     [xslt] Writing ../output/webhelp/content/ch01s03s02.html for sect2
     [xslt] Writing ../output/webhelp/content/cygwin_docbook_dev_env.html for sect1(cygwin_docbook_dev_env)
     [xslt] Writing ../output/webhelp/content/ch01_build_env.html for chapter(ch01_build_env)
     [xslt] Writing ../output/webhelp/content/ch02s01.html for sect1
     [xslt] Writing ../output/webhelp/content/ch02s02.html for sect1
     [xslt] Writing ../output/webhelp/content/ch02s03.html for sect1
     [xslt] Writing ../output/webhelp/content/ch02s04s01.html for sect2
     [xslt] Writing ../output/webhelp/content/ch02s04.html for sect1
     [xslt] Writing ../output/webhelp/content/ch02s05.html for sect1
     [xslt] Writing ../output/webhelp/content/docbook_id_abbrev.html for sect3(docbook_id_abbrev)
     [xslt] Writing ../output/webhelp/content/docbook_best_practice.html for sect2(docbook_best_practice)
     [xslt] Writing ../output/webhelp/content/docbook_dev_notes.html for sect1(docbook_dev_notes)
     [xslt] Writing ../output/webhelp/content/ch02s07s01.html for sect2
     [xslt] Writing ../output/webhelp/content/ch02s07.html for sect1
     [xslt] Writing ../output/webhelp/content/ch02s08s01.html for sect2
     [xslt] Writing ../output/webhelp/content/ch02s08s02.html for sect2
     [xslt] Writing ../output/webhelp/content/ch02s08.html for sect1
     [xslt] Writing ../output/webhelp/content/ch02s09.html for sect1
     [xslt] Writing ../output/webhelp/content/ch02_notes.html for chapter(ch02_notes)
     [xslt] Writing ../output/webhelp/content/ch03_faq.html for chapter(ch03_faq)
     [xslt] Writing ../output/webhelp/content/ch04s01.html for sect1
     [xslt] Writing ../output/webhelp/content/ch04s02.html for sect1
     [xslt] Writing ../output/webhelp/content/ch04_materials.html for chapter(ch04_materials)
     [xslt] Writing ../output/webhelp/content/ch05s01.html for sect1
     [xslt] Writing ../output/webhelp/content/ch05s02.html for sect1
     [xslt] Writing ../output/webhelp/content/ch05s03.html for sect1
     [xslt] Writing ../output/webhelp/content/ch05s04.html for sect1
     [xslt] Writing ../output/webhelp/content/ch05_issues.html for chapter(ch05_issues)
     [xslt] Writing ../output/webhelp/content/example_chapter_section.html for sect1(example_chapter_section)
     [xslt] Writing ../output/webhelp/content/example_para.html for sect1(example_para)
     [xslt] Writing ../output/webhelp/content/example_figure.html for sect1(example_figure)
     [xslt] Writing ../output/webhelp/content/ch06s04.html for sect1
     [xslt] Writing ../output/webhelp/content/ch06s05.html for sect1
     [xslt] Writing ../output/webhelp/content/ch06s06.html for sect1
     [xslt] Writing ../output/webhelp/content/ch06s07.html for sect1
     [xslt] Writing ../output/webhelp/content/ch06s08.html for sect1
     [xslt] Writing ../output/webhelp/content/ch06s09.html for sect1
     [xslt] Writing ../output/webhelp/content/ch06s10.html for sect1
     [xslt] Writing ../output/webhelp/content/ch06_examples.html for chapter(ch06_examples)
     [xslt] Writing ../output/webhelp/content/docbook_released_basic.html for sect1(docbook_released_basic)
     [xslt] Writing ../output/webhelp/content/docbook_released_embedded.html for sect1(docbook_released_embedded)
     [xslt] Writing ../output/webhelp/content/docbook_released_upper.html for sect1(docbook_released_upper)
     [xslt] Writing ../output/webhelp/content/docbook_released_other.html for sect1(docbook_released_other)
     [xslt] Writing ../output/webhelp/content/appendix.html for appendix(appendix)
     [xslt] Writing ../output/webhelp/content/index.html for book
     [xslt] Writing ../output/webhelp/index.html
     [xslt] Writing ../output/webhelp/content/search/l10n.js
     [copy] Copying 29 files to e:\Dev_Root\docbook\dev\books\docbook_dev_note\output\webhelp\content

index:
     [copy] Copying 1 file to e:\Dev_Root\docbook\dev\books\docbook_dev_note\output\webhelp
     [copy] Copying 4 files to e:\Dev_Root\docbook\dev\books\docbook_dev_note\output\webhelp
     [echo] Indexing html files in ../output/webhelp/content
     [java] Stemming enabled
     [java] The created index files are located in ..\output\webhelp\content\search\.js
     [java] Indexed the contents in 3 seconds

webhelp:

BUILD SUCCESSFUL
Total time: 18 seconds

也去看了下生成webhelp,是正常的。

11.make rtf也是OK的。

12. 去make txt结果找不到w3m:

=============================== generating txt ==============================
w3m -I UTF8 -O UTF8 -dump ../output/html/single/docbook_dev_note.html > ../output/plain_text/w3m/docbook_dev_note.txt
/bin/sh: w3m: command not found
make: *** [../output/plain_text/w3m/docbook_dev_note.txt] Error 127

所以,再去添加w3m,具体折腾过程参见:

【记录】尝试把w3m添加到MingW中

目前是没有成功折腾w3m到MingW,而且对于MingW的总体环境,觉得还是功能不够多,这使得以后想要折腾其他功能的话,还要花太多时间,没有Cygwin用的爽,所以,还是暂时放弃MingW环境了。

还是换回Cygwin吧。

转载请注明:在路上 » 【记录】将Cygwin中的Docbook开发环境,整合到MingW中的MSYS中

发表我的评论
取消评论

表情

Hi,您需要填写昵称和邮箱!

  • 昵称 (必填)
  • 邮箱 (必填)
  • 网址
81 queries in 0.188 seconds, using 22.45MB memory