【未整理】msys2开发TeXmacs,编译Guile的一些问题和可能解决办法

msys2开发TeXmacs

msys2环境

换源:https://blog.csdn.net/justidle/article/details/103025966

pacman -S mingw-w64-x86_64-qt5
pacman -S mingw-w64-x86_64-toolchain
pacman -S mingw-w64-x86_64-cmake mingw-w64-x86_64-extra-cmake-modules

TeXmacs代码

$env:http_proxy = "http://127.0.0.1:8118"
$env:https_proxy = "http://127.0.0.1:8118"

git clone https://github.com/PikachuHy/texmacs.git
git remote add upstream https://github.com/texmacs/texmacs.git
git remote update upstream
git merge upstream/master

编译guile

因为TeXmacs用的是guile 1.8

pacman -S autoconf
pacman -S automake-wrapper
pacman -S libtool

注意:不能在windows下下载guile的源码,因为换行问题,configure时会检测不到gcc,其实就是多了\r编译失败

configure: error: sizes of long and void* are not identical

翻到邮件:https://lists.gnu.org/archive/html/bug-guile/2010-11/msg00038.html

报bug的地方:http://savannah.gnu.org/bugs/?31454

git clone https://git.sv.gnu.org/git/guile.git
git reset --hard 72e4a3b1df86fdfca752221716c3e3f5573ff6a5

用这个版本也不行,在mingw下就是有bug

可以看这个:https://github.com/slowphil/mingw-w64-guile1.8/blob/master/X86_64_building.md

in Mingw-w64 building fails because on this platform the lengths of long and pointers differ

使用这个版本:

https://github.com/slowphil/mingw-w64-guile1.8

运行构建命令: makepkg

遇到问题

/var/tmp/mingw-w64-guile1.8/PKGBUILD:行42: patch: 未找到命令

安装依赖

 pacman -S patch
 pacman -S make
 pacman -S gmp-devel libreadline-devel gettext-devel

在编译的时候,还有一些错误

首先是要去掉Makefile里面的Werror,然后加上-fwrapv

不然会出现

     30622 Segmentation fault      | GUILE="/var/tmp/mingw-w64-guile1.8/src/build-x86_64-w64-mingw32/pre-inst-guile" /var/tmp/mingw-w64-guile1.8/src/guile-1.8.8/scripts/snarf-check-and-output-texi > guile-procedures.texi
make[3]: *** [Makefile:2223:guile-procedures.texi] 错误 1
make[3]: 离开目录“/var/tmp/mingw-w64-guile1.8/src/build-x86_64-w64-mingw32/libguile”
make[2]: *** [Makefile:582:all] 错误 2
make[2]: 离开目录“/var/tmp/mingw-w64-guile1.8/src/build-x86_64-w64-mingw32/libguile”
make[1]: *** [Makefile:567:all-recursive] 错误 1
make[1]: 离开目录“/var/tmp/mingw-w64-guile1.8/src/build-x86_64-w64-mingw32”
make: *** [Makefile:409:all] 错误 2

这里可以参考:https://bugs.gentoo.org/427346

这里没有解决,我猜测是因为编译出来的./libguile/.libs/guile.exe无法使用

$ ./libguile/.libs/guile.exe
Segmentation fault

因为这个脚本snarf-check-and-output-texi是guile的代码

改用mingw32

pacman -S mingw-w64-i686-make mingw-w64-i686-toolchain mingw-w64-i686-gcc  mingw-w64-i686-pkg-config mingw-w64-i686-libtool mingw-w64-i686-ncurses mingw-w64-i686-libunistring mingw-w64-i686-gc mingw-w64-i686-readline mingw-w64-i686-libffi mingw-w64-i686-gdb 
pacman -S mingw-w64-i686-dlfcn 

遇到错误

C:/msys64/var/tmp/mingw-w64-guile1.8/src/guile-1.8.8/libguile/win32-dirent.c: In function 'readdir':
C:/msys64/var/tmp/mingw-w64-guile1.8/src/guile-1.8.8/libguile/win32-dirent.c:81:3: error: 'strncpy' output may be truncated copying 256 bytes from a string of length 259 [-Werror=stringop-truncation]
   81 |   strncpy (entry.d_name, find->cFileName, sizeof (entry.d_name));
      |   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
cc1.exe: all warnings being treated as errors
make[2]: *** [Makefile:893:win32-dirent.lo] 错误 1
make[2]: *** 正在等待未完成的任务....
In function 'scm_cat_path',
    inlined from 'scm_find_executable' at C:/msys64/var/tmp/mingw-w64-guile1.8/src/guile-1.8.8/libguile/script.c:144:13:
C:/msys64/var/tmp/mingw-w64-guile1.8/src/guile-1.8.8/libguile/script.c:69:3: error: 'strncat' specified bound depends on the length of the source argument [-Werror=stringop-overflow=]
   69 |   strncat (str1, str2, n);
      |   ^~~~~~~~~~~~~~~~~~~~~~~
C:/msys64/var/tmp/mingw-w64-guile1.8/src/guile-1.8.8/libguile/script.c: In function 'scm_find_executable':
C:/msys64/var/tmp/mingw-w64-guile1.8/src/guile-1.8.8/libguile/script.c:55:9: note: length computed here
   55 |     n = strlen (str2);
      |         ^~~~~~~~~~~~~

git遇到问题

fatal: 不允许空的姓名(对于 <>

这个是配了邮箱密码后没有立即生效,我等了一下,然后重新跑一次就没有这个问题了,最后重启一下好了。

fatal: 之前的变基目录 .git/rebase-apply 仍然存在,但却提供了 mbox。

运行

git am --abort

重新cmake编译

./configure: line 7627: cmp: command not found
configure: error: libltdl not found.  See README.
pacman -S mingw-w64-x86_64-diffutils
pacman -S mingw-w64-x86_64-libtool

怎么像宏一样,不同的操作系统运行不同的命令呢?

configure: error: sizes of long and void* are not identical

error: 'struct stat' has no member named 'st_blksize'; did you mean 'st_size'?

参考:https://stackoverflow.com/questions/27796000/st-blksize-is-not-a-member-of-stat-on-windows

config.status: executing depfiles commands
config.status: error: in `/home/pikachu/guile':
config.status: error: Something went wrong bootstrapping makefile fragments
    for automatic dependency tracking.  If GNU make was not used, consider
    re-running the configure script with MAKE="gmake" (or whatever is
    necessary).  You can also try re-running configure with the
    '--disable-dependency-tracking' option to at least be able to build
    the package (albeit without support for automatic dependency tracking).
See `config.log' for more details

Mingw64

 ./configure --disable-dependency-tracking --disable-error-on-warning

wsl

 ./configure --disable-error-on-warning
case $host in
  *-*-mingw*)
    ;;
esac
/usr/share/texinfo/Texinfo/ParserNonXS.pm
C:/msys64/mingw64/bin/../lib/gcc/x86_64-w64-mingw32/10.2.0/../../../../x86_64-w64-mingw32/bin/ld.exe: cannot find -lcrypt
 /bin/sh ../libtool  --tag=CC   --mode=link gcc  -g -O2 -Wall -Wmissing-prototypes   -o gen-scmconfig.exe gen-scmconfig.o  -lregex -lgmp -lws2_32 -lm -lltdl ; 

guile cmake

In file included from /mnt/c/code/guile-git/libguile/../libguile/_scm.h:47,
                 from /mnt/c/code/guile-git/libguile/arbiters.c:45:
/mnt/c/code/guile-git/libguile/arbiters.c: In function 鈥�scm_try_arbiter鈥�:
/mnt/c/code/guile-git/libguile/alist.c: In function 鈥�scm_init_alist鈥�:
/mnt/c/code/guile-git/libguile/alist.c:406:10: fatal error: libguile/alist.x: No such file or directory
  406 | #include "libguile/alist.x"
      |          ^~~~~~~~~~~~~~~~~~
compilation terminated.
pikachu@DESKTOP-QPT1IPJ:/mnt/c/code/guile-git$ ./autogen.sh
: not foundh: 3:
./autogen.sh: 4: set: Illegal option -

用1.8编译成功后,运行报错

ERROR: In procedure primitive-load-path:
ERROR: Unable to find file "ice-9/boot-9.scm" in load path
./guile-snarf -o $@ $< $(snarfcppopts)

$@表示所有参数
$#表示所有参数的个数

使用pkgbuild

pacman -S mingw-w64-x86_64-gc
pacman -S texinfo
pacman -S patch

编译

makepkg

Ubuntu

sudo apt install automake libtool gettext libgmp-dev libreadline-dev flex texinfo
--disable-error-on-warning
include_directories(${CMAKE_BINARY_DIR})

TeXmacs

sudo apt install libjpeg-dev libpng-dev libsqlite3-dev libfreetype6-dev

compile guile 1.6.7

./libguile/guile
ERROR: Unbound variable: make-mutex

reset GUILE_LOAD_PATH

你可能感兴趣的:(【未整理】msys2开发TeXmacs,编译Guile的一些问题和可能解决办法)