林博仁 Buo-ren Lin
    • Create new note
    • Create a note from template
      • Sharing URL Link copied
      • /edit
      • View mode
        • Edit mode
        • View mode
        • Book mode
        • Slide mode
        Edit mode View mode Book mode Slide mode
      • Customize slides
      • Note Permission
      • Read
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Write
        • Only me
        • Signed-in users
        • Everyone
        Only me Signed-in users Everyone
      • Engagement control Commenting, Suggest edit, Emoji Reply
    • Invite by email
      Invitee

      This note has no invitees

    • Publish Note

      Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

      Your note will be visible on your profile and discoverable by anyone.
      Your note is now live.
      This note is visible on your profile and discoverable online.
      Everyone on the web can find and read all notes of this public team.
      See published notes
      Unpublish note
      Please check the box to agree to the Community Guidelines.
      View profile
    • Commenting
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
      • Everyone
    • Suggest edit
      Permission
      Disabled Forbidden Owners Signed-in users Everyone
    • Enable
    • Permission
      • Forbidden
      • Owners
      • Signed-in users
    • Emoji Reply
    • Enable
    • Versions and GitHub Sync
    • Note settings
    • Note Insights
    • Engagement control
    • Transfer ownership
    • Delete this note
    • Save as template
    • Insert from template
    • Import from
      • Dropbox
      • Google Drive
      • Gist
      • Clipboard
    • Export to
      • Dropbox
      • Google Drive
      • Gist
    • Download
      • Markdown
      • HTML
      • Raw HTML
Menu Note settings Versions and GitHub Sync Note Insights Sharing URL Create Help
Create Create new note Create a note from template
Menu
Options
Engagement control Transfer ownership Delete this note
Import from
Dropbox Google Drive Gist Clipboard
Export to
Dropbox Google Drive Gist
Download
Markdown HTML Raw HTML
Back
Sharing URL Link copied
/edit
View mode
  • Edit mode
  • View mode
  • Book mode
  • Slide mode
Edit mode View mode Book mode Slide mode
Customize slides
Note Permission
Read
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Write
Only me
  • Only me
  • Signed-in users
  • Everyone
Only me Signed-in users Everyone
Engagement control Commenting, Suggest edit, Emoji Reply
  • Invite by email
    Invitee

    This note has no invitees

  • Publish Note

    Share your work with the world Congratulations! 🎉 Your note is out in the world Publish Note

    Your note will be visible on your profile and discoverable by anyone.
    Your note is now live.
    This note is visible on your profile and discoverable online.
    Everyone on the web can find and read all notes of this public team.
    See published notes
    Unpublish note
    Please check the box to agree to the Community Guidelines.
    View profile
    Engagement control
    Commenting
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    • Everyone
    Suggest edit
    Permission
    Disabled Forbidden Owners Signed-in users Everyone
    Enable
    Permission
    • Forbidden
    • Owners
    • Signed-in users
    Emoji Reply
    Enable
    Import from Dropbox Google Drive Gist Clipboard
       owned this note    owned this note      
    Published Linked with GitHub
    Subscribed
    • Any changes
      Be notified of any changes
    • Mention me
      Be notified of mention me
    • Unsubscribe
    Subscribe
    # 循序漸進於 Ubuntu 16.04 上建構 Poedit<br>Building Poedit on Ubuntu 16.04 from Bottom to Top [TOC] ## 授權條款<br>Licensing 本作品以Creative Commons《姓名標示 - 相同方式分享》授權條款第4.0版或其任意更近期版本釋出供大眾在授權範圍內自由使用。 授權範圍外的使用請洽詢`林博仁 <Buo.Ren.Lin@gmail.com>` ## 注意事項<br>Notice 此文件撰寫於2018年9月28日,**僅對應當時最近期的Poedit釋出版本**(第[2.1.1開放源碼](https://github.com/vslavik/poedit/releases/tag/v2.1.1-oss)版),其他版本上可能程序上略有不同。 ## 範疇<br>Scope 仍需要 SuperUser 系統管理權限,目前不涵蓋完全安裝在家目錄下的作法 ## 前要知識<br>Prerequistes ### 命令列界面的使用<br>Command-line Interface's Usage 以下以*固定寬度字型* `monospaced font` 顯示的內容為**終端機下執行的命令**與其**輸出內容**,以錢字號`$` + 空格開頭的行為要執行的命令(不包含錢字號跟空格)。為了*排版上的美觀*跟*命令格式學習*考量,如果該行結尾為反斜線字元 `\` 代表**下一行依然是命令的一部分**(直到命令行結尾沒有反斜線字元為止),例如: ``` $ sudo apt install \ sl \ tree ``` 命令視同: ``` $ sudo apt install sl tree ``` :::info **提示:** 您可以直接將整個命令部份(含反斜線字元跟換行)直接選取複製起來貼到終端機中。 ::: ### 軟體安裝的基本概念<br>Software Installation Basics #### 軟體的可移動性<br>Softare Relocatability 軟體如何知道程式本身與其資源的路徑是個非常複雜的議題,對跨平台(cross-platform)以及以相對低階的程式語言設計的軟體來說更是如此,比方說C/C++標準程式庫並無提供任何「得知特定程式可執行檔位於哪個路徑」的方法而需要仰賴各種平台限定的手段(如[Where Am I?](https://github.com/gpakosz/whereami)程式庫)。大部分類Unix(Unix-Like)作業系統的軟體皆需要在軟體建構時期即寫死一個軟體安裝前綴路徑(software installation `PREFIX`)作為軟體資源搜尋的共同基底(如 `$PREFIX/lib` 目錄放置軟體依賴的程式庫等等)。遵循File Hierachy Standard(F.H.S.)檔案階層標準的軟體的軟體安裝前綴路徑通常是 `/usr` 、 `/usr/local`,不(完全)遵循F.H.S.的軟體的安裝前綴路徑可以是 `/opt/軟體識別名-軟體版本` 或是在其他考量下使用的其他安裝前綴路徑。 這使得一軟體的資源在軟體建構後即被寫死固定在特定路徑下而不能任意移動而減少了管理上的彈性。目前有一些規範讓軟體的資源可以不依賴在軟體安裝前綴路徑底下而可以在執行時期下任意改變位置,如 freedesktop.org 所發表的 [XDG Base Directory Specification](https://standards.freedesktop.org/basedir-spec/basedir-spec-latest.html) 即指定了一些環境變數(如`XDG_DATA_HOME`、`XDG_DATA_DIRS`)來告訴軟體該在哪些路徑下找尋哪些檔案的軟體資源。軟體的可移動性會影響到該軟體使用上的彈性,並影響軟體跨平台或移植至其他軟體散佈方式的難易程度。 #### 軟體的可移除性<br>Software Removablility 並不是所有的軟體在安裝之後都能夠輕易移除,有一些軟體的建構與安裝食譜並沒有設計解除安裝的方法,例如Makefile中只有設計`install`建構目標但沒有設計`uninstall`建構目標、沒有支援 `DESTDIR` 變數等等,在自行從源碼建構並安裝軟體時必須要留意該軟體是否可以輕易移除。 在本文件中為了*避免污染系統*以及*演示非標準目錄下的軟體安裝方式*目的所有不來自GNU+Linux作業系統散佈版的軟體接安裝於 `/opt/軟體識別名稱-軟體版本` 底下。 ### 軟體建構系統基本概念<br>Software Build System Basics 軟體建構(Software Building)是一個相當複雜的議題,現代的軟體建構系統通常會有兩個階段: #### 軟體建構設定階段<br>Software Build Configuration Phase 用來建構實際上建構軟體的*食譜*,通常包含了軟體安裝前綴路徑(software installation prefix)、軟體建構工具鏈(toolchain)的行為(命令參數)的自訂等等細節。 #### 軟體建構階段<br>Building Phase 根據軟體建構設定程序產生的建構食譜來建構軟體。 ### 軟體建構系統的使用<br>Software Build System Usage #### GNU軟體建構系統<br>GNU Build System GNU軟體建構系統為由GNU Make、GNU Automake、GNU M4與GNU Autoconf等軟體所組成的軟體建構系統,又稱為GNU Autotools。 如果您在軟體來源碼樹根目錄中看到 `configure.ac` 這個檔案即代表該軟體很有可能使用GNU軟體建構系統。您可以用GNU Autoconf軟體來用其產生 `configure` 軟體建構設定程式,執行此程式可以檢查各種軟體建構所需的環境細節(如軟體建構工具鏈是否相容、是否有安裝軟體建構時需要的軟體等等),順利的話最終可以產生軟體建構所需的 `Makefile` 食譜來給GNU Make軟體實際上建構軟體。如果軟體建構設定程序報錯失敗的話除了檢查其錯誤訊息外還可以查看 `config.log` 軟體建構設定紀錄檔甚至是 `configure` 軟體建構程式本身來確定問題到底是出在哪裡。 :::warning **注意:** GNU軟體建構系統(包含但不限於GNU Make軟體建構工具)並不相容*含有空白字元的路徑*,可使用容器或是bind mount來回避這個問題。 ::: #### CMake軟體建構系統<br>CMake Build System 如果您在軟體來源碼樹根目錄中看到 `CMakelists.txt` 這個檔案即代表該軟體很有可能使用CMake軟體建構系統。CMake 分為 configure 跟 generate 兩個步驟,在 generate 順利結束時會產生各種可指定的軟體建構工具(如GNU Make、Ninja等)的軟體建構食譜。 ## 演示用LXD容器製作細節<br>Demonstration LXD Container Creation Details ``` $ cat /etc/sub*id lxd:100000:100000 root:100000:100000 lxd:你的使用者識別編號:1 root:你的使用者識別編號:1 lxd:100000:100000 root:100000:100000 lxd:你的使用者識別編號:1 root:你的使用者識別編號:1 $ lxc profile show default config: user.user-data: | #cloud-config apt: disable_suites: $RELEASE-proposed primary: - arches: [default] uri: http://tw.archive.ubuntu.com/ubuntu/ conf: | APT { Get { Assume-Yes "true"; Fix-Broken "true"; } Install-Recommends "false"; Install-Suggests "false"; } description: Default LXD profile devices: eth0: name: eth0 nictype: bridged parent: lxdbr0 type: nic root: path: / pool: default type: disk name: default $ lxc launch ubuntu:xenial ubuntu-16-04 $ lxc exec ubuntu-16-04 -- apt update $ lxc exec ubuntu-16-04 -- apt full-upgrade $ lxc exec ubuntu-16-04 -- apt autoremove $ lxc stop ubuntu-16-04 $ lxc snapshot ubuntu-16-04 clean $ cd poedit-src $ lxc config device add ubuntu-16-04 Poedit來源碼庫 disk source="${PWD}" path=/home/ubuntu/poedit $ lxc config set raw.idmap "both "$(id --user)" 1000" $ lxc start ubuntu-16-04 $ lxc exec ubuntu-16-04 -- sudo --login --user ubuntu ``` ## 獲取軟體的來源碼<br>Acquire Software's Source Code ### 拓製一份Poedit的來源碼庫至本地端<br>Clone a Poedit Source Code Repository to the Localhost ``` $ git clone \ --depth=100 \ https://github.com/vslavik/poedit.git \ 'Poedit - Gettext translations editor for Mac, Windows and Unix' cd \ 'Poedit - Gettext translations editor for Mac, Windows and Unix' ``` ### 取出要建構的版本的來源碼<br>Checkout the Revision of Source Code to Build ``` $ git checkout \ v2.1.1-oss ``` ## 安裝建構Poedit所需的軟體(第一部份)<br>Install Software Required by Poedit Building(Part 1) ### 安裝軟體建構系統初始化所需軟體<br>Install Software Required by the Software Build System Initialization Poedit使用GNU軟體建構系統,由於Poedit來源碼樹本身並無提供 `configure` 軟體建構設定程序故我們需要自行安裝產生 `configure` 軟體建構設定程序所需的GNU軟體建構系統軟體。需要安裝的軟體可以參考其 `bootstrap` 程式的輸出內容: ```sh $ ./bootstrap - aclocal ./bootstrap: 12: ./bootstrap: aclocal: not found Automatic build files setup failed! ``` 運用 `command-not-found` 軟體提供的資訊我們可以知道某個命令是由什麼軟體包所提供: ``` $ aclocal The program 'aclocal' can be found in the following packages: * automake * automake1.11 Try: sudo apt install <selected package> $ sudo apt install automake (輸出省略) $ ./bootstrap - aclocal - automake (輸出省略) - autoconf configure.ac:1: error: possibly undefined macro: dnl If this token and others are legitimate, please use m4_pattern_allow. See the Autoconf documentation. configure.ac:59: error: possibly undefined macro: AC_MSG_ERROR configure.ac:109: error: possibly undefined macro: AC_SUBST Automatic build files setup failed! ``` 這個錯誤訊息最莫名其妙了,實際上它是缺 `pkg-config` 這個軟體orz。 ``` $ sudo apt install \ pkg-config (輸出省略) $ ./bootstrap - aclocal - automake - autoconf - generate-docs.make make: Entering directory '/home/ubuntu/poedit/docs' asciidoc -d manpage -f man_asciidoc.conf -b docbook -o - poedit_man.txt \ | xsltproc -o poedit.1.xml man_fix.xsl - /bin/sh: 1: asciidoc: not found /bin/sh: 2: xsltproc: not found generate-docs.make:12: recipe for target 'poedit.1' failed (輸出省略) $ asciidoc The program 'asciidoc' is currently not installed. You can install it by typing: sudo apt install asciidoc $ xsltproc The program 'xsltproc' is currently not installed. You can install it by typing: sudo apt install xsltproc $ sudo apt install \ asciidoc \ xsltproc (輸出省略) $ ./bootstrap - aclocal - automake - autoconf - generate-docs.make make: Entering directory '/home/ubuntu/poedit/docs' asciidoc -d manpage -f man_asciidoc.conf -b docbook -o - poedit_man.txt \ | xsltproc -o poedit.1.xml man_fix.xsl - xmlto man poedit.1.xml make: xmlto: Command not found generate-docs.make:12: recipe for target 'poedit.1' failed (輸出省略) $ xmlto The program 'xmlto' is currently not installed. You can install it by typing: sudo apt install xmlto $ sudo apt install \ xmlto (輸出省略) $ ./bootstrap - aclocal - automake - autoconf - generate-docs.make make: Entering directory '/home/ubuntu/poedit/docs' asciidoc -d manpage -f man_asciidoc.conf -b docbook -o - poedit_man.txt \ | xsltproc -o poedit.1.xml man_fix.xsl - xmlto man poedit.1.xml Warn: AUTHOR sect.: no personblurb|contrib for Vaclav Slavik poedit Note: AUTHOR sect.: see http://docbook.sf.net/el/contrib poedit Note: AUTHOR sect.: see http://docbook.sf.net/el/personblurb poedit Note: Writing poedit.1 rm poedit.1.xml make: Leaving directory '/home/ubuntu/poedit/docs' ./bootstrap: 8: ./bootstrap: msgfmt: not found $ msgfmt The program 'msgfmt' is currently not installed. You can install it by typing: sudo apt install gettext $ sudo apt install gettext (輸出省略) $ ./bootstrap - aclocal - automake - autoconf - generate-docs.make make: Entering directory '/home/ubuntu/poedit/docs' make: Nothing to be done for 'all'. make: Leaving directory '/home/ubuntu/poedit/docs' - msgfmt ``` 接著就可以重複執行產生出來的 `configure` 軟體建構設定程序來檢查是否安裝所有建構 Poedit 需要的軟體(以及正確的軟體版本)。缺少的程式庫開發用檔案可以透過 `apt search '^lib關鍵字.*-dev$'` 命令搜尋提供它們的軟體包。此外您可以執行 `./configure --help` 命令查閱可自訂的選項列表與可影響建構細節的環境變數。 接下來*在支援的軟體建構系統下*為了避免軟體建構過程中產生的檔案跟來源碼樹源有的檔案混在一起我們建一個建構目錄並移駕到其中來繼續進行軟體建構程序(其實如果來源碼樹有被版本控制這其實不需要,但仍然是個最佳實務作法(best practice)(TM))。 ``` $ mkdir build $ cd build ``` ### 安裝軟體建構工具鏈<br>Install Software Building Toolchain #### 安裝C語言程式工具鏈(GCC)<br>Install C Toolchain(GCC) ``` $ ../configure \ --prefix=/opt/poedit-2.1.1-oss (以下省略) checking for gcc... no checking for cc... no checking for cl.exe... no configure: error: in `/home/ubuntu/poedit': configure: error: no acceptable C compiler found in $PATH See `config.log' for more details $ gcc The program 'gcc' is currently not installed. You can install it by typing: sudo apt install gcc $ sudo apt install gcc (以下省略) ``` #### 安裝GNU C 程式庫(Glibc)的開發用資料<br>Install The GNU C Library(Glibc)'s Development Data ``` $ ../configure \ --prefix=/opt/poedit-2.1.1-oss (以下省略) checking for gcc... gcc checking whether the C compiler works... no configure: error: in `/home/ubuntu/poedit': configure: error: C compiler cannot create executables See `config.log' for more details $ less config.log (以下省略) configure:3652: checking whether the C compiler works configure:3674: gcc conftest.c >&5 /usr/bin/ld: cannot find crt1.o: No such file or directory /usr/bin/ld: cannot find crti.o: No such file or directory /usr/bin/ld: cannot find -lc /usr/bin/ld: cannot find crtn.o: No such file or directory collect2: error: ld returned 1 exit status configure:3678: $? = 1 configure:3716: result: no configure: failed program was: (以下省略) configure:3721: error: in `/home/ubuntu/poedit': configure:3723: error: C compiler cannot create executables See `config.log' for more details ``` 於[Ubuntu Packages Search](https://packages.ubuntu.com)搜尋提供檔案路徑結尾為 `crt1.o` 的 Ubuntu 軟體包可得知該檔案由`libc6-dev`,*GNU C 程式庫的開發用資料*的軟體包所提供。 ``` $ sudo apt install \ libc6-dev (以下省略) ``` #### 安裝C\+\+語言程式工具鏈(G\+\+)<br>Install C++ Toolchain(G\+\+) ``` $ ../configure \ --prefix=/opt/poedit-2.1.1-oss (以下省略) checking for g++... no checking for c++... no checking for gpp... no checking for aCC... no checking for CC... no checking for cxx... no checking for cc++... no checking for cl.exe... no checking for FCC... no checking for KCC... no checking for RCC... no checking for xlC_r... no checking for xlC... no checking whether we are using the GNU C++ compiler... no checking whether g++ accepts -g... no checking dependency style of g++... none checking how to run the C++ preprocessor... /lib/cpp configure: error: in `/home/ubuntu/poedit': configure: error: C++ preprocessor "/lib/cpp" fails sanity check See `config.log' for more details $ g++ The program 'g++' is currently not installed. You can install it by typing: sudo apt install g++ $ sudo apt install g++ (以下省略) ``` ### 建構並安裝部份Ubuntu 16.04無法提供或提供的版本太舊的依賴軟體(第一部份)<br>Build and Install a Part of Dependencies that are not Shipped by Ubuntu 16.04 or are Too Old(Part 1) Poedit 將部份的依賴軟體自帶於來源碼庫的 `deps` 子目錄中,部份的依賴軟體源碼以[Git子模組(submodule)](https://git-scm.com/book/zh-tw/v1/Git-%E5%B7%A5%E5%85%B7-%E5%AD%90%E6%A8%A1%E7%B5%84-Submodules)的形式存在,部份則直接位於來源碼庫內,*上游建議安裝自帶版本*的依賴軟體。 注意:安裝前綴路徑(installation prefix)建議使用 `/opt/軟體名-poedit` 而非預設的 `/usr/local` 以方便事後移除。 #### Boost程式庫(第一部份)<br>Boost Libraries(Part 1) ``` $ ../configure \ --prefix=/opt/poedit-2.1.1-oss (以下省略) checking for boostlib >= 1.60 (106000)... configure: We could not detect the boost libraries (version 1.60 or higher). If you have a staged boost library (still not installed) please specify $BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation. configure: error: Boost libraries are required ``` ``` $ apt search \ '^libboost.*-dev$' Sorting... 完成 Full Text Search... 完成 libboost-all-dev/xenial 1.58.0.1ubuntu1 amd64 Boost C++ Libraries development files (ALL) (default version) (以下省略) ``` Poedit依賴1.60版或更近期的Boost程式庫版本但Ubuntu 16.04僅提供1.58版,因此我們須自行建構並安裝相容的版本(Poedit有自帶一份相容版本的Boost程式庫於 `deps/boost` 目錄)。 ``` $ pushd \ ../deps/boost $ ./bootstrap.sh \ --prefix=/opt/boost-poedit Building Boost.Build engine with toolset gcc... tools/build/src/engine/bin.linuxx86_64/b2 Unicode/ICU support for Boost.Regex?... not found. (以下省略) ``` Boost.Regex程式庫的Unicode/ICU支援需要*某種軟體*,在 `boostrap.sh` 以 `ICU` 為關鍵字搜尋之後可以發現它實際上是在偵測 `unicode/utypes.h` 這個標頭檔: ```sh # Configure ICU $ECHO -n "Unicode/ICU support for Boost.Regex?... " if test "x$flag_icu" != xno; then if test "x$ICU_ROOT" = x; then COMMON_ICU_PATHS="/usr /usr/local /sw" for p in $COMMON_ICU_PATHS; do if test -r $p/include/unicode/utypes.h; then ICU_ROOT=$p fi done if test "x$ICU_ROOT" = x; then echo "not found." else BJAM_CONFIG="$BJAM_CONFIG -sICU_PATH=$ICU_ROOT" echo "$ICU_ROOT" fi else BJAM_CONFIG="$BJAM_CONFIG -sICU_PATH=$ICU_ROOT" echo "$ICU_ROOT" fi else echo "disabled." fi ``` 於[Ubuntu Packages Search](https://packages.ubuntu.com)搜尋提供檔案路徑結尾為 `unicode/utypes.h` 的 Ubuntu 軟體包可得知該檔案由 `libicu-dev` 軟體包所提供。 ![搜尋表單畫面截圖](https://i.imgur.com/fieLDwi.png) [![搜尋結果畫面截圖](https://i.imgur.com/e26680l.png)](https://packages.ubuntu.com/search?searchon=contents&keywords=unicode%2Futypes.h&mode=&suite=xenial&arch=any) ```bash $ sudo apt install \ libicu-dev (以下省略) $ ./bootstrap.sh \ --prefix=/opt/boost-poedit Building Boost.Build engine with toolset gcc... tools/build/src/engine/bin.linuxx86_64/b2 Unicode/ICU support for Boost.Regex?... not found. (以下省略) ``` ……還是找不到,重新審閱 `bootstrap.sh` 程式後可發現該程式的偵測路徑並不支援Debian的multiarch路徑所致,讓我們抓一下Debian包的Boost程式庫來看看他們是怎麼處理的: ``` $ apt showsrc \ libboost1.58-dev \ | grep ^Package: WARNING: apt does not have a stable CLI interface. Use with caution in scripts. Package: boost1.58 Package: boost1.58 $ apt source boost1.58 正在讀取套件清單... 完成 請注意:'boost1.58' 套件是在下列位置被 'Svn' 版本控制系統所維護的: svn://anonscm.debian.org/pkg-boost/boost/ 需要下載 82.9 MB 的原始套件檔。 下載:1 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main boost1.58 1.58.0+dfsg-5ubuntu3.1 (dsc) [6,701 B] 下載:2 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main boost1.58 1.58.0+dfsg-5ubuntu3.1 (tar) [82.7 MB] 下載:3 http://tw.archive.ubuntu.com/ubuntu xenial-updates/main boost1.58 1.58.0+dfsg-5ubuntu3.1 (diff) [159 kB] 取得 82.9 MB 用了 8秒 (10.0 MB/s) gpgv: 由 2016年06月11日 (週六) 07時09分26秒 CST 建立的簽章, 使用 RSA 金鑰 ID 54FC8640 gpgv: 無法檢查簽章: 找不到公鑰 dpkg-source: 警告: 未能驗證 ./boost1.58_1.58.0+dfsg-5ubuntu3.1.dsc 的簽章 dpkg-source: 資訊: extracting boost1.58 in boost1.58-1.58.0+dfsg dpkg-source: 資訊: unpacking boost1.58_1.58.0+dfsg.orig.tar.gz dpkg-source: 資訊: unpacking boost1.58_1.58.0+dfsg-5ubuntu3.1.debian.tar.xz (以下省略) $ grep ICU boost1.58-1.58.0+dfsg/debian/* boost1.58-1.58.0+dfsg/debian/changelog: * Build using ICU 55.1 boost1.58-1.58.0+dfsg/debian/changelog: * Build using ICU 55.1. boost1.58-1.58.0+dfsg/debian/changelog: * Specify --with-icu=/usr to unconditionally trigger HAVE_ICU define, boost1.58-1.58.0+dfsg/debian/copyright: FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT grep: boost1.58-1.58.0+dfsg/debian/patches: 是個目錄 grep: boost1.58-1.58.0+dfsg/debian/source: 是個目錄 $ less boost1.58-1.58.0+dfsg/debian/changelog (以下省略) [ Dmitrijs Ledkovs ] * Use anonscm URLs. * libboost-dev: Specify dependency on current libstdc++6-4.8-dev, instead of obsolete libstdc++6-4.4-dev. Fixes Multi-Arch installation (LP: #1209193) * Specify --with-icu=/usr to unconditionally trigger HAVE_ICU define, i.e. independent of icu multiarch. (以下省略) ``` 看來是可以指定 `--with-icu=/usr` 命令列選項繞過自動偵測而且還可以動的(攤手)。 ``` $ ./bootstrap.sh \ --prefix=/opt/boost-poedit \ --with-icu=/usr (以下省略) Unicode/ICU support for Boost.Regex?... /usr (以下省略) Bootstrapping is done. To build, run: ./b2 To adjust configuration, edit 'project-config.jam'. Further information: - Command line help: ./b2 --help (以下省略) $ ./b2 \ -j$(nproc) \ stage Performing configuration checks - 32-bit : no - 64-bit : yes - arm : no - mips1 : no - power : no - sparc : no - x86 : yes - symlinks supported : yes - C++11 mutex : no - lockfree boost::atomic_flag : yes - has_icu builds : yes warning: Graph library does not contain MPI-based parallel components. note: to enable them, add "using mpi ;" to your user-config.jam - zlib : no - iconv (libc) : yes - icu : yes - compiler-supports-visibility : yes - compiler-supports-ssse3 : yes - compiler-supports-avx2 : yes - gcc visibility : yes - long double support : yes warning: skipping optional Message Passing Interface (MPI) library. note: to enable MPI support, add "using mpi ;" to user-config.jam. note: to suppress this message, pass "--without-mpi" to bjam. note: otherwise, you can safely ignore this message. - zlib : no (以下省略) ^C ``` 我們似乎還缺少了一些軟體建構依賴軟體: ```bash $ apt search \ libzlib Sorting... 完成 Full Text Search... 完成 (!?) $ apt search \ zlib (以下省略) zlib1g/xenial-updates,now 1:1.2.8.dfsg-2ubuntu4.1 amd64 [installed] compression library - runtime zlib1g-dbg/xenial-updates 1:1.2.8.dfsg-2ubuntu4.1 amd64 compression library - development zlib1g-dev/xenial-updates 1:1.2.8.dfsg-2ubuntu4.1 amd64 compression library - development (以下省略) $ sudo apt install \ zlib1g-dev (以下省略) $ apt search \ mpi Sorting... Done Full Text Search... Done (以下省略) mpi-default-dev/xenial 1.4 amd64 Standard MPI development files (metapackage) $ sudo apt install \ mpi-default-dev (以下省略) $ echo 'using mpi ;' >>user-config.jam $ ./b2 \ -j$(nproc) \ stage Performing configuration checks (以下省略) - lockfree boost::atomic_flag : yes - has_icu builds : yes warning: Graph library does not contain MPI-based parallel components. note: to enable them, add "using mpi ;" to your user-config.jam - zlib : yes (以下省略) warning: skipping optional Message Passing Interface (MPI) library. note: to enable MPI support, add "using mpi ;" to user-config.jam. note: to suppress this message, pass "--without-mpi" to bjam. note: otherwise, you can safely ignore this message. - zlib : yes ^C (!???) ``` ……來開個設定程序除錯選項好了: ``` $ ./b2 \ -j$(nproc) \ --debug-configuration \ stage (以下省略) notice: Searching '/home/ubuntu' '/home/ubuntu/poedit/deps/boost/tools/build/src' '/usr/share/boost-build' '/home/ubuntu/poedit/deps/boost/tools/build/src/kernel' '/home/ubuntu/poedit/deps/boost/tools/build/src/util' '/home/ubuntu/poedit/deps/boost/tools/build/src/build' '/home/ubuntu/poedit/deps/boost/tools/build/src/tools' '/home/ubuntu/poedit/deps/boost/tools/build/src/contrib' '/home/ubuntu/poedit/deps/boost/tools/build/src/.' for user-config configuration file 'user-config.jam'. notice: Configuration file 'user-config.jam' not found in '/home/ubuntu' '/home/ubuntu/poedit/deps/boost/tools/build/src' '/usr/share/boost-build' '/home/ubuntu/poedit/deps/boost/tools/build/src/kernel' '/home/ubuntu/poedit/deps/boost/tools/build/src/util' '/home/ubuntu/poedit/deps/boost/tools/build/src/build' '/home/ubuntu/poedit/deps/boost/tools/build/src/tools' '/home/ubuntu/poedit/deps/boost/tools/build/src/contrib' '/home/ubuntu/poedit/deps/boost/tools/build/src/.'. (以下省略) ``` 原來是要放在 `tools/build/src` 或是家目錄底下啊(攤手) ``` $ echo 'using mpi ;' >>tools/build/src/user-config.jam $ ./b2 \ -j$(nproc) \ stage Performing configuration checks - 32-bit : no (cached) - 64-bit : yes (cached) - arm : no (cached) - mips1 : no (cached) - power : no (cached) - sparc : no (cached) - x86 : yes (cached) - symlinks supported : yes (cached) - C++11 mutex : no (cached) - lockfree boost::atomic_flag : yes (cached) - has_icu builds : yes (cached) - zlib : yes (cached) - iconv (libc) : yes (cached) - icu : yes (cached) - compiler-supports-visibility : yes (cached) - compiler-supports-ssse3 : yes (cached) - compiler-supports-avx2 : yes (cached) - gcc visibility : yes (cached) - long double support : yes (cached) - zlib : yes (cached) (以下省略) gcc.compile.c++ bin.v2/libs/python/build/gcc-5.4.0/release/link-static/threading-multi/numeric.o In file included from ./boost/python/detail/prefix.hpp:13:0, from ./boost/python/numeric.hpp:8, from libs/python/src/numeric.cpp:6: ./boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory compilation terminated. ``` ![!?](https://i.imgur.com/fm6wTOY.png) 說好的會自動跳過呢(翻桌) 於[Ubuntu Packages Search](https://packages.ubuntu.com)搜尋提供檔案路徑結尾為 `pyconfig.h` 的 Ubuntu 軟體包可得知該檔案由 `libpython2.7-dev` 與 `libpython3.5-dev` 軟體包所提供。根據 Boost.Python 於 `libs/python/doc/html/building.html#building.requirements` 的說明文件其依賴2.2版之後的 Python 版本所以安裝版本較接近的 `libpython2.7-dev` 軟體包: ``` $ sudo apt install \ libpython2.7-dev (以下省略) $ ./b2 \ -j$(nproc) \ stage (以下省略) gcc.compile.c++ bin.v2/libs/python/build/gcc-5.4.0/release/link-static/threading-multi/numeric.o In file included from ./boost/python/detail/prefix.hpp:13:0, from ./boost/python/numeric.hpp:8, from libs/python/src/numeric.cpp:6: ./boost/python/detail/wrap_python.hpp:50:23: fatal error: pyconfig.h: No such file or directory compilation terminated. ^C (!???) ``` 再除錯一次軟體建構設定程序 ``` $ ./b2 \ -j$(nproc) \ --debug-configuration \ stage (以下省略) notice: [python-cfg] Configuring python... notice: [python-cfg] Checking interpreter command "python"... notice: [python-cfg] running command 'python -c "from sys import *; print('version=%d.%d\nplatform=%s\nprefix=%s\nexec_prefix=%s\nexecutable=%s' % (version_info[0],version_info[1],platform,prefix,exec_prefix,executable))" 2>&1' notice: [python-cfg] ...does not invoke a working interpreter notice: [python-cfg] No working Python interpreter found. notice: [python-cfg] falling back to "python" notice: [python-cfg] Details of this Python configuration: notice: [python-cfg] interpreter command: "python" notice: [python-cfg] include path: "/include/python2.5" notice: [python-cfg] library path: "/lib/python2.5/config" "/lib" ``` 找不到Python直譯器的樣子 ``` $ python The program 'python' can be found in the following packages: * python-minimal * python3 Try: sudo apt install <selected package> $ sudo apt install \ python-minimal (以下省略) $ ./b2 \ -j$(nproc) \ stage (以下省略) gcc.compile.c++ bin.v2/libs/iostreams/build/gcc-5.4.0/release/threading-multi/bzip2.o libs/iostreams/src/bzip2.cpp:20:56: fatal error: bzlib.h: No such file or directory compilation terminated. ``` ……你是不能在前面跟 zlib 程式庫一樣直接說偵測不到 bzip 程式庫嗎? ```bzip $ sudo apt install libbz2-dev (以下省略) $ ./b2 \ -j$(nproc) \ stage (以下省略) $ sudo ./b2 \ install (以下省略) $ popd ~/poedit ``` 終於裝完惹,呼~ #### wxWidgets程式庫<br>wxWidgets Libraries ``` $ ./configure \ --prefix=/opt/poedit-2.1.1-oss \ --with-boost=/opt/boost-poedit (以下省略) checking for wx-config... /usr/bin/wx-config checking for wxWidgets version >= 3.0.3 (--unicode)... no (version 3.0.2 is not new enough) configure: error: Please check that wx-config is in path, the directory where wxWidgets libraries are installed (returned by 'wx-config --unicode --libs' command) is in LD_LIBRARY_PATH or equivalent variable and wxWidgets is version 3.0.0 or above, with Unicode build available. ``` Poedit依賴3.0.3版或更近期的版本但Ubuntu 16.04僅提供3.0.2版,因此我們須自行建構並安裝相容的版本(Poedit有自帶一份相容版本的wxWidgets程式庫來源碼於 `deps/wx` 目錄)。 執行下列命令將子模組的內容取出: ```sh $ git submodule init \ deps/wx (以下省略) $ git submodule update \ deps/wx (以下省略) $ pushd deps/wx ``` 根據來源碼中[README.md說明文件](https://github.com/vslavik/wxWidgets/blob/master/README.md)中[建構軟體(Building)區塊](https://github.com/vslavik/wxWidgets/blob/master/README.md#building)的說明,遵循[BuildGit.txt說明文件](https://github.com/vslavik/wxWidgets/blob/master/README-GIT.md)的指示執行下列命令將其子模組之內容全部取出: ``` $ git submodule \ update \ --init ``` 然後參閱[wxWidgets for GTK+的說明文件](https://github.com/vslavik/wxWidgets/tree/master/docs/gtk)與[安裝指引](https://github.com/vslavik/wxWidgets/blob/master/docs/gtk/install.txt)建構wxWidgets for GTK+。由於預設建構針對的Gtk第二版已被第三版逐漸取代故我們改針對Gtk第三版建構。 ```bash $ mkdir build_gtk $ cd build_gtk $ ../configure \ --prefix=/opt/wx-poedit \ --with-gtk=3 (以下省略) checking for png.h > 0.90... no checking for png.h... (cached) no configure: WARNING: system png library not found or too old, will use built-in instead (以下省略) ``` 雖然 wxWidgets 有自帶 PNG 程式庫,但是基本上還是建議能用作業系統散佈版提供的就用作業系統散佈版提供的版本。 ``` $ apt search \ '^libpng.*-dev$' (以下省略) libpng12-dev/xenial-updates,xenial-security 1.2.54-1ubuntu1.1 amd64 PNG library - development libpng16-dev/xenial 1.6.20-2 amd64 PNG library - development (version 1.6) (以下省略) ``` 如果作業系統散佈版有提供同程式庫的多種版本的話,**選擇作業系統散佈版有提供安全性更新支援的那一個版本**: ``` $ apt show \ libpng12-dev ``` > Package: libpng12-dev > Version: 1.2.54-1ubuntu1.1 > > (以下省略) > > **Supported: 5y** > > (以下省略) > > APT-Sources: http://tw.archive.ubuntu.com/ubuntu xenial-updates/**main** amd64 Packages > > (以下省略) > ``` $ apt show \ libpng16-dev ``` > Package: libpng16-dev > > (以下省略) > > APT-Sources: http://tw.archive.ubuntu.com/ubuntu xenial/**universe** amd64 Packages > > (以下省略) > ``` $ sudo apt install \ libpng12-dev (以下省略) ``` ``` $ ../configure \ --prefix=/opt/wx-poedit \ --with-gtk=3 (以下省略) checking for jpeglib.h... no configure: WARNING: system jpeg library not found, will use built-in instead (以下省略) $ apt search \ '^libjpeg.*-dev$' Sorting... Done Full Text Search... Done llibjpeg-dev/xenial 8c-2ubuntu8 amd64 Independent JPEG Group's JPEG runtime library (dependency package) libjpeg-turbo8-dev/xenial-updates,xenial-security 1.4.2-0ubuntu3.1 amd64 Development files for the IJG JPEG library libjpeg62-dev/xenial 1:6b2-2 amd64 Development files for the IJG JPEG library (version 6.2) libjpeg8-dev/xenial 8c-2ubuntu8 amd64 Independent JPEG Group's JPEG runtime library (dependency package) libjpeg9-dev/xenial-updates 1:9b-1ubuntu1 amd64 Development files for the IJG JPEG library $ apt show \ libjpeg-dev Package: libjpeg-dev Version: 8c-2ubuntu8 (以下省略) Supported: 9m (以下省略) APT-Sources: http://tw.archive.ubuntu.com/ubuntu xenial/main amd64 Packages (以下省略) ``` 雖然 `libjpeg-dev` 支援期是很莫名其妙的9個月([據說是軟體缺陷](https://www.facebook.com/groups/ubuntu.zh.hant/permalink/2258398547548788/))但是它間接依賴的`libjpeg-turbo8-dev`確定支援期是5年所以用這個版本。 ``` $ sudo apt install \ libjpeg-dev (以下省略) $ ../configure \ --prefix=/opt/wx-poedit \ --with-gtk=3 (以下省略) checking for tiffio.h... no configure: WARNING: system tiff library not found, will use built-in instead (以下省略) $ apt search \ '^libtiff.*-dev$' Sorting... Done Full Text Search... Done libtiff5-dev/xenial-updates,xenial-security 4.0.6-1ubuntu0.4 amd64 Tag Image File Format library (TIFF), development files $ sudo apt install \ libtiff5-dev (以下省略) $ ../configure \ --prefix=/opt/wx-poedit \ --with-gtk=3 (以下省略) checking for GTK+ version... checking for pkg-config... /usr/bin/pkg-config checking for GTK+ - version >= 3.0.0... Package gtk+-3.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `gtk+-3.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gtk+-3.0' found (以下省略) $ apt search \ '^libgtk.*3.*-dev$' Sorting... Done Full Text Search... Done libgtk-3-dev/xenial-updates 3.18.9-1ubuntu3.3 amd64 development files for the GTK+ library (以下省略) $ sudo apt install \ libgtk-3-dev (以下省略) $ ../configure \ --prefix=/opt/wx-poedit \ --with-gtk=3 (以下省略) checking for OpenGL headers... not found checking for GL/gl.h... no configure: WARNING: OpenGL libraries not available, disabling support for OpenGL (以下省略) $ apt search \ '^libgl.*-dev$' Sorting... Done Full Text Search... Done libgl1-mesa-dev/xenial-updates 18.0.5-0ubuntu0~16.04.1 amd64 free implementation of the OpenGL API -- GLX development files (以下省略) $ sudo apt install \ libgl1-mesa-dev (以下省略) $ ../configure \ --prefix=/opt/wx-poedit \ --with-gtk=3 (以下省略) checking for GL/glu.h... no configure: WARNING: OpenGL libraries not available, disabling support for OpenGL (以下省略) $ apt search '^libglu.*-dev$' Sorting... Done Full Text Search... Done libglu1-mesa-dev/xenial 9.0.0-2.1 amd64 Mesa OpenGL utility library -- development files $ sudo apt install \ libglu1-mesa-dev (以下省略) $ ../configure \ --prefix=/opt/wx-poedit \ --with-gtk=3 (以下省略) checking for LIBSECRET... configure: WARNING: libsecret not found, wxSecretStore won't be available (以下省略) $ apt search \ '^libsecret.*-dev$' Sorting... Done Full Text Search... Done libsecret-1-dev/xenial 0.18.4-1ubuntu2 amd64 Secret store (development files)「只要有任何問題 $ sudo apt install \ libsecret-1-dev $ ../configure \ --prefix=/opt/wx-poedit \ --with-gtk=3 (以下省略) checking for LIBNOTIFY... checking for LIBNOTIFY... configure: WARNING: libnotify not found, wxNotificationMessage will use generic implementation. (以下省略) $ apt search \ '^libnotify.*-dev$' (以下省略) libnotify-dev/xenial 0.7.6-2svn1 amd64 sends desktop notifications to a notification daemon (Development files) (以下省略) $ sudo apt install \ libnotify-dev (以下省略) $ ../configure \ --prefix=/opt/wx-poedit \ --with-gtk=3 (以下省略) checking for WEBKIT... configure: WARNING: webkit2gtk not found, falling back to webkitgtk checking for WEBKIT... configure: WARNING: webkitgtk not found. (以下省略) $ apt search \ '^libwebkit2gtk.*-dev$' Sorting... Done Full Text Search... Done libwebkit2gtk-3.0-dev/xenial-updates 2.4.11-0ubuntu0.1 amd64 WebKit2 API layer for WebKitGTK+ - development files libwebkit2gtk-4.0-dev/xenial-updates,xenial-security 2.20.5-0ubuntu0.16.04.1 amd64 Web content engine library for GTK+ - development files $ apt show \ 'libwebkit2gtk-*-dev' ``` > Package: libwebkit2gtk-4.0-dev > Version: 2.20.5-0ubuntu0.16.04.1 > > (以下省略) > > **Supported: 5y** > Download-Size: 176 kB > APT-Sources: http://tw.archive.ubuntu.com/ubuntu xenial-updates/**main** amd64 Packages > > (以下省略) > > Package: libwebkit2gtk-3.0-dev > Version: 2.4.11-0ubuntu0.1 > > (以下省略) > > Supported: 5y > Download-Size: 163 kB > APT-Sources: http://tw.archive.ubuntu.com/ubuntu xenial-updates/**universe** > amd64 Packages > > (以下省略) > ``` $ sudo apt install \ libwebkit2gtk-4.0-dev (以下省略) $ ../configure \ --prefix=/opt/wx-poedit \ --with-gtk=3 (以下省略) checking for GST... configure: GStreamer 1.7.2+ not available. Not using GstPlayer and falling back to 1.0 checking for GST... configure: WARNING: GStreamer 1.0 not available, falling back to 0.10 checking for GST... configure: WARNING: GStreamer 0.10 not available configure: WARNING: GStreamer not available... disabling wxMediaCtrl (以下省略) $ apt search \ '^libgstreamer.*-dev$' (以下省略) libgstreamer0.10-dev/xenial 0.10.36-1.5ubuntu1 amd64 GStreamer core development files libgstreamer1.0-dev/xenial-updates 1.8.3-1~ubuntu0.1 amd64 GStreamer core development files (以下省略) $ sudo apt install \ libgstreamer1.0-dev (以下省略) $ ../configure \ --prefix=/opt/wx-poedit \ --with-gtk=3 (以下省略) checking for GST... configure: GStreamer 1.7.2+ not available. Not using GstPlayer and falling back to 1.0 checking for GST... configure: WARNING: GStreamer 1.0 not available, falling back to 0.10 checking for GST... configure: WARNING: GStreamer 0.10 not available configure: WARNING: GStreamer not available... disabling wxMediaCtrl (以下省略) (!?) ``` ……嗯?還是沒有?! 來看看 `config.log` 軟體建構設定程序紀錄檔: ```sh $ less config.log (以下省略) configure:38415: checking for GST configure:38423: $PKG_CONFIG --exists --print-errors "gstreamer-$GST_VERSION gstreamer-video-$GST_VERSION gstreamer-player-$GST_VERSION >= 1.7.2.1" Package gstreamer-video-1.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `gstreamer-video-1.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gstreamer-video-1.0' found (以下省略) ``` 於[Ubuntu Packages Search](https://packages.ubuntu.com)搜尋提供檔案路徑結尾為 `gstreamer-video-1.0.pc` 的 Ubuntu 軟體包可得知該檔案由`libgstreamer-plugins-base1.0-dev` 軟體包所提供。 ``` $ sudo apt install \ libgstreamer-plugins-base1.0-dev (以下省略) $ ../configure \ --prefix=/opt/wx-poedit \ --with-gtk=3 (以下省略) checking for GST... configure: GStreamer 1.7.2+ not available. Not using GstPlayer and falling back to 1.0 checking for GST... yes (以下省略) $ less config.log (以下省略) configure:38415: checking for GST configure:38423: $PKG_CONFIG --exists --print-errors "gstreamer-$GST_VERSION gstreamer-video-$GST_VERSION gstreamer-player-$GST_VERSION >= 1.7.2.1" Package gstreamer-player-1.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `gstreamer-player-1.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gstreamer-player-1.0' found (以下省略) ``` 於[Ubuntu Packages Search](https://packages.ubuntu.com)搜尋提供檔案路徑結尾為 `gstreamer-player-1.0.pc` 的 Ubuntu 軟體包可得知該檔案由 `libgstreamer-plugins-bad1.0-dev` 軟體包所提供。 ``` $ sudo apt install \ libgstreamer-plugins-bad1.0-dev (以下省略) $ ../configure \ --prefix=/opt/wx-poedit \ --with-gtk=3 (以下省略) Configured wxWidgets 3.1.2 for `x86_64-pc-linux-gnu' Which GUI toolkit should wxWidgets use? GTK+ 3 with support for GTK+ printing libnotify Should wxWidgets be compiled into single library? no Should wxWidgets be linked as a shared library? yes Should wxWidgets support Unicode? yes (using wchar_t) What level of wxWidgets compatibility should be enabled? wxWidgets 2.8 no wxWidgets 3.0 yes Which libraries should wxWidgets use? STL no jpeg sys png sys regex builtin tiff sys lzma yes zlib sys expat sys libmspack no sdl no $ make \ --jobs="$(nproc)" (以下省略) $ sudo make install (以下省略) $ popd ~/poedit ``` 結束惹~ ### 安裝Gtkspell程式庫<br>Install Gtkspell Library ``` $ ../configure \ --prefix=/opt/poedit-2.1.1-oss \ --with-boost=/opt/boost-poedit \ --with-wx-prefix=/opt/wx-poedit (以下省略) checking for GTKSPELL... no configure: error: missing GtkSpell library $ apt search \ '^libgtkspell.*-dev$'Sorting... Done Full Text Search... Done libgtkspell-dev/xenial 2.0.16-1.1ubuntu1 amd64 Development files for GtkSpell libgtkspell3-3-dev/xenial 3.0.7-2 amd64 Development files for GtkSpell libgtkspellmm-3.0-dev/xenial 3.0.3+dfsg-2ubuntu1 amd64 C++ wrapper library for GtkSpell (development files) $ less config.log (以下省略) configure:8639: checking for GTKSPELL configure:8646: $PKG_CONFIG --exists --print-errors "$gtkspell_packages" Package gtkspell3-3.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `gtkspell3-3.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gtkspell3-3.0' found configure:8649: $? = 1 configure:8663: $PKG_CONFIG --exists --print-errors "$gtkspell_packages" Package gtkspell3-3.0 was not found in the pkg-config search path. Perhaps you should add the directory containing `gtkspell3-3.0.pc' to the PKG_CONFIG_PATH environment variable No package 'gtkspell3-3.0' found configure:8666: $? = 1 configure:8680: result: no No package 'gtkspell3-3.0' found configure:8697: error: missing GtkSpell library (以下省略) ``` 參閱config.log軟體建構設定紀錄檔我們可以知道要安裝的是libgtkspell3-3-dev軟體包: ``` $ sudo apt install \ libgtkspell3-3-dev (以下省略) ``` ### 安裝 Lucene++ 程式庫 ``` $ ../configure \ --prefix=/opt/poedit-2.1.1-oss \ --with-boost=/opt/boost-poedit \ --with-wx-prefix=/opt/wx-poedit (以下省略) checking for LUCENE... no configure: error: missing Lucene++ library $ apt search \ 'liblucene.*-dev$' Sorting... Done Full Text Search... Done liblucene++-dev/xenial 3.0.7-8 amd64 Development files for Lucene++ $ sudo apt install \ liblucene++-dev (以下省略) ```` ### 建構並安裝部份Ubuntu 16.04無法提供或提供的版本太舊的依賴軟體(第二部份)<br>Build and Install a Part of Dependencies that are not Shipped by Ubuntu 16.04 or are Too Old(Part 2) #### pugixml程式庫 ``` $ ../configure \ --prefix=/opt/poedit-2.1.1-oss \ --with-boost=/opt/boost-poedit \ --with-wx-prefix=/opt/wx-poedit (以下省略) checking for PUGIXML... no (以下省略) $ apt search \ 'libpugixml.*-dev$' Sorting... Done Full Text Search... Done libpugixml-dev/xenial 1.7-2 amd64 Light-weight C++ XML processing library (development) $ sudo apt install \ libpugixml-dev (以下省略) $ ../configure \ --prefix=/opt/poedit-2.1.1-oss \ --with-boost=/opt/boost-poedit \ --with-wx-prefix=/opt/wx-poedit (以下省略) checking for PUGIXML... no (以下省略) (?) ``` 查閱config.log軟體建構設定程式紀錄檔: ``` $ less config.log (以下省略) configure:8799: checking for PUGIXML configure:8806: $PKG_CONFIG --exists --print-errors "pugixml >= 1.9" Package pugixml was not found in the pkg-config search path. Perhaps you should add the directory containing `pugixml.pc' to the PKG_CONFIG_PATH environment variable No package 'pugixml' found (以下省略) ``` 可以知道Ubuntu 16.04提供的Pugixml程式庫版本*太舊*,需改使用Poedit自帶的版本: ``` $ git submodule init \ '../deps/pugixml' (以下省略) $ git submodule update \ '../deps/pugixml' (以下省略) $ pushd ../deps/pugixml $ ls CMakeLists.txt Makefile appveyor.yml docs scripts tests LICENSE.md README.md contrib readme.txt src ``` 從來源碼樹中的檔案看起來是用Cmake軟體建構系統,來安裝一下: ``` $ sudo apt install \ cmake \ cmake-curses-gui (以下省略) $ mkdir build $ cd build $ ccmake .. (界面操作說明) 1. 按 c 執行軟體設定程序 2. 編輯 `CMAKE_INSTALL_PREFIX` 選項的值為 `/opt/pugixml-poedit` 3. 按 c 重新執行軟體設定程序 4. 按 g 產生軟體建構食譜 $ make \ --jobs=$(nproc) Scanning dependencies of target pugixml [ 50%] Building CXX object CMakeFiles/pugixml.dir/src/pugixml.cpp.o [100%] Linking CXX static library libpugixml.a [100%] Built target pugixml $ sudo make install [100%] Built target pugixml Install the project... -- Install configuration: "" -- Installing: /opt/pugixml-poedit/lib/libpugixml.a -- Installing: /opt/pugixml-poedit/include/pugixml.hpp -- Installing: /opt/pugixml-poedit/include/pugiconfig.hpp -- Installing: /opt/pugixml-poedit/lib/cmake/pugixml/pugixml-config.cmake -- Installing: /opt/pugixml-poedit/lib/cmake/pugixml/pugixml-config-noconfig.cmake -- Installing: /opt/pugixml-poedit/lib/pkgconfig/pugixml.pc $ popd ~/poedit/build ``` 由於Poedit的軟體建構設定程序並沒有提供指定pugixml程式庫自訂路徑的選項,我們必須要透過自訂`PKG_CONFIG_PATH`環境變數的方式來指定pugixml的pkg-config設定檔目錄。 ``` $ ../configure \ --help `configure' configures poedit 2.1.1 to adapt to many kinds of systems. Usage: ../configure [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. (以下省略) Some influential environment variables: (以下省略) PKG_CONFIG_PATH directories to add to pkg-config's search path (以下省略) ``` ### 安裝Compact Language Detector第二版程式庫 ``` $ ../configure \ --prefix=/opt/poedit-2.1.1-oss \ --with-boost=/opt/boost-poedit \ --with-wx-prefix=/opt/wx-poedit \ PKG_CONFIG_PATH=/opt/pugixml-poedit/lib/pkgconfig (以下省略) checking cld2/public/compact_lang_det.h usability... no checking cld2/public/compact_lang_det.h presence... no checking for cld2/public/compact_lang_det.h... no (以下省略) Configured poedit-2.1.1 for x86_64-pc-linux-gnu Enabled features: * debug build: no * language detection: no * crowdin integration: no !!! WARNING !!! Your are building a limited version of Poedit without some important features (see above). This makes Poedit harder to use and is strongly advised against. !!! WARNING !!! $ apt search \ 'libcld.*-dev$' Sorting... Done Full Text Search... Done libcld2-dev/xenial 0.0.0-git20150806-2 amd64 Compact Language Detector 2, development package $ sudo apt install \ libcld2-dev (以下省略) ``` ### 安裝 The C++ REST SDK ``` $ ../configure \ --prefix=/opt/poedit-2.1.1-oss \ --with-boost=/opt/boost-poedit \ --with-wx-prefix=/opt/wx-poedit \ PKG_CONFIG_PATH=/opt/pugixml-poedit/lib/pkgconfig (以下省略) checking cpprest/http_client.h usability... no checking cpprest/http_client.h presence... no checking for cpprest/http_client.h... no (以下省略) Configured poedit-2.1.1 for x86_64-pc-linux-gnu Enabled features: * debug build: no * language detection: yes * crowdin integration: no !!! WARNING !!! Your are building a limited version of Poedit without some important features (see above). This makes Poedit harder to use and is strongly advised against. !!! WARNING !!! $ apt search \ '^libcpprest.*-dev$' Sorting... Done Full Text Search... Done libcpprest-dev/xenial 2.8.0-2 amd64 Development files for Casablanca $ sudo apt install \ libcpprest-dev (以下省略) ``` 注意這邊安裝的版本有依賴第 1.58 版的 Boost 程式庫。 ## 建構Poedit(第一部份)<br>Build Poedit(Part 1) ``` $ ../configure \ --prefix=/opt/poedit-2.1.1-oss \ --with-boost=/opt/boost-poedit \ --with-wx-prefix=/opt/wx-poedit \ PKG_CONFIG_PATH=/opt/pugixml-poedit/lib/pkgconfig (以下省略) Configured poedit-2.1.1 for x86_64-pc-linux-gnu Enabled features: * debug build: no * language detection: yes * crowdin integration: yes $ make \ --jobs=4 (以下省略) CXX edapp.o (以下省略) In file included from ../../src/http_client.h:32:0, from ../../src/edapp.cpp:78: ../../src/json.h:34:37: fatal error: ../deps/json/src/json.hpp: No such file or directory compilation terminated. Makefile:698: recipe for target 'edapp.o' failed make[1]: *** [edapp.o] Error 1 (以下省略) Makefile:486: recipe for target 'all-recursive' failed make: *** [all-recursive] Error 1 ``` ## 安裝建構Poedit所需的軟體(第二部份)<br>Install Software Required by Poedit Building(Part 2) ### 建構並安裝部份Ubuntu 16.04無法提供或提供的版本太舊的依賴軟體(第三部份)<br>Build and Install a Part of Dependencies that are not Shipped by Ubuntu 16.04 or are Too Old(Part 3) #### JSON for Modern C++程式庫 Poedit的說明文件跟軟體建構設定程序失敗地沒有指出這是因為缺少了 [JSON for Modern C++](https://github.com/nlohmann/json) 程式庫所致,在軟體建構設定程序中只能稍微嗅出一點端倪: ``` $ ../configure \ --prefix=/opt/poedit-2.1.1-oss \ --with-boost=/opt/boost-poedit \ --with-wx-prefix=/opt/wx-poedit \ PKG_CONFIG_PATH=/opt/pugixml-poedit/lib/pkgconfig (以下省略) checking json.hpp usability... no checking json.hpp presence... no checking for json.hpp... no (以下省略) ``` [Ubuntu 16.04軟體庫並沒有提供該程式庫](https://packages.ubuntu.com/search?keywords=nlohmann&searchon=names&suite=all&section=all)但Poedit有自帶一份相容版本於 `deps/json` 子目錄中。先將來源碼庫子模組取出: ``` $ git submodule init \ ../deps/json Submodule 'src/json' (https://github.com/nlohmann/json.git) registered for path 'deps/json' $ git submodule update \ ../deps/json (以下省略) $ pushd ../deps/json $ ls CMakeLists.txt LICENSE.MIT README.md benchmarks doc test ChangeLog.md Makefile appveyor.yml cmake src ``` 根據JSON for Modern C++的[README.md說明文件中的整合區塊](https://github.com/nlohmann/json/blob/22b9a301d678383e545433e66a5d57eadddd2a76/README.md#integration),這個軟體不需要進行軟體建構與安裝 ~~,只需要將`src`目錄加進工具鍊的標頭檔(header)搜尋路徑中即可~~。 更正:Poedit其實有實作自動偵測,所以以下部份僅供參考**不要套用**: ``` $ popd ~/poedit/build $ ../configure \ --help `configure' configures poedit 2.1.1 to adapt to many kinds of systems. Usage: ../configure [OPTION]... [VAR=VALUE]... To assign environment variables (e.g., CC, CFLAGS...), specify them as VAR=VALUE. See below for descriptions of some of the useful variables. (以下省略) Some influential environment variables: (以下省略) CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if you have headers in a nonstandard directory <include dir> (以下省略) $ ../configure \ --prefix=/opt/poedit-2.1.1-oss \ --with-boost=/opt/boost-poedit \ --with-wx-prefix=/opt/wx-poedit \ PKG_CONFIG_PATH=/opt/pugixml-poedit/lib/pkgconfig \ CPPFLAGS=-I../deps/json/src (以下省略) ``` ## 建構Poedit(第二部份)<br>Build Poedit(Part 2) ``` $ ../configure \ --prefix=/opt/poedit-2.1.1-oss \ --with-boost=/opt/boost-poedit \ --with-wx-prefix=/opt/wx-poedit \ PKG_CONFIG_PATH=/opt/pugixml-poedit/lib/pkgconfig (以下省略) Configured poedit-2.1.1 for x86_64-pc-linux-gnu Enabled features: * debug build: no * language detection: yes * crowdin integration: yes $ make \ --jobs=$(nproc) (以下省略) /opt/wx-poedit/bin/wxrc-3.1 -v -c -o compiled_xrc.cpp ../../src/resources/comment.xrc ../../src/resources/manager.xrc ../../src/resources/menus.xrc ../../src/resources/prefs.xrc ../../src/resources/progress.xrc ../../src/resources/properties.xrc ../../src/resources/summary.xrc ../../src/resources/toolbar.xrc /opt/wx-poedit/bin/wxrc-3.1: error while loading shared libraries: libwx_baseu_xml-3.1.so.2: cannot open shared object file: No such file or directory Makefile:934: recipe for target 'compiled_xrc.cpp' failed make[1]: *** [compiled_xrc.cpp] Error 127 make[1]: *** Waiting for unfinished jobs.... (以下省略) Makefile:486: recipe for target 'all-recursive' failed make: *** [all-recursive] Error 1 (!????) ``` 看起來是建構時呼叫的 `/opt/wx-poedit/bin/wxrc-3.1` 找不到安裝在 `/opt/wx-poedit/lib` 中的共享程式庫,因為 `/opt/wx-poedit/lib` 並不在動態連結器(dynamic linker)的共享程式庫(shared library)搜尋路徑序列中。`ld.so` 動態連結器支援 `LD_LIBRARY_PATH` 環境變數讓其在執行時期下能變更共享程式庫的搜尋路徑,把 `/opt/wx-poedit/lib` 加進去就能解決此問題: ``` $ env LD_LIBRARY_PATH=/opt/wx-poedit/lib \ make \ --jobs=$(nproc) (以下省略) CXXLD poedit /usr/bin/ld: warning: libboost_iostreams.so.1.58.0, needed by /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/liblucene++.so, may conflict with libboost_iostreams.so.1.61.0 /usr/bin/ld: warning: libboost_regex.so.1.58.0, needed by /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/liblucene++.so, may conflict with libboost_regex.so.1.61.0 /usr/bin/ld: warning: libboost_system.so.1.58.0, needed by /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/liblucene++.so, may conflict with libboost_system.so.1.61.0 /usr/bin/ld: warning: libboost_thread.so.1.58.0, needed by /usr/lib/gcc/x86_64-linux-gnu/5/../../../x86_64-linux-gnu/liblucene++.so, may conflict with libboost_thread.so.1.61.0 (以下省略) ``` 看起來Boost共享程式庫版本的混用好像會造成問題的樣子……解決方案似乎有: 1. 將Ubuntu 16.04提供之針對第1.58版Boost程式庫建構的Lucene\+\+跟The C\+\+ REST SDK程式庫自其來源碼改針對Poedit提供的第1.61版Boost程式庫建構 1. 將Poedit提供的第1.61版Boost程式庫改為靜態連結的非共享程式庫,避免發生共享程式庫版本衝突的問題 看起來第二個方法比較簡單一些。 ## 安裝建構Poedit所需的軟體(第三部份)<br>Install Software Required by Poedit Building(Part 3) ### 建構並安裝部份Ubuntu 16.04無法提供或提供的版本太舊的依賴軟體(第四部份)<br>Build and Install a Part of Dependencies that are not Shipped by Ubuntu 16.04 or are Too Old(Part 4) #### Boost程式庫(第二部份)<br>Boost Libraries(Part 2) ``` $ pushd \ ../deps/boost ``` 這次我們指定建構靜態連結程式庫: ``` $ sudo rm \ --recursive \ /opt/boost-poedit $ ./b2 \ --help (以下省略) Usage: b2 [options] [properties] [install|stage] Builds and installs Boost. (以下省略) Properties: link=static|shared Whether to build static or shared libraries (以下省略) $ sudo ./b2 \ link=static \ install (以下省略) $ ls \ /opt/boost-poedit libboost_atomic.a libboost_mpi_python.a libboost_chrono.a libboost_mpi_python.so libboost_container.a libboost_mpi_python.so.1.61.0 libboost_context.a libboost_prg_exec_monitor.a libboost_coroutine.a libboost_program_options.a libboost_date_time.a libboost_python.a libboost_exception.a libboost_python.so libboost_filesystem.a libboost_python.so.1.61.0 libboost_graph.a libboost_random.a libboost_graph_parallel.a libboost_regex.a libboost_iostreams.a libboost_serialization.a libboost_locale.a libboost_serialization.so libboost_log.a libboost_serialization.so.1.61.0 libboost_log_setup.a libboost_signals.a libboost_math_c99.a libboost_system.a libboost_math_c99f.a libboost_test_exec_monitor.a libboost_math_c99l.a libboost_thread.a libboost_math_tr1.a libboost_timer.a libboost_math_tr1f.a libboost_type_erasure.a libboost_math_tr1l.a libboost_unit_test_framework.a libboost_mpi.a libboost_wave.a libboost_mpi.so libboost_wserialization.a libboost_mpi.so.1.61.0 mpi.so $ popd ~/poedit/build ``` ## 建構Poedit(第三部份)<br>Build Poedit(Part 3) ``` $ ../configure \ --prefix=/opt/poedit-2.1.1-oss \ --with-boost=/opt/boost-poedit \ --with-wx-prefix=/opt/wx-poedit \ PKG_CONFIG_PATH=/opt/pugixml-poedit/lib/pkgconfig (以下省略) Configured poedit-2.1.1 for x86_64-pc-linux-gnu Enabled features: * debug build: no * language detection: yes * crowdin integration: yes $ env LD_LIBRARY_PATH=/opt/wx-poedit/lib \ make \ --jobs=$(nproc) (以下省略) CXXLD poedit /usr/bin/ld: /opt/wx-poedit/lib/libwx_baseu-3.1.so: undefined reference to symbol 'inflateInit2_' //lib/x86_64-linux-gnu/libz.so.1: error adding symbols: DSO missing from command line collect2: error: ld returned 1 exit status Makefile:613: recipe for target 'poedit' failed make[1]: *** [poedit] Error 1 make[1]: Leaving directory '/home/ubuntu/poedit/build/src' Makefile:486: recipe for target 'all-recursive' failed make: *** [all-recursive] Error 1 (!?) ``` 拿去餵狗後發現是新版本GNU連結器(`ld`(1))對依賴的共享程式庫處理的行為變得更嚴格需要把依賴的程式庫全部列舉列好列滿的緣故,那就指定`LDFLAGS`環境變數把連結器的行為變成過去的吧。 參閱[GCC工具鏈的說明文件](https://gcc.gnu.org/onlinedocs) - [呼叫GCC](https://gcc.gnu.org/onlinedocs/gcc-5.5.0/gcc/Invoking-GCC.html#Invoking-GCC) - [連結命令列選項](https://gcc.gnu.org/onlinedocs/gcc-5.5.0/gcc/Link-Options.html#Link-Options)章節,我們可以用`-Wl`命令列選項來傳遞連結器命令列選項給GNU連結器(注意:GNU連結器不屬於GCC的一部分,而是[GNU Binutils](https://www.gnu.org/software/binutils/)軟體的一部分)。參閱[GNU Binutils的說明文件](https://sourceware.org/binutils/docs) - [ld](https://sourceware.org/binutils/docs/ld) - [呼叫(Invocation)](https://sourceware.org/binutils/docs/ld/Invocation.html) - [命令列選項](https://sourceware.org/binutils/docs/ld/Options.html)章節中的`--copy-dt-needed-entries`命令列選項: > `--copy-dt-needed-entries` > `--no-copy-dt-needed-entries` > > This option affects the treatment of dynamic libraries referred to by DT_NEEDED tags _inside_ ELF dynamic libraries mentioned on the command line. Normally the linker won’t add a DT\_NEEDED tag to the output binary for each library mentioned in a DT\_NEEDED tag in an input dynamic library. With --copy-dt-needed-entries specified on the command line however any dynamic libraries that follow it will have their DT_NEEDED entries added. The default behaviour can be restored with --no-copy-dt-needed-entries. > > This option also has an effect on the resolution of symbols in dynamic libraries. With --copy-dt-needed-entries dynamic libraries mentioned on the command line will be recursively searched, following their DT\_NEEDED tags to other libraries, in order to resolve symbols required by the output binary. With the default setting however the searching of dynamic libraries that follow it will stop with the dynamic library itself. No DT\_NEEDED links will be traversed to resolve symbols. ……我也不知道它在說什麼,反正就加進`LDFLAGS`環境變數吧: ``` $ ../configure \ --prefix=/opt/poedit-2.1.1-oss \ --with-boost=/opt/boost-poedit \ --with-wx-prefix=/opt/wx-poedit \ PKG_CONFIG_PATH=/opt/pugixml-poedit/lib/pkgconfig \ LDFLAGS=-Wl,--copy-dt-needed-entries (以下省略) Configured poedit-2.1.1 for x86_64-pc-linux-gnu Enabled features: * debug build: no * language detection: yes * crowdin integration: yes $ env LD_LIBRARY_PATH=/opt/wx-poedit/lib \ make \ --jobs=$(nproc) (以下省略) ``` 終於好了(呼)。 ## 安裝Poedit<br>Installing Poedit ``` $ sudo make install (以下省略) ``` 如果您跟我一樣是在LXD容器中建構的話,回到主系統的shell底下用LXD的命令來把安裝上去的Poedit拉回來再安裝到 `/opt` 底下: ``` $ lxc file pull \ --recursive \ --verbose \ ubuntu-16-04/opt/poedit-2.1.1-oss \ /tmp (以下省略) $ sudo cp \ --recursive \ --verbose \ /tmp/poedit-2.1.1-oss \ /opt (以下省略) $ sudo rm \ --recursive \ /tmp/poedit-2.1.1-oss ``` 這樣就結束了嗎?還沒有!由於這是個軟體、軟體資源以及依賴的程式庫都*不在*標準目錄下的軟體安裝系統還不知道這些東西的存在,比方說軟體選單中你會看不到Poedit、Poedit執行時找不到安裝在 `/opt/wx-poedit/lib` 目錄下的 wxWidgets 程式庫、Poedit 執行後找不到它的工具列圖示等資源等等。以下就來一一解決這些軟體*執行時期(runtime)*的問題。 ### 安裝Poedit的執行時期依賴軟體<br>Install Poedit's Runtime Dependencies 由於我們的Poedit安裝並非由APT軟體包管理系統所管理,APT不會確保我們安裝的Poedit所依賴的程式庫會一直安裝在系統中(因為不存在此軟體依賴關係),為了避免這個問題我們要建立一個 `poedit-runtime-dependencies` 詮釋用軟體包(metapackage)來建立該軟體依賴關係避免APT在未來某一天*不小心*將Poedit需要的程式庫給拔了。 我們可以使用 equivs 這個軟體來做到這件事: ``` $ sudo apt install \ equivs ``` 使用 `equivs-control` 命令來產生一個 Debian 軟體包 control 檔案範本: ``` $ equivs-control control ``` 編輯建立好的`control`檔案,將Poedit依賴的軟體包列入 `Depends` 欄位中: ```control Source: poedit Section: misc Priority: optional Package: poedit-runtime-dependencies Depends: gettext, libc6, libcld2-0, libcpprest2.8, libexpat1, libglib2.0-0, libgtk-3-0, libgtkspell0, libicu55, liblucene++0v5, libsecret-1-0, libssl1.0.0, libstdc++6 Architecture: all Description: Runtime dependencies of Poedit ``` :::info **提示:** 可以參考 `apt show poedit` 跟 `ldd /opt/poedit-2.1.1-oss/bin/poedit` 的輸出內容,但要排除掉我們手動建構而非由APT提供的部份程式庫 ::: 接下來使用`equivs-build`命令來產生poedit-runtime-dependencies詮釋用軟體包並將其安裝到系統中: ``` $ equivs-build control (以下省略) dpkg-deb:把 `poedit-runtime-dependencies' 軟體包製作為 `../poedit-runtime-dependencies_2.1.1-oss_all.deb'。 The package has been created. Attention, the package has been created in the current directory, not in ".." as indicated by the message above! $ sudo dpkg \ --install \ (以下省略) $ sudo apt install \ --fix-missing (以下省略) ``` ### 桌面環境選單中看不到Poedit<br>Poedit isn't Enumerated in the Desktop Environment's Menu 這是因為桌面環境選單是由 `XDG_DATA_DIRS` 環境變數指定的目錄們底下的 `applications` 子目錄中的桌面項目(desktop entry)檔案所組成,我們需要修改 `~/.profile` 個人設定檔將 `/opt/poedit-2.1.1-oss/share` 目錄插入於`XDG_DATA_DIRS` 環境變數中。 :::info **資訊:**`~/.profile`個人設定檔要以*POSIX相容殼層*的腳本語言撰寫(也就是說不可以有 [Bashism](https://mywiki.wooledge.org/Bashism)),參閱[The Open Group Base Specifications中的Shell & Utilities中的Shell Command Language章節](http://pubs.opengroup.org/onlinepubs/9699919799)。 ::: ```shell=posix $ cat ~/.profile (以下省略) poedit_prefix=/opt/poedit-2.1.1-oss if test -n "${XDG_DATA_DIRS}"; then XDG_DATA_DIRS="${poedit_prefix}"/share:"${XDG_DATA_DIRS}" else XDG_DATA_DIRS="${poedit_prefix}"/share export XDG_DATA_DIRS fi ``` :::warning **注意:**`~/.profile`個人設定檔在每次登入時被讀取,變更該檔案後需要重新啟動X作業階段(X session)後才會生效(也就是要登出再登入) ::: 此外由於桌面項目檔案中的 `Exec` 鍵使用的是命令而非可執行檔的絕對路徑: ``` $ cat /opt/poedit-2.1.1-oss/share/applications/poedit.desktop (以下省略) Exec=poedit %F (以下省略) ``` 我們要確保Poedit的可執行檔路徑在系統的命令搜尋路徑序列的 `PATH` 環境變數中,一樣是設定在`~/.profile`個人設定檔: ```shell=posix (以下省略) PATH="${poedit_prefix}"/bin:"${PATH}" ``` 登出再登入之後桌面環境選單中應會出現Poedit選單項目,而且圖標也正常顯示: ![範例畫面截圖](https://i.imgur.com/XbeCU45.png) ### Poedit因為缺少wxWidgets程式庫無法啟動<br>Poedit Failed to Launch due to Missing wxWidgets Libraries ``` $ poedit poedit: error while loading shared libraries: libwx_gtk3u_xrc-3.1.so.2: cannot open shared object file: No such file or directory ``` 這是因為手動安裝的wxWidgets程式庫的程式庫目錄 `/opt/wx-poedit/lib` 並不在系統的程式庫搜尋路徑中,參閱動態連結器(dynamic linker) [ld.so(8)的manpage使用手冊頁面(manpage)](http://manpages.ubuntu.com/manpages/xenial/en/man8/ld.so.8.html))我們知道可以設定 `LD_LIBRARY_PATH` 環境變數來在執行時期將該目錄加進動態連結器的程式庫搜尋路徑中: ``` $ man 8 ld.so (以下省略) Environment variables Among the more important environment variables are the following: (以下省略) LD_LIBRARY_PATH A list of directories in which to search for ELF libraries at execution-time. The items in the list are separated by either colons or semicolons. Similar to the PATH environment vari‐ able. This variable is ignored in secure-execution mode. (以下省略) ``` 一樣設定`~/.profile`個人設定檔(再登出再登入): ```shell=posix poedit_wx_prefix=/opt/wx-poedit if test -n "${LD_LIBRARY_PATH}"; then LD_LIBRARY_PATH="${poedit_wx_prefix}"/lib:"${LD_LIBRARY_PATH}" else LD_LIBRARY_PATH="${poedit_wx_prefix}"/lib export LD_LIBRARY_PATH fi ``` ### Poedit的Crowdin整合失效<br>Making Poedit's Crowdin Integration Work Poedit支援直接編輯Crowdin翻譯平台上的軟體翻譯,這需要開啟Web瀏覽器在Crowdin網站上進行授權,但是現在按下網頁上的「授權應用(AUTHORIZE APP)」按鈕後Poedit仍然維持「正在等候身份核對…」的狀態: ![問題畫面截圖](https://i.imgur.com/TgRZw0E.png) 這是因為系統沒有註冊Poedit使用的`poedit://`通訊協定的緣故,該註冊定義位於`/opt/poedit-2.1.1-oss/share/applications/poedit-uri.desktop`桌面項目檔案中,不同於選單項目,Multipurpose Internet Mail Extensions (MIME) type(MIME)類型必須要經建立好的快取資料才會生效。我們可以使用 `update-desktop-database` 命令來建立MIME類型快取: ``` $ sudo update-desktop-database \ --verbose \ /opt/poedit-2.1.1-oss/share/applications Search path is now: [/opt/poedit-2.1.1-oss/share/applications] ``` ![正常啟動畫面](https://i.imgur.com/HYnz8ko.png) 終於結束了(呼) ## 參考資料<br>References * [poedit/README at ada834100cd1b940275affae6417bccbab7f32c4 · vslavik/poedit](https://github.com/vslavik/poedit/blob/ada8341/README) * [c++ - Difference between static and shared libraries? - Stack Overflow](https://stackoverflow.com/questions/2649334/difference-between-static-and-shared-libraries#2649430) * [c - Can I mix static and shared-object libraries when linking? - Stack Overflow](https://stackoverflow.com/questions/2954387/can-i-mix-static-and-shared-object-libraries-when-linking#2954413) * [Dan Mergens - Static and Dynamic Linking with GCC](http://gcc.gnu.org/ml/gcc/2001-07/msg01444.html) * [Boost FAQ](https://www.boost.org/users/faq.html) * [Using the GNU Compiler Collection (GCC): Environment Variables](https://gcc.gnu.org/onlinedocs/gcc/Environment-Variables.html) * [GNU make](https://www.gnu.org/software/make/manual/make.html#Implicit-Variables) * [build - GCC and linking environment variables and flags - Stack Overflow](https://stackoverflow.com/questions/16044020/gcc-and-linking-environment-variables-and-flags)

    Import from clipboard

    Paste your markdown or webpage here...

    Advanced permission required

    Your current role can only read. Ask the system administrator to acquire write and comment permission.

    This team is disabled

    Sorry, this team is disabled. You can't edit this note.

    This note is locked

    Sorry, only owner can edit this note.

    Reach the limit

    Sorry, you've reached the max length this note can be.
    Please reduce the content or divide it to more notes, thank you!

    Import from Gist

    Import from Snippet

    or

    Export to Snippet

    Are you sure?

    Do you really want to delete this note?
    All users will lose their connection.

    Create a note from template

    Create a note from template

    Oops...
    This template has been removed or transferred.
    Upgrade
    All
    • All
    • Team
    No template.

    Create a template

    Upgrade

    Delete template

    Do you really want to delete this template?
    Turn this template into a regular note and keep its content, versions, and comments.

    This page need refresh

    You have an incompatible client version.
    Refresh to update.
    New version available!
    See releases notes here
    Refresh to enjoy new features.
    Your user state has changed.
    Refresh to load new user state.

    Sign in

    Forgot password

    or

    By clicking below, you agree to our terms of service.

    Sign in via Facebook Sign in via Twitter Sign in via GitHub Sign in via Dropbox Sign in with Wallet
    Wallet ( )
    Connect another wallet

    New to HackMD? Sign up

    Help

    • English
    • 中文
    • Français
    • Deutsch
    • 日本語
    • Español
    • Català
    • Ελληνικά
    • Português
    • italiano
    • Türkçe
    • Русский
    • Nederlands
    • hrvatski jezik
    • język polski
    • Українська
    • हिन्दी
    • svenska
    • Esperanto
    • dansk

    Documents

    Help & Tutorial

    How to use Book mode

    Slide Example

    API Docs

    Edit in VSCode

    Install browser extension

    Contacts

    Feedback

    Discord

    Send us email

    Resources

    Releases

    Pricing

    Blog

    Policy

    Terms

    Privacy

    Cheatsheet

    Syntax Example Reference
    # Header Header 基本排版
    - Unordered List
    • Unordered List
    1. Ordered List
    1. Ordered List
    - [ ] Todo List
    • Todo List
    > Blockquote
    Blockquote
    **Bold font** Bold font
    *Italics font* Italics font
    ~~Strikethrough~~ Strikethrough
    19^th^ 19th
    H~2~O H2O
    ++Inserted text++ Inserted text
    ==Marked text== Marked text
    [link text](https:// "title") Link
    ![image alt](https:// "title") Image
    `Code` Code 在筆記中貼入程式碼
    ```javascript
    var i = 0;
    ```
    var i = 0;
    :smile: :smile: Emoji list
    {%youtube youtube_id %} Externals
    $L^aT_eX$ LaTeX
    :::info
    This is a alert area.
    :::

    This is a alert area.

    Versions and GitHub Sync
    Get Full History Access

    • Edit version name
    • Delete

    revision author avatar     named on  

    More Less

    Note content is identical to the latest version.
    Compare
      Choose a version
      No search result
      Version not found
    Sign in to link this note to GitHub
    Learn more
    This note is not linked with GitHub
     

    Feedback

    Submission failed, please try again

    Thanks for your support.

    On a scale of 0-10, how likely is it that you would recommend HackMD to your friends, family or business associates?

    Please give us some advice and help us improve HackMD.

     

    Thanks for your feedback

    Remove version name

    Do you want to remove this version name and description?

    Transfer ownership

    Transfer to
      Warning: is a public team. If you transfer note to this team, everyone on the web can find and read this note.

        Link with GitHub

        Please authorize HackMD on GitHub
        • Please sign in to GitHub and install the HackMD app on your GitHub repo.
        • HackMD links with GitHub through a GitHub App. You can choose which repo to install our App.
        Learn more  Sign in to GitHub

        Push the note to GitHub Push to GitHub Pull a file from GitHub

          Authorize again
         

        Choose which file to push to

        Select repo
        Refresh Authorize more repos
        Select branch
        Select file
        Select branch
        Choose version(s) to push
        • Save a new version and push
        • Choose from existing versions
        Include title and tags
        Available push count

        Pull from GitHub

         
        File from GitHub
        File from HackMD

        GitHub Link Settings

        File linked

        Linked by
        File path
        Last synced branch
        Available push count

        Danger Zone

        Unlink
        You will no longer receive notification when GitHub file changes after unlink.

        Syncing

        Push failed

        Push successfully