Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing -lstdc++ in sources #98

Open
Vladius25 opened this issue Dec 19, 2021 · 0 comments
Open

Missing -lstdc++ in sources #98

Vladius25 opened this issue Dec 19, 2021 · 0 comments

Comments

@Vladius25
Copy link

I have installed tdlib from disto repo and trying to build my app:

$ go build cmd/app.go 
# github.com/Arman92/go-tdlib
/usr/bin/ld: /usr/lib/gcc/x86_64-redhat-linux/11/../../../../lib64/libtdutils.a(misc.cpp.o): undefined reference to symbol '_ZNSt6localeD1Ev@@GLIBCXX_3.4'
/usr/bin/ld: /usr/lib64/libstdc++.so.6: error adding symbols: DSO missing from command line
collect2: error: ld returned 1 exit status

But following works fine:

$ export CGO_LDFLAGS="-lstdc++"
$ go build cmd/app.go 

-lstdc++ is missing there

//#cgo linux LDFLAGS: -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdapi -ltdactor -ltddb -ltdsqlite -ltdnet -ltdutils -lc++ -lssl -lcrypto -ldl -lz -lm

And example from README isn't working also. Try go build with -x flag and you will see that -lstdc++ will not be added.

$ go build --ldflags "-extldflags '-static -L/usr/local/lib -ltdjson_static -ltdjson_private -ltdclient -ltdcore -ltdactor -ltddb -ltdsqlite -ltdnet -ltdutils -ldl -lm -lssl -lcrypto -lstdc++ -lz'" -o /tmp/getChats getChats.go
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant