Open SergeyMC9730 opened 3 years ago
try -ldiscord instead, I'm just a random guy observing this project so I don't know if I'm correct.
This project is very dead so I have no idea and can't guarantee anything will work, but try running make lib
first and make sure that libdisccord.so
is generated and ends up somewhere ld
can find it (you can add a search directory for it to look in with --library-path=<dir>
).
This project is very dead so I have no idea and can't guarantee anything will work, but try running
make lib
first and make sure thatlibdisccord.so
is generated and ends up somewhereld
can find it (you can add a search directory for it to look in with--library-path=<dir>
).
wow I don't expected the owner's reply!
after compiling some libraries I compiled client_connect.c using tcc. But I can't run program because:
dogo@The-PC:~/DiscordC/test$ ./client_connect_test
./client_connect_test: symbol lookup error: /lib/libdisccord.so: undefined symbol: lws_extension_callback_pm_deflate
dogo@The-PC:~/DiscordC/test$
You should try using gcc instead first
Same problem:
dogo@The-PC:~/DiscordC/test$ nano Makefile
dogo@The-PC:~/DiscordC/test$ make all
rm -rf *_test
rm -rf *.so
gcc -std=gnu11 -fPIC -Wpedantic -Wall -Wextra -march=native -O3 -o client_connect_test client_connect.c -I../include -L../lib -ldisccord -lssl -lcrypto -lpthread -lwebsockets -lcjson
client_connect.c: In function ‘on_unhandled_dispatch’:
client_connect.c:23:46: warning: unused parameter ‘client’ [-Wunused-parameter]
23 | void on_unhandled_dispatch(discord_client_t* client, char* dispatch_str, cJSON* root) {
| ~~~~~~~~~~~~~~~~~~^~~~~~
client_connect.c:23:81: warning: unused parameter ‘root’ [-Wunused-parameter]
23 | void on_unhandled_dispatch(discord_client_t* client, char* dispatch_str, cJSON* root) {
| ~~~~~~~^~~~
client_connect.c: In function ‘get_token’:
client_connect.c:40:2: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
40 | fgets(token, 128, fp);
| ^~~~~~~~~~~~~~~~~~~~~
/usr/bin/ld: ../lib/libdisccord.so: undefined reference to `lws_extension_callback_pm_deflate'
collect2: error: ld returned 1 exit status
make: *** [Makefile:14: client_connect_test] Error 1
dogo@The-PC:~/DiscordC/test$
P.S. I turned on LWS Extensions
Same problem:
...
P.S. I turned on LWS Extensions
If you built LWS with LWS_WITHOUT_EXTENSIONS=Off
then that error shouldn't occur. You can check if the libwebsockets.a
that you built has it properly with objdump -t libwebsockets.a
and look for lws_extension_callback_pm_deflate
. If it's missing then you need to reconfigure how you're building libwebsockets.
If it's there, then try putting it in the ../lib
folder that you're pointing to with -L
. If that still doesn't work then try running gcc with -l:../lib/libwebsockets.a
, or with -l:
plus an absolute path to that file. (In lib/Makefile
)