sipcapture / heplify-server

HEP Capture Server for HOMER
https://sipcapture.org
GNU Affero General Public License v3.0
184 stars 85 forks source link

Install on FreeBSD #462

Closed McSimDP closed 3 years ago

McSimDP commented 3 years ago

On execution go build -o heplify-server cmd/heplify-server/heplify-server.go I get an error # github.com/sipcapture/golua/lua ld: error: unable to find library -lluajit-5.1 clang: error: linker command failed with exit code 1 (use -v to see invocation)

root@homer:~/heplify-server# ls -l /usr/local/lib/libluajit* -rw-r--r-- 1 root wheel 885708 Feb 25 16:01 /usr/local/lib/libluajit-5.1.a lrwxr-xr-x 1 root wheel 22 Feb 25 16:01 /usr/local/lib/libluajit-5.1.so -> libluajit-5.1.so.2.0.5 lrwxr-xr-x 1 root wheel 22 Feb 25 16:01 /usr/local/lib/libluajit-5.1.so.2 -> libluajit-5.1.so.2.0.5 -rwxr-xr-x 1 root wheel 545808 Feb 25 16:01 /usr/local/lib/libluajit-5.1.so.2.0.5

Please tell me how to install on FreeBSD

lmangani commented 3 years ago

Hi @McSimDP you should be able to execute the release binary, while to build you need the luajit dev packages as well. do you have luajit-5.1-dev (or equivalent) installed on your system?

McSimDP commented 3 years ago
root@homer:~/heplify-server# pkg info | grep lua
lua52-5.2.4                    Small, compilable scripting language providing easy access to C code
luajit-2.0.5_5                 Just-In-Time Compiler for Lua
root@homer:~/heplify-server# pkg which /usr/local/lib/libluajit-5.1.so.2
/usr/local/lib/libluajit-5.1.so.2 was installed by package luajit-2.0.5_5
adubovikov commented 3 years ago

Can you please check if the library is in ldpath? Please use ldconfig for this

Regards, Alexandr

On Fri, 12 Mar 2021, 19:00 Максим @.***> wrote:

@.:~/heplify-server# pkg info | grep lua lua52-5.2.4 Small, compilable scripting language providing easy access to C code luajit-2.0.5_5 Just-In-Time Compiler for Lua @.:~/heplify-server# pkg which /usr/local/lib/libluajit-5.1.so.2 /usr/local/lib/libluajit-5.1.so.2 was installed by package luajit-2.0.5_5

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/sipcapture/heplify-server/issues/462#issuecomment-797658876, or unsubscribe https://github.com/notifications/unsubscribe-auth/ABCN2JLBXPG5QIB2VY2R2S3TDJJDJANCNFSM4ZCUA7SA .

McSimDP commented 3 years ago
ldconfig -r | grep lua
        184:-lluajit-5.1.2 => /usr/local/lib/libluajit-5.1.so.2

As I understand it, the problem is luajit-5.1.2 Please tell me how to make a pointer for luajit-5.1

adubovikov commented 3 years ago

please add /usr/local/lib to your system lib libraries or set

LDFLAGS="-L/usr/local/lib -R/usr/local/lib"

before execute make

McSimDP commented 3 years ago

Added a line to the makefile. Nothing changed.

adubovikov commented 3 years ago

try to change this line: https://github.com/sipcapture/golua/blob/master/lua/lua.go#L16 to luajit5.1.2

McSimDP commented 3 years ago

Did not help

lua.go: #cgo freebsd,!luaa,!llua5.1 LDFLAGS: -L/usr/local/lib -lluajit-5.1.2 -v

root@homer:~/go/pkg/mod/github.com/sipcapture/golua@v0.0.0-20200610090950-538d24098d76/lua# go build ./lua.go
# command-line-arguments
FreeBSD clang version 10.0.1 (git@github.com:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611aa2)
Target: x86_64-unknown-freebsd12.2
Thread model: posix
InstalledDir: /usr/bin
 "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -o $WORK/b001/_cgo_.o /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/local/lib -L/usr/lib $WORK/b001/_cgo_main.o $WORK/b001/_x001.o $WORK/b001/_x002.o -lluajit-5.1.2 -lgcc --as-needed -lgcc_s --no-as-needed -lpthread -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o
ld: error: unable to find library -lluajit-5.1.2
clang: error: linker command failed with exit code 1 (use -v to see invocation)
adubovikov commented 3 years ago

find  / -name libluajit-5.1*
McSimDP commented 3 years ago
root@homer:~/go/pkg/mod/github.com/sipcapture/golua@v0.0.0-20200610090950-538d24098d76/lua# find / -name "libluajit-5.1*"
/usr/local/lib/libluajit-5.1.so.2
/usr/local/lib/libluajit-5.1.a
/usr/local/lib/libluajit-5.1.so
/usr/local/lib/libluajit-5.1.so.2.0.5
adubovikov commented 3 years ago

in this case you have only /usr/local/lib/libluajit-5.1.so:

-lluajit-5.1

or if you don't want, just add to the compiler: /usr/local/lib/libluajit-5.1.a and it will take your library static

/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -o $WORK/b001/_cgo_.o /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/local/lib -L/usr/lib $WORK/b001/_cgo_main.o $WORK/b001/_x001.o $WORK/b001/_x002.o  --as-needed -lgcc_s --no-as-needed -lpthread -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o /usr/local/lib/libluajit-5.1.a
McSimDP commented 3 years ago

I apologize, I do not know how to do this. My experience in developing multi-file projects is very small. Development experience on Go is missing. I started studying the basics.

adubovikov commented 3 years ago

whats version of FreeBSD do you have ?

McSimDP commented 3 years ago

FreeBSD 12.2-RELEASE-p4 GENERIC amd64

McSimDP commented 3 years ago

added line #cgo freebsd,!luaa,!llua5.1 pkg-config: luajit into lua.go

root@homer:~/go/pkg/mod/github.com/sipcapture/golua@v0.0.0-20200610090950-538d24098d76/lua# go build lua.go
# command-line-arguments
FreeBSD clang version 10.0.1 (git@github.com:llvm/llvm-project.git llvmorg-10.0.1-0-gef32c611aa2)
Target: x86_64-unknown-freebsd12.2
Thread model: posix
InstalledDir: /usr/bin
 "/usr/bin/ld" --eh-frame-hdr -dynamic-linker /libexec/ld-elf.so.1 --hash-style=both --enable-new-dtags -o $WORK/b001/_cgo_.o /usr/lib/crt1.o /usr/lib/crti.o /usr/lib/crtbegin.o -L/usr/local/lib -L/usr/lib $WORK/b001/_cgo_main.o $WORK/b001/_x001.o $WORK/b001/_x002.o -lluajit-5.1 -lluajit-5.1 -lgcc --as-needed -lgcc_s --no-as-needed -lpthread -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/crtend.o /usr/lib/crtn.o
ld: error: undefined symbol: clua_atpanic
>>> referenced by cgo-gcc-prolog:54
>>>               $WORK/b001/_x002.o:(_cgo_339d84d4bea0_Cfunc_clua_atpanic)
>>> did you mean: lua_atpanic
>>> defined in: /usr/local/lib/libluajit-5.1.so

ld: error: undefined symbol: clua_callluacfunc
>>> referenced by cgo-gcc-prolog:74
>>>               $WORK/b001/_x002.o:(_cgo_339d84d4bea0_Cfunc_clua_callluacfunc)

ld: error: undefined symbol: clua_initstate
>>> referenced by cgo-gcc-prolog:89
>>>               $WORK/b001/_x002.o:(_cgo_339d84d4bea0_Cfunc_clua_initstate)
[==cut==]
ld: error: undefined symbol: clua_togofunction
>>> referenced by cgo-gcc-prolog:331
>>>               $WORK/b001/_x002.o:(_cgo_339d84d4bea0_Cfunc_clua_togofunction)

ld: error: too many errors emitted, stopping now (use -error-limit=0 to see all errors)
clang: error: linker command failed with exit code 1 (use -v to see invocation)
adubovikov commented 3 years ago

no links to the object of https://github.com/zhuzhu2/goluab/blob/master/c-golua.c

McSimDP commented 3 years ago

Tried to compile lua.go and was getting this error. I compiled the heplify-server - everything was assembled. Thank you very much for your help!