ファン
検索
<< 2024年06月 >>
1
2 3 4 5 6 7 8
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30
最新記事
最新コメント
眼科の定期検査 〜 散歩 by コトタマ (02/15)
眼科の定期検査 by 三文字寄れば文殊のヒフミヨ (09/21)
本を読んで過ごす by 底彦 (12/13)
本を読んで過ごす by ねこ (12/12)
数学の計算をする by 底彦 (12/04)
タグクラウド
カテゴリアーカイブ
仕事 (59)
社会復帰 (22)
(40)
コンピューター (203)
(1373)
借金 (8)
勉強 (7)
(12)
数学 (97)
運動 (8)
日常生活 (1334)
(199)
健康 (33)
読書 (20)
プロフィール

ブログランキング・にほんブログ村へ
にほんブログ村
にほんブログ村 メンタルヘルスブログ うつ病(鬱病)へ
にほんブログ村
にほんブログ村 科学ブログ 数学へ
にほんブログ村
にほんブログ村 IT技術ブログ プログラム・プログラマーへ
にほんブログ村

2024年06月13日

Emacs: やてふモードで TeX ファイルが色付きにならない問題

6 月に入って最新の Emacs HEAD をコンパイル・インストールしたが, TeX ファイルをやてふ (YaTeX) モードで開いたときにファイル表示に色が付かないことに気が付いた.
\$HOME/.emacs.d/init.el ファイルを確認すると,

