Closed batijo closed 4 years ago
Wow, I just had this too yesterday, exactly the same problem! Build system is Arch Linux.
srt
v1.4.1 from Github, ./configure
, make
, make install
. Files are in /usr/local/..
. Everything fine. main.go
and paste in example skeleton from the examplesgo build -work -v -x main.go
(go1.14.1 linux/amd64, module exists). Result:[root@a303c1245327 srt-go]# go build -work -v -x main.go
WORK=/tmp/go-build057943306
github.com/haivision/srtgo
mkdir -p $WORK/b033/
cd /root/go/pkg/mod/github.com/haivision/srtgo@v0.0.0-20200218005533-2337e3bd8bb8
CGO_LDFLAGS='"-g" "-O2" "-lsrt" "-lsrt" "-lsrt"' /usr/lib/go/pkg/tool/linux_amd64/cgo -objdir $WORK/b033/ -importpath github.com/haivision/srtgo -- -I $WORK/b033/ -g -O2 ./netutils.go ./srtgo.go ./srtsocketoptions.go ./srtstats.go
cd $WORK
gcc -fno-caret-diagnostics -c -x c - -o /dev/null || true
gcc -Qunused-arguments -c -x c - -o /dev/null || true
gcc -fdebug-prefix-map=a=b -c -x c - -o /dev/null || true
gcc -gno-record-gcc-switches -c -x c - -o /dev/null || true
cd $WORK/b033
TERM='dumb' gcc -I /root/go/pkg/mod/github.com/haivision/srtgo@v0.0.0-20200218005533-2337e3bd8bb8 -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b033=/tmp/go-build -gno-record-gcc-switches -I ./ -g -O2 -o ./_x001.o -c _cgo_export.c
TERM='dumb' gcc -I /root/go/pkg/mod/github.com/haivision/srtgo@v0.0.0-20200218005533-2337e3bd8bb8 -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b033=/tmp/go-build -gno-record-gcc-switches -I ./ -g -O2 -o ./_x002.o -c netutils.cgo2.c
TERM='dumb' gcc -I /root/go/pkg/mod/github.com/haivision/srtgo@v0.0.0-20200218005533-2337e3bd8bb8 -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b033=/tmp/go-build -gno-record-gcc-switches -I ./ -g -O2 -o ./_x003.o -c srtgo.cgo2.c
TERM='dumb' gcc -I /root/go/pkg/mod/github.com/haivision/srtgo@v0.0.0-20200218005533-2337e3bd8bb8 -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b033=/tmp/go-build -gno-record-gcc-switches -I ./ -g -O2 -o ./_x004.o -c srtsocketoptions.cgo2.c
TERM='dumb' gcc -I /root/go/pkg/mod/github.com/haivision/srtgo@v0.0.0-20200218005533-2337e3bd8bb8 -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b033=/tmp/go-build -gno-record-gcc-switches -I ./ -g -O2 -o ./_x005.o -c srtstats.cgo2.c
TERM='dumb' gcc -I /root/go/pkg/mod/github.com/haivision/srtgo@v0.0.0-20200218005533-2337e3bd8bb8 -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b033=/tmp/go-build -gno-record-gcc-switches -I ./ -g -O2 -o ./_cgo_main.o -c _cgo_main.c
cd /root/go/pkg/mod/github.com/haivision/srtgo@v0.0.0-20200218005533-2337e3bd8bb8
TERM='dumb' gcc -I . -fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=$WORK/b033=/tmp/go-build -gno-record-gcc-switches -o $WORK/b033/_cgo_.o $WORK/b033/_cgo_main.o $WORK/b033/_x001.o $WORK/b033/_x002.o $WORK/b033/_x003.o $WORK/b033/_x004.o $WORK/b033/_x005.o -g -O2 -lsrt -lsrt -lsrt
# github.com/haivision/srtgo
/usr/sbin/ld: $WORK/b033/_cgo_main.o:/tmp/go-build/cgo-generated-wrappers:5: undefined reference to `SRT_INVALID_SOCK'
/usr/sbin/ld: $WORK/b033/_cgo_main.o:/tmp/go-build/cgo-generated-wrappers:2: undefined reference to `SRT_ERROR'
collect2: error: ld returned 1 exit status
Content of _cgo_main.c
:
[root@a303c1245327 srt-go]# more /tmp/go-build057943306/b033/_cgo_main.c
int main() { return 0; }
void crosscall2(void(*fn)(void*, int, __SIZE_TYPE__), void *a, int c, __SIZE_TYPE__ ctxt) { }
__SIZE_TYPE__ _cgo_wait_runtime_init_done(void) { return 0; }
void _cgo_release_context(__SIZE_TYPE__ ctxt) { }
char* _cgo_topofstack(void) { return (char*)0; }
void _cgo_allocate(void *a, int c) { }
void _cgo_panic(void *a, int c) { }
void _cgo_reginit(void) { }
#line 1 "cgo-generated-wrappers"
extern char SRT_ERROR[];
void *_cgohack_SRT_ERROR = SRT_ERROR;
extern char SRT_INVALID_SOCK[];
void *_cgohack_SRT_INVALID_SOCK = SRT_INVALID_SOCK;
Strings from _cgo_main.o
[root@a303c1245327 srt-go]# strings /tmp/go-build057943306/b033/_cgo_main.o | more
)c{N
5XFk
4T<`
<4oX
a```b
nzj^jQbIj
nyQbAAjQ1H
k!.EEDQ
q:8MJ'E?
oWx:.w
ZVC'
&Z$a
GCC: (Arch Linux 9.3.0-1) 9.3.0
_cgo_main.c
main
crosscall2
_cgo_wait_runtime_init_done
_cgo_release_context
_cgo_topofstack
_cgo_allocate
_cgo_panic
_cgo_reginit
_cgohack_SRT_INVALID_SOCK
_cgohack_SRT_ERROR
.symtab
.strtab
.shstrtab
.text
.data
.bss
.text.startup
.rela.data.rel
.rela.debug_info
.debug_abbrev
.rela.debug_aranges
.rela.debug_ranges
.rela.debug_line
.debug_str
.comment
.note.GNU-stack
.rela.eh_frame
Later I also tried ./configure --use-static-libstdc++
, as well as using pkg-config in the srtgo.go
file - no change.
Using 1.4.0 was also unsuccessful.
Testing v1.3.4 does not seem to work as well. I think it's because srtgo uses SRTO_ENFORCEDENCRYPTION
in srtsocketoptions.go, which was named SRTO_STRICTENC
before v1.4.0 (commit https://github.com/Haivision/srt/commit/a82e0c34b0aadcb309d9e2f322b26f8f59bf827a).
I am trying to run
go get github.com/haivision/srtgo
but getting this error:Using SRT version: 1.4.1 and golang version: 1.14