转载请注明出处:

http://www.cnblogs.com/darkknightzh/p/5754872.html

前段时间用终端和zerobrane运行torch的lua程序。zerobrane主要用于调试(虽说功能简单,但是还算可以用吧)。终端直接使用th xx.lua(torch安装的是luajit),zerobrane直接点击两个右箭头的“Execute the current project”。某天运行程序时,突然提示:

File.lua:: Failed to load function from bytecode: (binary): cannot load incompatible bytecode
[C]: in function 'error'
...program/torch/install/share/lua/5.1/torch/File.lua:: in function 'readObject'
...program/torch/install/share/lua/5.1/torch/File.lua:: in function 'readObject'
...program/torch/install/share/lua/5.1/torch/File.lua:: in function 'readObject'
...program/torch/install/share/lua/5.1/torch/File.lua:: in function 'load'

程序崩溃的地方是调用‘dofile’,在其内部出错的地方是load函数(之前有save成.t7文件,判断该文件存在,则直接load,否则重新生成该文件)。

当时很奇怪。后来发现:

1. 如果使用zerobrane运行程序进行save操作,再使用zerobrane运行程序,进行load操作,则不会崩溃。

2. 如果删除该.t7文件,使用终端运行该程序,save成t7文件,再使用终端运行程序,此时load该t7文件,也不会出错。

3. 如果使用zerobrane进行save,再使用终端load文件,或者使用终端save,再使用zerobrane进行load,则程序都会在load处崩溃。

个人猜测,原因应该是终端使用th命令和zerobrane直接运行文件所使用的解释器(interpreter)不同导致的。但是更改了一下,暂时没有成功。。。额,以后再说吧。。。

目前解决方法就是:单一使用zerobrane或者终端的th来运行程序。不要交替的使用。

ps:

1. 终端中运行th,信息如下:

运行lua,信息如下:

运行luajit,信息如下:

2. 后来测试过,如果save比较简单的数据,使用另一种方式load的话,能成功载入数据;如果save比较复杂的东西,比如有函数之类的,貌似就出问题了(此处不太确定)。

(原)lua提示cannot load incompatible bytecode的更多相关文章

  1. bundle install 安装的 gem 提示 cannot load such file

    /usr/local/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require': cannot load ...

  2. [转]Navicat for oracle 提示 cannot load oci dll,193的解决方法 orcale 11g

    Navicat for oracle 提示 cannot load oci dll,193的解决方法   内网有一台windows server 2012,安装了Navicat 11.1.8 连接or ...

  3. Navicat Premuim远程连接oracle 提示 cannot load oci dll,193的解决方法

    转载:http://blog.51cto.com/xiao987334176/1640991 内网有一台windows server 2012,安装了Navicat 11.1.8 连接oracle的时 ...

  4. Navicat 连接 Oracle数据库 提示 cannot load OCI DLL 的解决

    一.32位系统下 cannot load OCI DLL,126 解决方法:工具->选项->OCI 选择oracle安装目录下bin里面的oci.dll 二 .在64位系统下安装了Orac ...

  5. c#调用ffmpeg嵌入srt/ass字幕提示Cannot load default config file...

    c#调用ffmpeg嵌入srt/ass字幕提示 Fontconfig error: Cannot load default config file[Parsed_subtitles_0 @ 00000 ...

  6. virtualbox 启动虚拟机提示Cannot load R0 module

    Cannot load R0 module C:\Program Files\Oracle\VirtualBox/VBoxDDR0.r0: SUPR3LoadModule: supLoadModule ...

  7. [Lua]基于cc.load('mvc') .ViewBase索引资源方案

    local MainScene = class("MainScene", cc.load("mvc").ViewBase) MainScene.RESOURCE ...

  8. 聊聊LuaJIT

    JIT 什么是JITJIT = Just In Time即时编译,是动态编译的一种形式,是一种优化虚拟机运行的技术. 程序运行通常有两种方式,一种是静态编译,一种是动态解释,即时编译混合了这二者.Ja ...

  9. Cocos2d-x使用Luajit将Lua脚本编译成bytecode,启用加密

    http://www.cocoachina.com/bbs/read.php?tid=205802 lua脚本进行加密,查了一下相关的资料 ,得知lua本身能够使用luac将脚本编译为字节码(byte ...

随机推荐

  1. Windows单击右键没有共享选项怎么办

    文件共享是指在网络环境下文件.文件夹.某个硬盘分区使用时的一种设置属性,一般指多个用户可以同时打开或使用同一个文件或数据.但有时候也会遇到找不到共享选项的情况. Windows单击右键没有共享选项怎么 ...

  2. cocos2dx ——屏幕适配

    本文出自 “夏天的风” 博客,请务必保留此出处 http://shahdza.blog.51cto.com/2410787/1550089 手机的屏幕大小千差万别,如现在流行的安卓手机屏幕大部分长宽比 ...

  3. tp28xx port pin (open-drain )and (push-pull) 和open collector)

    具有开漏(OD)输出的器件是指内部输出和地之间有个N沟道的MOSFET(T1),这些器件可以用于电平转换的应用.输出电压由Vcc'决定.Vcc'可以大于输入高电平电压VCC(up-translate) ...

  4. 读论文系列:Nearest Keyword Search in XML Documents中使用的数据结构(CT、ECT)

    Reference: [1]Y. Tao, S. Papadopoulos, C. Sheng, K. Stefanidis. Nearest Keyword Search in XML Docume ...

  5. eclipse php 开发环境配置

    一般常用的是eclipse+pdt.我是直接下载的Eclipse for php :http://www.eclipse.org/downloads/packages/eclipse-php-deve ...

  6. 【转】CTS tests 4.2_r4

    原文网址:http://www.xuebuyuan.com/1722006.html Precondition: 1.Get android sdk 2.Set adb to environment ...

  7. POJ Oulipo (KMP)

    题目大意 : 在一个字符串中找出目标单词的个数 代码: #include<iostream> #include<cstdio> #include<cstdlib> ...

  8. Search in Rotated Sorted Array (I, II) 解答

    Question Suppose a sorted array is rotated at some pivot unknown to you beforehand. (i.e., 0 1 2 4 5 ...

  9. 【转】RTSP协议学习笔记

    第一部分:RTSP协议 一. RTSP协议概述 RTSP(Real-Time Stream Protocol )是一种基于文本的应用层协议,在语法及一些消息参数等方面,RTSP协议与HTTP协议类似. ...

  10. hdu 5429 Geometric Progression(存个大数模板)

    Problem Description Determine whether a sequence is a Geometric progression or not. In mathematics, ...