Build Luajit notice

When uploading Luajit (for example, v2.0.4) from Windows to Linux, you may get the following compile error:

In file included from lj_ffrecord.c:859:0:
lj_recdef.h:224:1: error: ‘recff_rawlen’ undeclared here (not in a function)
Makefile:645: recipe for target 'lj_ffrecord.o' failed

The root cause is in src/host/buildvm_lib.c:

void emit_lib(BuildCtx *ctx)

    int ok = 1;
    if (!strcmp(buf, "#if LJ_52\n"))
      ok = LJ_52;
    else if (!strcmp(buf, "#if LJ_HASJIT\n"))
      ok = LJ_HASJIT;
    else if (!strcmp(buf, "#if LJ_HASFFI\n"))
      ok = LJ_HASFFI;


Because in Windows, the EOL(End-of-Line) should be “\r\n“, so the !strcmp(buf, "#if LJ_52\n") will return false (!strcmp(buf, "#if LJ_52\r\n") will return true). The modify method is using the dos2unix tool to convert the whole folder:

# cd LuaJIT-2.0.4
# find . -type f -print0 | xargs -0 dos2unix

Then compile will be OK.

(1) The EOL difference in Windows and UNIX may generate compile error;
(2) How can I run dos2unix on an entire directory?.

Set proxy when executing “go get” command

In Windows, if you have configured proxy for connecting Internet, then executing “go get” command may get error, like this:

C:\Users\xiaona>go get -v
https fetch failed.
import "": http/https fetch: Get
l.v2?go-get=1: dial tcp ConnectEx tcp: A connection attempt
failed because the connected party did not properly respond after a period of ti
me, or established connection failed because connected host has failed to respon
package unrecognized import path "

The solution is set “http_proxy” and/or “https_proxy” environment variables according to your reality need:

C:\Users\xiaona>set https_proxy=

C:\Users\xiaona>set http_proxy=

C:\Users\xiaona>go get -v
Parsing meta tags from (status code 200)

get "": found meta tag main.metaImport{Prefix:"
tih/pool.v2", VCS:"git", RepoRoot:""} at https://g (download) 

All is OK now!