Haivision / srtgo

Go bindings for SRT. Advantages of SRT technology for an easy to use programming language
Mozilla Public License 2.0
185 stars 52 forks source link

Ubuntu compile error #47

Open lonelymemo opened 2 years ago

lonelymemo commented 2 years ago

when i compile my project on Ubuntu got err:(compile on mac works ok)

/usr/bin/ld: /home/toc/SDE/slive/deploy/thirdpart/lib/libsrt.a(srt_c_api.cpp.o): relocation R_X86_64_PC32 against symbol `_ZTTSt13basic_fstreamIcSt11char_traitsIcEE@@GLIBCXX_3.4' can not be used when making a PDE object; recompile with -fPIE /usr/bin/ld: final link failed: bad value collect2: error: ld returned 1 exit status

my env below: go version go version go1.12.7 linux/amd64

  1. go env

GOARCH="amd64" GOBIN="" GOCACHE="/root/.cache/go-build" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOOS="linux" GOPATH="/root/go" GOPROXY="" GORACE="" GOROOT="/root/.gvm/gos/go1.12.7" GOTMPDIR="" GOTOOLDIR="/root/.gvm/gos/go1.12.7/pkg/tool/linux_amd64" GCCGO="gccgo" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/home/toc/SDE/slive/go.mod" CGO_CFLAGS="-I /home/toc/SDE/slive/deploy/thirdpart/include" CGO_CPPFLAGS="" CGO_CXXFLAGS="-g -O2" CGO_FFLAGS="-g -O2" CGO_LDFLAGS="-L /home/toc/SDE/slive/deploy/thirdpart/lib" PKG_CONFIG="pkg-config" GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build516294395=/tmp/go-build -gno-record-gcc-switches"

  1. GCC version:

Using built-in specs. COLLECT_GCC=gcc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/9/lto-wrapper OFFLOAD_TARGET_NAMES=nvptx-none:hsa OFFLOAD_TARGET_DEFAULT=1 Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Ubuntu 9.4.0-1ubuntu1~20.04.1' --with-bugurl=file:///usr/share/doc/gcc-9/README.Bugs --enable-languages=c,ada,c++,go,brig,d,fortran,objc,obj-c++,gm2 --prefix=/usr --with-gcc-major-version-only --program-suffix=-9 --program-prefix=x86_64-linux-gnu- --enable-shared --enable-linker-build-id --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --libdir=/usr/lib --enable-nls --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --with-default-libstdcxx-abi=new --enable-gnu-unique-object --disable-vtable-verify --enable-plugin --enable-default-pie --with-system-zlib --with-target-system-zlib=auto --enable-objc-gc=auto --enable-multiarch --disable-werror --with-arch-32=i686 --with-abi=m64 --with-multilib-list=m32,m64,mx32 --enable-multilib --with-tune=generic --enable-offload-targets=nvptx-none=/build/gcc-9-Av3uEd/gcc-9-9.4.0/debian/tmp-nvptx/usr,hsa --without-cuda-driver --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 9.4.0 (Ubuntu 9.4.0-1ubuntu1~20.04.1)

ld version: GNU ld (GNU Binutils for Ubuntu) 2.34

srt version :1.4.4 ./configure --enable-static --disable-shared --enable-apps=off --prefix=./srt

other info: on ubuntun i change the srtgo souce file add -lstdc++ -lm ,if not i got err "can't find operate new" even if i change to clang still got the same error