在该书刚开始编译hello.cb时就遇到了问题。
 本人用的是wsl,环境如下,
 
由于是64位,因此根据书中的提示,从git上下载了64位的cb编译器
 cbc-64bit
 
问题一: 通过如下命令编译时,总是报错。
cbc -Wa,"--32" -Wl,"-melf_i386" test/hello.cb
报错信息如下:
 
 解决方案如下:
 
问题二: 成功编译后,无法执行。
 
 也已经有朋友解决了,如下:
 
 执行交叉编译中的GCC出现cannot execute binary file: Exec format error的解决方法
安装qemu和binfmt
sudo apt update
sudo apt install qemu-user-static
sudo update-binfmts --install i386 /usr/bin/qemu-i386-static --magic '\x7fELF\x01\x01\x01\x03\x00\x00\x00\x00\x00\x00\x00\x00\x03\x00\x03\x00\x01\x00\x00\x00' --mask '\xff\xff\xff\xff\xff\xff\xff\xfc\xff\xff\xff\xff\xff\xff\xff\xff\xf8\xff\xff\xff\xff\xff\xff\xff'
等安装完成功后,再次编译,执行。成功输出hello, world
 
搞了半天,遇到的问题,都已经有朋友解决了。再记录一边,把答案扩散开,方便更多朋友。
 git_issues
 



















