[gtk-osx-users] Can not compile python-launcher.c



Hello, I'm not able to compile python-launcher.c from gtk-mac-bundler on Mojave. Tried both with the system's Python 2 version as the Python 3 version built through jhbuild. For Python 2, the python-config command didn't pick up the directory which contains Python.h, so had to include it manually. Here's some relevant output:

bash-3.2$ gcc -L$PREFIX/lib `python-config --cflags --ldflags` -o $PREFIX/bin/testapp-launcher python-launcher.c
python-launcher.c:21:10: fatal error: 'Python.h' file not found
#include <Python.h>
         ^~~~~~~~~~
1 error generated.

bash-3.2$ gcc -L$PREFIX/lib `python-config --cflags --ldflags` -I/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -o $PREFIX/bin/testapp-launcher python-launcher.c python-launcher.c:106:5: warning: implicit declaration of function 'Py_SetPath' is invalid in C99
      [-Wimplicit-function-declaration]
    Py_SetPath(path);
    ^
python-launcher.c:106:5: warning: this function declaration is not a prototype [-Wstrict-prototypes] python-launcher.c:168:27: warning: incompatible pointer types passing 'wchar_t **' (aka 'int **') to
      parameter of type 'char **' [-Wincompatible-pointer-types]
    PySys_SetArgvEx(argc, wargv, 0);
                          ^~~~~
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/sysmodule.h:14:46: note:
      passing argument to parameter here
PyAPI_FUNC(void) PySys_SetArgvEx(int, char **, int);
                                             ^
3 warnings generated.
Undefined symbols for architecture x86_64:
  "_Py_SetPath", referenced from:
      _main in python-launcher-875336.o
ld: symbol(s) not found for architecture x86_64
python-launcher.c:106:5: warning: implicit declaration of function 'Py_SetPath' is invalid in C99
      [-Wimplicit-function-declaration]
    Py_SetPath(path);
    ^
python-launcher.c:106:5: warning: this function declaration is not a prototype [-Wstrict-prototypes] python-launcher.c:168:27: warning: incompatible pointer types passing 'wchar_t **' (aka 'int **') to
      parameter of type 'char **' [-Wincompatible-pointer-types]
    PySys_SetArgvEx(argc, wargv, 0);
                          ^~~~~
/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7/sysmodule.h:14:46: note:
      passing argument to parameter here
PyAPI_FUNC(void) PySys_SetArgvEx(int, char **, int);
                                             ^
3 warnings generated.
clang: error: linker command failed with exit code 1 (use -v to see invocation)

bash-3.2$ python-config --cflags --ldflags
-iwithsysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -iwithsysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -fno-strict-aliasing -fno-common -dynamic -arch x86_64 -arch i386 -g -Os -pipe -fno-common -fno-strict-aliasing -fwrapv -DENABLE_DTRACE -DMACOSX -DNDEBUG -Wall -Wstrict-prototypes -Wshorten-64-to-32 -DNDEBUG -g -fwrapv -Os -Wall -Wstrict-prototypes -DENABLE_DTRACE -L/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/config -lpython2.7 -ldl -framework CoreFoundation


bash-3.2$ gcc -L$PREFIX/lib `python3-config --cflags --ldflags` -o $PREFIX/bin/testapp-launcher python-launcher.c
Undefined symbols for architecture x86_64:
  "_PyRun_SimpleFileExFlags", referenced from:
      _main in python-launcher-f4f0b7.o
  "_PySys_SetArgvEx", referenced from:
      _main in python-launcher-f4f0b7.o
  "_Py_Finalize", referenced from:
      _main in python-launcher-f4f0b7.o
  "_Py_Initialize", referenced from:
      _main in python-launcher-f4f0b7.o
  "_Py_SetPath", referenced from:
      _main in python-launcher-f4f0b7.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

bash-3.2$ python3-config --cflags --ldflags
-I/Users/gtk3/gtk/inst/include/python3.8 -I/Users/gtk3/gtk/inst/include/python3.8 -Wno-unused-result -Wsign-compare -Wunreachable-code -DNDEBUG -g -fwrapv -O3 -Wall -arch x86_64 -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.14 -arch x86_64 -I/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/include -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk -mmacosx-version-min=10.14
-lintl -ldl -framework CoreFoundation

Am I missing something obvious? Thanks.


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]