(require 'font-lock)
(global-font-lock-mode t)
. . . .

(setq YaTeX-use-font-lock t)

と設定してある.

また, YaTeX-use-font-lock 変数は t になっている.
つまりグローバルでもローカルでも, やてふモードでは font-lock mode は有効になっている筈である.

ところが, Emacs 上からは

M-x global-font-lock-mode
Global Font-Lock mode disabled

となっていて, グローバルの font-lock mode はなぜか有効になっていない.

ただ, やてふモードでの色付けがない Emacs 上で

Eval: (global-font-lock-mode t)

を実行すると TeX ファイルのバッファーに色付けがされる.

どうして今回の Emacs30 のやてふモードでこのようになってしまうのか.
\$ emacs_dir /etc/NEWS などを読んでみたが原因はわからず.

結局 init.el 内のやてふの設定を

;;; YaTeX
(setq auto-mode-alist
(cons (cons "\\.\\(tex$\\|sty$\\|ltx$\\|cls$\\|clo$\\|bbl$\\)"
'yatex-mode)
auto-mode-alist))
(autoload 'yatex-mode "yatex" "Yet Another LaTeX mode" t)
(add-hook 'yatex-mode-hook ; 新たに追加
'(lambda () (font-lock-mode))) ; 同上

として, Emacs 起動後から TeX ファイルに色が付くようにした.

すっきりしないが, ひとまずこの対応で凌ぐ.

2024年06月05日

システム管理: Emacs HEAD のコンパイル・インストール ── 2024 年 6 月 (2)

Github.com へのコミットを Magit (Emacs から git を呼び出すパッケージ) 経由で行おうとしたら, 次のようなエラーが出た.
● git のログ表示コマンド (git-log) 実行時:

Suffice magit-log:--*-order is not defined or autoloaded as a command

● ローカルブランチの切り換え時 (git-branch) 実行時:

Suffix magit-branch. .rebase is not defined as a command

これらの原因については思い当たることがある.

今回の Emacs HEAD のインストール時に Magit パッケージの設定を変更した.

以前: Magit パッケージをソースコードからバイトコンパイルした結果を \$HOME/.emacs.d/site-lisp 以下に置いていた.
それに対応して, init.el 内で load-path 変数の設定に

(add-to-list 'load-path "~/.emacs.d/site-lisp/magit/lisp")
(add-to-list 'load-path "~/.emacs.d/site-lisp/transient/lisp")

のような変更を加えた.

今回: \$HOME/.emacs.d/site-lisp ディレクトリー配下内に置いてある Emacs Lisp パッケージを見直して, ほぼ全てが GNU ELPA からインストールしたパッケージで置き換えられることがわかった.
それで site-lisp ディレクトリー以下からの (1) パッケージファイルの削除; (2) そのパッケージの GNU ELPA からのインストールの 2 つを行った.

問題は, この変更に合わせて init.el 内の上記の記述を

;; (add-to-list 'load-path "~/.emacs.d/site-lisp/magit/lisp")
;; (add-to-list 'load-path "~/.emacs.d/site-lisp/transient/lisp")

のようにコメントアウトすべきだったがそれを行わなかったことである. 忘れてしまった.

この結果, 古い load-path のの設定だけが中途半端に残る.
いくつかの Magit コマンドは, init.el の古い設定にしたがって削除済みの Emacs Lisp ファイル, たとえば \$HOME/.emacs.d/magit/lisp 以下や \$HOME/d.emacs.d/transient/lisp 以下に置かれていた Emacs Lisp ファイルを読みに行ってしまう. それがエラーになっていたのではないだろうか.

あらためて init.el 内の不要になった処理のコメントアウトを行うことにより, Magit が問題無く動くようになった.

システム管理: Emacs HEAD のコンパイル・インストール ── 2024 年 6 月 (1)

6 月 3 日に行った作業の覚え書き.

Emacs HEAD をコンパイルする段階においていくつか問題が発生した.

まとめると

(1) configure スクリプト実行時に libgccjit のテストでエラーになる;
(2) elisp.info 生成時にエラーとなる;
(3) libgccjit 共有ライブラリーが呼び出されたときにエラーとなる;
(4) Emacs の起動時にエラーが出る.



それぞれの問題に対して行ったことをまとめておく.

(1) configure スクリプト実行時に libgccjit のテストでエラーになる;
エラーメッセージは以下の通り:

checking for gcc_jit_context_acquire in -lgccjit... yes
checking for libgccjit.h... yes
configure: error: The installed libgccjit failed to compile and run a test program using
the libgccjit library; see config.log for the details of the failure.
The test program can be found here:
< https://gcc.gnu.org/onlinedocs/jit/intro/tutorial01.html>.
You can try compiling it yourself to investigate the issues.
Please report the issue to your distribution if libgccjit was installed
through that.
You can find the instructions on how to compile and install libgccjit from
source on this site:
< https://gcc.gnu.org/wiki/JIT>.

libgccjit の使用可否テストプログラムのコンパイルと実行に失敗するという内容である.
新しい OpenBSD 7.5 では, これまでの libgccjit が動かない.
libgccjit をコンパイル・インストールし直すことによって解決した.

(2) elisp.info 生成時にエラーとなる.

GEN ../../info/elisp.info
parsetexi/Parsetexi.c: loadable library and perl binaries are mismatched
(got first handshake key 0xec00000, needed 0xeb80000)

現在インストールしてある makeinfo プログラムが, もはや OpenBSD 7.5 では動かないことによる.
makeinfo をソースから作り直す ことにより解決した.

(3) libgccjit 共有ライブラリーが呼び出されたときにエラーとなる.

'../src/bootstrap-emacs' -batch --no-site-file --no-site-lisp \
--eval "(setq load-prefer-newer t byte-compile-warnings 'all)" \
--eval "(setq org--inhibit-version-check t)" \
-l comp -f batch-byte+native-compile emacs-lisp/loaddefs-gen.el
bootstrap-emacs:/usr/local/lib/libgccjit.so.0.0.1: undefined symbol '_Z15fname_as_string'
ld.so: bootstrap-emacs: lazy binding failed!

このエラーメッセージが述べているように, libgccjit 内に _Z15fname_as_string により参照される関数が存在しない.
libgccjit 共有ライブラリーのソースに対するパッチ:

--- libgccjit.c.orig Sun Jun 2 14:00:39 2024
+++ libgccjit.c Sun Jun 2 14:04:37 2024
@@ -3474,3 +3474,9 @@ gcc_jit_context_add_top_level_asm (gcc_jit_context *ct
RETURN_IF_FAIL (asm_stmts, ctxt, NULL, "NULL asm_stmts");
ctxt->add_top_level_asm (loc, asm_stmts);
}
+
+const char *
+fname_as_string(int pretty_P __attribute__((__unused__)))
+{
+ return NULL;
+}

を適用し忘れていたことによるエラーである.
パッチを適用して libgccjit 共有ライブラリーを作り直す ことによって解決した.

(4) Emacs の起動時にエラーが出る.

File is missing: Cannot open load file, No such file or directory, compat-26

原因がなかなかわからなかったが, init.el 内にあった記述:

(require 'compat)

をコメントアウトすることによって解決した.
調べると, emacs_dir /etc/NEWS 内に

** New package Compat.
Emacs now comes with a stub implementation of the
forwards-compatibility Compat package from GNU ELPA. This allows
built-in packages to use the library more effectively, and helps
preventing the installation of Compat if unnecessary.

という記述があった.
GNU ELPA にある compat パッケージに相当する機能が Emacs 本体に組み込まれた, これにより compat パッケージを, それが不要な場合にもわざわざ GNU ELPA からインストールしなくてもよくなった, とのこと.
この原因により, 上記の (require 'compat) が必要なくなったのだと考えられる.

$ git pull
$ gmake
$ gmake check -k
# gmake install

M-x emacs version
This is GNU Emacs 30.0.50 (build 2, x86_64-unknown-openbsd7.5,
X toolkit, cairo version 1.18.0, Xaw3d scroll bars) of 2024-06-03
タグ: emacs30 Emacs HEAD

2024年06月02日

システム管理: OpenBSD のアップグレード作業 ── 2024 年 6 月 (2)

昨日からの続き.

ベースシステムのコンパイルが終了したので, マージとデバイスファイルの作成を行う.

# sysmerge
# cd /dev && ./MAKEDEV all

次に X 関連のファイルのコンパイル・インストールを行う.

# cd /usr/xenocara
# make bootstrap
# make obj
# make build

これで, OpenBSD のアップグレードが終了する.

$ uname -a
$ OpenBSD mybsd 7.5 GENERIC.MP#27 amd64

OpenBSD のバージョンが 7.5 になった.

2024年06月01日

システム管理: OpenBSD のアップグレード作業 ── 2024 年 6 月 (1)

月初め (と言っても 2 月以来だが...) の OpenBSD のアップグレード作業を行う.

ソースツリーをアップデートする.

$ cd /usr/src # ベースシステムのソースコードのアップデート.
$ cvs -q up -Pd -A
$ cd /usr/xenocara # X のソースコードのアップデート.
$ cvs -q up -Pd -A
$ cd /usr/ports # ports ツリーのアップデート.
$ cvs -q up -Pd -A
# sysupgrade -s # システムを最新のスナップショットにアップグレードする.

カーネルのコンパイル・インストール.

# cd /sys/arch/amd64/compile/GENERIC.MP
# make obj
# make config
# make && make install

パッケージのアップグレード.

# pkg_add -uv

これまでは, この操作はカーネルおよびベースシステムのコンパイル・インストールの後に行っていた.
しかし今回, ベースシステムのコンパイルが Perl の実行および libc.a のリンクのエラーの発生によりエラー終了してしまう.
先にパッケージの方をアップデートしておく方がいいと考えた.

次いでベースシステムの再構築.

# cd /usr/src
# make obj && make build

この処理には時間がかかるので, 続きは明日行う.

2024年05月31日

システム管理: Gauche をインストールする

Gauche (Scheme Scripting Engine) をインストールしたい.
以前 Gauche 0.9.12pre-p1 をインストールしたきりで, その後のアップデートを行っていない.

スクリプト言語として, あらためて Gauche を使っていきたいので一からインストールする.
まず最新版の Gauche 0.9.15 をインストールし, それを用いて開発版 Gauche をコンパイル・インストールする.

Gauche のインストールスクリプト get-gauche.sh を取得する.

$ curl https://raw.githubusercontent.com/shirok/get-gauche/master/get-gauche.sh \
-o get-gauche.sh

get-gauche.sh の中で GNU tar を使用しているので, 次のように変更する.

--- get-gauche.sh.orig Fri May 31 11:11:06 2024
+++ get-gauche.sh Fri May 31 11:11:18 2024
@@ -368,7 +368,7 @@ function do_fetch_and_cd {
echo "Failed URL:" $API/$desired_version.tgz
exit 1
fi
- tar xf Gauche-$desired_version.tgz
+ gtar xf Gauche-$desired_version.tgz
rm Gauche-$desired_version.tgz
# The actual directory name may differ when $version is latest or snapshot
cd Gauche-*

現在インストールしてある旧バージョンの Gauche (手元の環境の場合は 0.9.12pre-p1) をアンインストールする.

$ bash ./get-gauche.sh --uninstall --sudo

スクリプトの実行がうまく行った場合 /usr/local 以下に変更を加えるので, 念のため '--sudo' オプションを指定している.

Gauche を ダウンロード・インストール する.

$ bash ./get-gauche.sh --keep-builddir

ここでは, スクリプトによるインストールが途中で失敗した時に後から対応しやすいように '--keep-builddir' オプションを指定している.

実行するとスクリプトから gmake check が実行される際にエラー:

Signals delivery fails constantly at GC #4
Signals delivery fails constantly
Abort trap (core dumped)
・ ・ ・ ・
Total: 39480 tests, 39473 passed, 7 failed, 2 aborted.

が発生する.
インストールプログラムはエラーで終了した (core が生成される).

残しておいた作業ディレクトリーに移動し, コマンドラインで

$ cd builddir /Gauche-0.9.15/
$ ./configure --prefix=/usr/local --mandir=/usr/local/share/man --infodir=/usr/local/info
$ gmake
$ gmake check
$ doas gmake install

を実行し, Gauche をインストールする.

以上の準備の元で, 開発版 Gauche をインストールする.

$ git clone https://github.com/shirok/Gauche.git
$ cd ./Gauche
$ ./DIST gen
$ AUTOCONF_VERSION="2.71" AUTOMAKE_VERSION="1.16" \
./configure --prefix=/usr/local --mandir=/usr/local/share/man \
--infodir=/usr/local/info

ここで, configure スクリプト実行時に,

checking thread type...
configure: WARNING: Gauche with pthread on OpenBSD has unresolved issues.
We recommend you to build without threads (--disable-threads)
unless you're trying to fix the issues.
See https://github.com/shirok/Gauche/issues/276 and
https://github.com/shirok/Gauche/issues/334 .

という警告が出るが, 現在の Gauche では configure スクリプトの '--disable-threads' オプションは無くなっているようなので, そのまま gmake を実行する. スレッドは pthread ライブラリが使用されるが, これは後で gmake check によるテスト時にエラーとなる.

$ gmake
$ gmake check -k
・ ・ ・ ・
Total: 39549 tests, 39546 passed, 3 failed, 2 aborted.
$ doas gmake install

これで Gauche のコンパイル・インストールが完了する.

$ gosh -V
Gauche scheme shell, version 0.9.15-p1 [utf-8,pthreads], x86_64-unknown-openbsd7.4
(version "0.9.15-p1")
(command "gosh")
(scheme.id gauche)
(languages scheme r5rs r7rs)
(encodings utf-8)
(website " https://practical-scheme.net/gauche ")
(build.platform "x86_64-unknown-openbsd7.4")
(build.configure "--prefix=/usr/local" "--mandir=/usr/local/share/man" "--infodir=/usr/local/info")
(scheme.path "/usr/local/share/gauche-0.98/site/lib" "/usr/local/share/gauche-0.98/0.9.15-p1/lib")
(threads pthreads)
(gauche.net.tls)

2024年02月03日

Emacs: Emacs HEAD のコンパイルとインストール ── 2024 年 2 月 (2)

昨日で Emacs HEAD のコンパイルが終わったので, チェックとインストールを行う.

$ gmake check
# gmake install

これで今月の Emacs の更新が行えた.

M-x emacs-vertion
GNU Emacs 30.0.50 (build 1, x86_64-unknown-openbsd7.4,
X toolkit, cairo version 1.18.0, Xaw3d scroll bars) of 2024-02-02
タグ: emacs30 Emacs HEAD

2024年02月02日

システム管理: OpenBSD のアップグレード作業 ── 2024 年 2 月 (2)

午後になって昨日から走らせているベースシステムのコンパイル状況を確認したらエラー無しでコンパイルが完了していた.
終わるまで 17 時間かかっている.

システムをマージして, デバイスフィイルを作成する.

# sysmerge
# cd /dev
# ./MAKEDEV all


次いで X 関連のファイルのコンパイルとインストールを行う.

# cd /usr/xenocara
# make bootstrap
# make build

これもうまく行った.

最後にパッケージのアップデートを行う.

# pkg_add -uv

以上で, 今月分の OpenBSD のアップグレード作業が終了した.

$ uname -a
OpenBSD mybsd 7.4 GENERIC.MP#26 amd64

Emacs: Emacs HEAD のコンパイルとインストール ── 2024 年 2 月 (1)

OpenBSD のアップグレード作業が終わったので, Emacs HEAD のコンパイル・インストールを行う.

いつもの通り, 環境変数を設定する.

$ AUTOCONF_VERSION="2.71"
$ AUGOMAKE_VERSION="1.16"
$ LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib/gcc/x86_64-unknown-openbsd7.4/11.2.0

それからコンパイルの準備とコンパイルの実行を行う.

$ ./autogen.sh
$ ./config.sh
$ git pull
$ gmake bootstrap

このプロセスにも時間がかかる.
結果を確認するのは明日にして区切りを付ける.
タグ: Emacs HEAD emacs30

2024年02月01日

システム管理: OpenBSD のアップグレード作業 ── 2024 年 2 月 (1)

月が変わったので, OpenBSD のアップグレードをする. 体調が悪いため休み休み作業をする.

ベースシステムのソースコードのアップデートを行う.

$ cd /usr/src
$ cvs -q up -Pd -A

ところが, cvs を実行したところ,

CVS/Entries: Permission denied

というエラーが出る.
これに対して, root 権限で cvs を実行することによりエラーを回避したのだが, エラーの原因を調べればよかった.

# cd /usr/src
# cvs -q up -Pd -A

次に X 関連のソースコードのアップデートを行う.

$ cd /usr/xenocara
$ cvs -q up -Pd -A

最後にl ports のアップデートを行う..

$ cd /usr/ports
$ cvs -q up -Pd -A

システムを最新スナップショットへアップグレードする.

# sysupgrade -s

リブート後, カーネルの再構築を行う.

# cd /sys/arch/amd64/compile/GENERIC.MP
# make obj
# make config
# make && make install

ベースシステムのコンパイルを行う.

# cd /usr/src
$ make obj && make build

また先々月, 先月のようなエラーが出るかも知れない.
とりあえず, 問題の gnu/llvm/ のコンパイルまで辿り着くのも時間がかかるので区切りを付ける.
Build a Mobile Site
スマートフォン版を閲覧 | PC版を閲覧
Share by: