Ninhursag
-
Content Count
4 -
Joined
-
Last visited
Posts posted by Ninhursag
-
-
Was the ldflags failling while linking python.
Now i can use python on my plugins and its libs.Thank you!
-
Hi!!
i'm trying to add python 3.9 source to my plugins. test.c
#include <Python.h>
int main()
{
PyObject* pInt;
Py_Initialize();
PyRun_SimpleString("print('Hello World from Embedded Python!!!')");
Py_Finalize();
printf("\nPress any key to exit...\n");
if(!_getch()) _getch();
return 0;
}
But when i compile i have an error including python
CC test.c
test.c:3:10: fatal error: Python.h: No such file or directory
3 | #include <Python.h>
| ^~~~~~~~~~
compilation terminated.
make[1]: *** [Makefile:106: ../../plugins/test.so] Error 1i research a little about it on stackoverflow and im seeying to pass the flags into plugins makefile like this
Makefile: Makefile.in
@$(MAKE) -C ../.. src/plugins/Makefile.SECONDEXPANSION:
../../plugins/%@DLLEXT@: %.c $(ALL_H) $$(shell ls %/* 2>/dev/null)
@echo " CC $<"
@$(CC) $(COMMON_INCLUDE) $(THIRDPARTY_INCLUDE) @PLUGINSTATIC@ @DEFS@ @CFLAGS@ -I/usr/include/python3.9 -Wno-unused-result -Wsign-compare -g -ffile-prefix-map=/build/python3.9-FZ7wim/python3.9-3.9.5=. -flto=auto -ffat-lto-objects -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall @CPPFLAGS@ @LDFLAGS@ -L/usr/lib/python3.9/config-3.9-x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -lcrypt -lpthread -ldl -lutil -lm -lm @SOFLAGS@ @LIBS@ @MYSQL_LIBS@ -o $@ $<../../plugins/HPMHooking_login@DLLEXT@: HPMHOOKINGTYPE = LOGIN
../../plugins/HPMHooking_char@DLLEXT@: HPMHOOKINGTYPE = CHAR
../../plugins/HPMHooking_map@DLLEXT@: HPMHOOKINGTYPE = MAP../../plugins/HPMHooking_%@DLLEXT@: HPMHooking.c $(ALL_H) $$(shell ls HPMHooking/*_%* HPMHooking/*_common* 2>/dev/null)
@echo " CC $< ($(HPMHOOKINGTYPE))"
@$(CC) -DHPMHOOKING_$(HPMHOOKINGTYPE) $(COMMON_INCLUDE) $(THIRDPARTY_INCLUDE) @PLUGINSTATIC@ @DEFS@ @CFLAGS@ -I/usr/include/python3.9 -Wno-unused-result -Wsign-compare -g -ffile-prefix-map=/build/python3.9-FZ7wim/python3.9-3.9.5=. -flto=auto -ffat-lto-objects -specs=/usr/share/dpkg/no-pie-compile.specs -fstack-protector -Wformat -Werror=format-security -DNDEBUG -g -fwrapv -O3 -Wall @CPPFLAGS@ @LDFLAGS@ -L/usr/lib/python3.9/config-3.9-x86_64-linux-gnu -L/usr/lib/x86_64-linux-gnu -lcrypt -lpthread -ldl -lutil -lm -lm @SOFLAGS@ -o $@ $<And when i compile with flags i got this error, like the python 3.9 is included now, but the linker doesnt work.
Could anyone help me how to solve this and add python to my plugins?
Thank you so much
usr/bin/ld: /tmp/test.so.Yc5jF3.ltrans0.ltrans.o: in function `main':
/home/ubuntu/hercules/src/plugins/test.c:9: undefined reference to `Py_Initialize'
/usr/bin/ld: /home/ubuntu/hercules/src/plugins/test.c:11: undefined reference to `PyRun_SimpleStringFlags'
/usr/bin/ld: /home/ubuntu/hercules/src/plugins/test.c:13: undefined reference to `Py_Finalize'
/usr/bin/ld: /home/ubuntu/hercules/src/plugins/test.c:16: undefined reference to `_getch'
/usr/bin/ld: /home/ubuntu/hercules/src/plugins/test.c:16: undefined reference to `_getch'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:106: ../../plugins/test.so] Error 1
make[1]: Leaving directory '/home/ubuntu/hercules/src/plugins'
make: *** [Makefile:132: plugins] Error 2
Vending Binance plugin
in Quest, Shops, Functions & Algorithms Releases
Posted · Edited by Ninhursag