Getting Python.h: No such file or directory when compiling mod_wsgi on OSX with python3 - mod-wsgi

I have updated the python code from Python2 to Python3. I had no issues compiling mod_wsgi with python2. But When I compile it with Python3, it's giving below error.
I tried to get rid of the mod_wsgi installed at OS level and tried pointing the ./configure script to different Python3 locations. But, nothing worked.
./configure -with-python=/usr/bin/python3
make
[user#xx-xx-xx-xx mod_wsgi-4.6.4]$ make
/usr/bin/apxs -c -I/usr/include/python3.7m -DNDEBUG -D_GNU_SOURCE -Wc,-g -Wc,-O2 src/server/mod_wsgi.c src/server/wsgi_*.c -L/usr/lib64 -L/usr/lib64/python3.7/config-3.7m -lpython3.7m -lcrypt -lpthread -ldl -lutil -lm
/usr/lib64/apr-1/build/libtool --silent --mode=compile gcc -prefer-pic -O2 -g -pipe -Wall -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -fstack-protector-strong --param=ssp-buffer-size=4 -grecord-gcc-switches -m64 -mtune=generic -DLINUX -D_REENTRANT -D_GNU_SOURCE -pthread -I/usr/include/httpd -I/usr/include/apr-1 -I/usr/include/apr-1 -g -O2 -I/usr/include/python3.7m -DNDEBUG -D_GNU_SOURCE -c -o src/server/mod_wsgi.lo src/server/mod_wsgi.c && touch src/server/mod_wsgi.slo
In file included from src/server/mod_wsgi.c:22:0:
src/server/wsgi_python.h:24:10: fatal error: Python.h: No such file or directory
#include <Python.h>
^~~~~~~~~~
compilation terminated.
apxs:Error: Command failed with rc=65536

The solution to this problem depends on your Linux distribution. You'll have to install the dev package for your Python version.
sudo apt-get install python3-dev
sudo yum install python3-devel
A more complete explanation on the missing Python header file can be found here

Related

Unable to compile with Rcpp

I use R version 4.0.2 (2020-06-22) -- "Taking Off Again". My system is W10 enterprise 1909.
I assume I have correctly installed Rtools40, since:
install.packages("jsonlite", type = "source") terminates correctly
I used some code from devtools: has_rtools() and it returns TRUE.
install.packages("jsonlite", type = "source")
essai de l'URL 'https://cran.rstudio.com/src/contrib/jsonlite_1.6.1.tar.gz'
Content type 'application/x-gzip' length 1057910 bytes (1.0 MB)
downloaded 1.0 MB
* installing *source* package 'jsonlite' ...
** package 'jsonlite' correctement décompressé et sommes MD5 vérifiées
** using staged installation
** libs
*** arch - i386
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/i386/Makeconf:244: warning: overriding recipe for target '.m.o'
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/i386/Makeconf:237: warning: ignoring old recipe for target '.m.o'
"C:/rtools40//mingw32/bin/"gcc -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c base64.c -o base64.o
[...]
"C:/rtools40//mingw32/bin/"ar rcs yajl/libstatyajl.a yajl/yajl.o yajl/yajl_alloc.o yajl/yajl_buf.o yajl/yajl_encode.o yajl/yajl_gen.o yajl/yajl_lex.o yajl/yajl_parser.o yajl/yajl_tree.o
C:/rtools40//mingw32/bin/gcc -shared -s -static-libgcc -o jsonlite.dll tmp.def base64.o collapse_array.o collapse_object.o collapse_pretty.o escape_chars.o integer64_to_na.o is_datelist.o is_recordlist.o is_scalarlist.o modp_numtoa.o null_to_na.o num_to_char.o parse.o prettify.o push_parser.o r-base64.o register.o row_collapse.o transpose_list.o validate.o -Lyajl -lstatyajl -LC:/Users/toto26/DOCUME~1/R/R-40~1.2/bin/i386 -lR
installing to C:/Users/toto26/Documents/R/R-4.0.2/library/00LOCK-jsonlite/00new/jsonlite/libs/i386
*** arch - x64
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/x64/Makeconf:244: warning: overriding recipe for target '.m.o'
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/x64/Makeconf:237: warning: ignoring old recipe for target '.m.o'
"C:/rtools40//mingw64/bin/"gcc -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -Iyajl/api -D__USE_MINGW_ANSI_STDIO -O2 -Wall -std=gnu99 -mfpmath=sse -msse2 -mstackrealign -c base64.c -o base64.o
[...]
"C:/rtools40//mingw64/bin/"ar rcs yajl/libstatyajl.a yajl/yajl.o yajl/yajl_alloc.o yajl/yajl_buf.o yajl/yajl_encode.o yajl/yajl_gen.o yajl/yajl_lex.o yajl/yajl_parser.o yajl/yajl_tree.o
C:/rtools40//mingw64/bin/gcc -shared -s -static-libgcc -o jsonlite.dll tmp.def base64.o collapse_array.o collapse_object.o collapse_pretty.o escape_chars.o integer64_to_na.o is_datelist.o is_recordlist.o is_scalarlist.o modp_numtoa.o null_to_na.o num_to_char.o parse.o prettify.o push_parser.o r-base64.o register.o row_collapse.o transpose_list.o validate.o -Lyajl -lstatyajl -LC:/Users/toto26/DOCUME~1/R/R-40~1.2/bin/x64 -lR
installing to C:/Users/toto26/Documents/R/R-4.0.2/library/00LOCK-jsonlite/00new/jsonlite/libs/x64
** R
** inst
** byte-compile and prepare package for lazy loading
** help
*** installing help indices
converting help for package 'jsonlite'
finding HTML links ... fini
base64 html
flatten html
fromJSON html
prettify html
rbind_pages html
read_json html
serializeJSON html
stream_in html
unbox html
validate html
** building package indices
** installing vignettes
** testing if installed package can be loaded from temporary location
*** arch - i386
*** arch - x64
** testing if installed package can be loaded from final location
*** arch - i386
*** arch - x64
** testing if installed package keeps a record of temporary installation path
* DONE (jsonlite)
The downloaded source packages are in
‘C:\Users\toto26\AppData\Local\Temp\RtmpQrssTP\downloaded_packages’
One of my issue may come from the location of make:
Sys.which("make")
make
"C:\\WINDOWS\\SYSTEM32\\make.exe"
instead of the expected
Sys.which("make")
## "C:\\rtools40\\usr\\bin\\make.exe"
I have asked my IT department to remove the system32 version from my laptop.
Nevertheless, I am not sure it is the root cause of my issues:
install.packages("Rcpp", type = 'source')
essai de l'URL 'https://cran.rstudio.com/src/contrib/Rcpp_1.0.4.6.tar.gz'
Content type 'application/x-gzip' length 2751467 bytes (2.6 MB)
downloaded 2.6 MB
* installing *source* package 'Rcpp' ...
** package 'Rcpp' correctement décompressé et sommes MD5 vérifiées
** using staged installation
** libs
*** arch - i386
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/i386/Makeconf:244: warning: overriding recipe for target '.m.o'
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/i386/Makeconf:237: warning: ignoring old recipe for target '.m.o'
"C:/rtools40//mingw32/bin/"g++ -std=gnu++11 -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -I../inst/include/ -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c api.cpp -o api.o
"C:/rtools40//mingw32/bin/"g++ -std=gnu++11 -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -I../inst/include/ -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c attributes.cpp -o attributes.o
"C:/rtools40//mingw32/bin/"g++ -std=gnu++11 -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -I../inst/include/ -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c barrier.cpp -o barrier.o
"C:/rtools40//mingw32/bin/"g++ -std=gnu++11 -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -I../inst/include/ -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c date.cpp -o date.o
"C:/rtools40//mingw32/bin/"g++ -std=gnu++11 -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -I../inst/include/ -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c module.cpp -o module.o
"C:/rtools40//mingw32/bin/"g++ -std=gnu++11 -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -I../inst/include/ -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c rcpp_init.cpp -o rcpp_init.o
"C:/rtools40//mingw32/bin/"g++ -std=gnu++11 -shared -s -static-libgcc -o Rcpp.dll tmp.def api.o attributes.o barrier.o date.o module.o rcpp_init.o -LC:/Users/toto26/DOCUME~1/R/R-40~1.2/bin/i386 -lR
/usr/bin/sh: line 8: "C:/rtools40//mingw32/bin/"g++ -std=gnu++11 : No such file or directory
aucune DLL n'a pas été créé
ERROR: compilation failed for package 'Rcpp'
* removing 'C:/Users/toto26/Documents/R/R-4.0.2/library/Rcpp'
Warning in install.packages :
installation of package ‘Rcpp’ had non-zero exit status
If I install the compiled version it works, but then I can't use Rcpp:
install.packages("Rcpp")
essai de l'URL 'https://cran.rstudio.com/bin/windows/contrib/4.0/Rcpp_1.0.4.6.zip'
Content type 'application/zip' length 3167452 bytes (3.0 MB)
downloaded 3.0 MB
package ‘Rcpp’ successfully unpacked and MD5 sums checked
The downloaded binary packages are in
C:\Users\toto26\AppData\Local\Temp\RtmpQrssTP\downloaded_packages
> Rcpp::evalCpp("2+2")
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/x64/Makeconf:244: warning: overriding recipe for target '.m.o'
C:/Users/toto26/DOCUME~1/R/R-40~1.2/etc/x64/Makeconf:237: warning: ignoring old recipe for target '.m.o'
"C:/rtools40//mingw64/bin/"g++ -std=gnu++11 -I"C:/Users/toto26/DOCUME~1/R/R-40~1.2/include" -DNDEBUG -I"C:/Users/toto26/Documents/R/R-4.0.2/library/Rcpp/include" -I"C:/Users/toto26/AppData/Local/Temp/RtmpQrssTP/sourceCpp-x86_64-w64-mingw32-1.0.4.6" -O2 -Wall -mfpmath=sse -msse2 -mstackrealign -c file477046ea4828.cpp -o file477046ea4828.o
"C:/rtools40//mingw64/bin/"g++ -std=gnu++11 -shared -s -static-libgcc -o sourceCpp_2.dll tmp.def file477046ea4828.o -LC:/Users/toto26/DOCUME~1/R/R-40~1.2/bin/x64 -lR
/usr/bin/sh: line 8: "C:/rtools40//mingw64/bin/"g++ -std=gnu++11 : No such file or directory
Error in sourceCpp(code = code, env = env, rebuild = rebuild, cacheDir = cacheDir, :
Error occurred building shared library.
Any hints would be more than welcome.
Thanks a lot in advance.
Emmanuel
edit: here is my path:
> Sys.getenv('PATH')
[1] "C:\\rtools40\\usr\\bin;C:\\Users\\toto26\\Documents\\R\\R-4.0.2\\bin\\x64;C:\\rtools40\\usr\\bin;C:\\rtools40\\mingw64\\bin;C:\\ProgramData\\DockerDesktop\\version-bin;C:\\Program Files\\Docker\\Docker\\Resources\\bin;C:\\RBuildTools\\bin;C:\\RBuildTools\\mingw_64\\bin;C:\\RBuildTools\\mingw_32\\bin;C:\\Program Files (x86)\\Common Files\\Oracle\\Java\\javapath;C:\\WINDOWS\\system32;C:\\WINDOWS;C:\\WINDOWS\\System32\\Wbem;C:\\WINDOWS\\System32\\WindowsPowerShell\\v1.0\\;C:\\Program Files\\MATLAB\\R2018a\\runtime\\win64;C:\\Program Files\\MATLAB\\R2018a\\bin;C:\\Program Files (x86)\\PDFtk\\bin\\;C:\\WINDOWS\\System32\\OpenSSH\\;C:\\rtools40\\usr\\bin;C:\\RBuildTools\\3.5\\mingw_64\\bin;C:\\RBuildTools\\3.5\\bin;C:\\Python\\Scripts\\;C:\\Python\\;C:\\Users\\toto26\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\toto26\\AppData\\Local\\atom\\bin;C:\\Users\\toto26\\AppData\\Local\\Programs\\MiKTeX 2.9\\miktex\\bin\\x64\\;C:\\RBuildTools\\3.3\\mingw_64\\bin;C:\\MinGW\\bin;C:\\Users\\toto26\\AppData\\Local\\Microsoft\\WindowsApps;C:\\Users\\toto26\\AppData\\Local\\Pandoc\\;"

bazel compile error: linux/magic.h: No such file or directory

ERROR: /ban/yohchang/practice/tensorflow/bazel-0.5.1-dist/src/main/cpp/BUILD:7:1: C++ compilation of rule '//src/main/cpp:blaze_util' failed: gcc failed: error executing command
(cd /tmp/bazel_tC149834/out/execroot/bazel-0.5.1-dist &&
exec env -
LD_LIBRARY_PATH=:/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/gcc-4.8.1/lib:/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/gcc-4.8.1/lib64/:/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/mpc-0.8.1/lib:/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/gmp-4.3.2/lib:/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/mpfr-2.4.2/lib:/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/isl-0.11/lib:/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/cloog-0.18.0/lib
PATH=/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/binutils-2.28:/sc10/ap/sivl/2005.09-SP1-1/bin:/vol0/sys/myPrint/print_execd-6.2u4/bin/lx24-amd64:/sc10/ap/linux/bin:/ban/yohchang/:.:/bin:/usr/ucb:/usr/ccs/bin:/usr/dt/bin:/usr/openwin/bin:/usr/local/bin:/usr/ucb/bin:/usr/bin:/usr/sbin:/bin/X11:/usr/X11R6/bin:/sc10/ap/xv/sun:/ban/wchuang/tool:/sc10/ap/tool:/vol0/sys/tool:/usr/bin:/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/gcc-4.8.1/bin
PWD=/proc/self/cwd
/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/gcc-4.8.1/bin/gcc -U_FORTIFY_SOURCE -fstack-protector -Wall -B/volp1/quota_ctrl/yohchang/practice/tensorflow/local_install/gcc-4.8.1/bin -B/usr/bin -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -g0 -O2 '-D_FORTIFY_SOURCE=1' -DNDEBUG -ffunction-sections -fdata-sections '-std=c++0x' -MD -MF bazel-out/local-opt/bin/src/main/cpp/objs/blaze_util/src/main/cpp/blaze_util_linux.d '-frandom-seed=bazel-out/local-opt/bin/src/main/cpp/objs/blaze_util/src/main/cpp/blaze_util_linux.o' -DBLAZE_OPENSOURCE -iquote . -iquote bazel-out/local-opt/genfiles -iquote external/bazel_tools -iquote bazel-out/local-opt/genfiles/external/bazel_tools -isystem external/bazel_tools/tools/cpp/gcc3 -fno-canonical-system-headers -Wno-builtin-macro-redefined '-D__DATE="redacted"' '-D__TIMESTAMP__="redacted"' '-D__TIME__="redacted"' -c src/main/cpp/blaze_util_linux.cc -o bazel-out/local-opt/bin/src/main/cpp/_objs/blaze_util/src/main/cpp/blaze_util_linux.o): com.google.devtools.build.lib.shell.BadExitStatusException: Process exited with status 1.
src/main/cpp/blaze_util_linux.cc:18:25: fatal error: linux/magic.h: No such file or directory
#include "linux/magic.h"
^
compilation terminated.
Don't really know how to solve this...
I try to use google to find some information. It tells me that maybe this problem is caused by my old kernel. But I don't really know what I can do next.
Environment info
Operating System:
Red Hat Enterprise Linux Server release 5.7 (Tikanga)
ldd (GNU libc) 2.5
gcc-4.8.1 (I install this compiler additionally.)
other information:
I can't use yum or any other on-line update to install package...
So I download source code and compile them on my redhat computer.
Bazel version (output of bazel info release):
0.5.1-dist
If you need any other information, please let me know!
Thanks for help!
linux/magic.h is not part of Bazel, it's part of the environment. I, for example, have it in /usr/include/linux/magic.h.
Can you download the equivalent of kernel-headers (the ones you would install by yum install kernel-headers) and put them somewhere gcc can see them? That would be into one of the directories returned by gcc -E -xc++ - -v.

gcc: gnustep-config: No such file or directory and unrecognized command line option -fobjc-flags

Hi all please provide me solution for this i want to execute objective using command line
1)
command : gcc -o filename 'gnustep-config --objc-flags' 'gnustep-config --base-libs' -o filename.m
error :
gcc: gnustep-config: No such file or directory
gcc:gnustep-config: No such file or directory
cc1obj: error: unrecognized command line option "-fobjc-flags"
cc1obj: error: unrecognized command line option "-fbase-libs"
2)
command : gcc -o filename 'gnustep-config --objc-flags' -lgnustep-base filename.m
error :
gcc: gnustep-config: No such file or directory
cc1obj: error: unrecognized command line option "-fobjc-flags"
When i used "-lgnustep-base" one of my error resolved but what about gnustep-config --objc-flags package...
Please provide me solution ......
hey I found the solution !!!!
just type the command "gnustep-config --objc-flags" in command prompt...
You will get o/p like : " /-MMD -MP -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -D_REENTRANT -fPIC -Wall -DGSWARN -DGSDIAGNOSE -Wno-import -g -O2 -fno-strict-aliasing -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -fgnu-runtime -fconstant-string-class=NSConstantString -I. -I/root/GNUstep/Library/Headers -I/usr/local/include/GNUstep -I/usr/include/GNUstep "
so now you need to copy all this and placed it to the command prompt like this:
"gcc -MMD -MP -DGNUSTEP -DGNUSTEP_BASE_LIBRARY=1 -DGNU_GUI_LIBRARY=1 -DGNU_RUNTIME=1 -DGNUSTEP_BASE_LIBRARY=1 -D_REENTRANT -fPIC -Wall -DGSWARN -DGSDIAGNOSE -Wno-import -g -O2 -fno-strict-aliasing -fexceptions -fobjc-exceptions -D_NATIVE_OBJC_EXCEPTIONS -fgnu-runtime -fconstant-string-class=NSConstantString -I. -I/root/GNUstep/Library/Headers -I/usr/local/include/GNUstep -I/usr/include/GNUstep -o filename -lgnustep-base filename.m "
type all command without any space.......

Make execvp permission denied

I've got a makefile I'm trying to run without too much luck. Here's what happens
I try to make, and it start out ok. It then gives an error that it can't find the file. However, I can do an ls -ld on the file without any problem. Do you have any idea whats going on?
pgr#pgr:~/start_code_1$ make
gcc -Wall -g -m32 -c -fomit-frame-pointer -O2 -fno-builtin bootblock.s
ld -nostartfiles -nostdlib -melf_i386 -Ttext 0x0 -o bootblock bootblock.o
gcc -c -o createimage.o createimage.c
gcc -o createimage createimage.o
gcc -Wall -g -m32 -c -fomit-frame-pointer -O2 -fno-builtin kernel.s
ld -nostartfiles -nostdlib -melf_i386 -Ttext 0x1000 -o kernel kernel.o
./createimage.given --extended ./bootblock ./kernel
make: ./createimage.given: Command not found
make: *** [image] Error 127
pgr#pgr:~/start_code_1$ ls -ld ./createimage.given
-rwxr-xr-x 1 pgr pgr 26110 Sep 16 13:03 ./createimage.given
UPDATED
pgr#pgr:~/workspace/318/bootloader$ file createimage.given
createimage.given: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.2.5, not stripped
UPDATE 2
pgr#pgr:~/phdvdev/workspace/318/bootloader$ ldd createimage.given
not a dynamic executable
Most likely your createimage.given script has wrong interpreter in shebang line. And the chances are it's been edited on windows machine and has trailing carriage return :)

Error when installing Twisted using PIP

4.11 and I'm trying to install Scrapy using either pip or easy_install.
It keeps failing for both, first it failed saying i didnt have gcc-4.0 available, then i used my install cd to install it. Now its popping up with other error(s).
Running setup.py install for Twisted, I receive the following errors in the beginning
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c conftest.c -o conftest.o
conftest.c:1:21: error: rpc/rpc.h: No such file or directory
conftest.c:1:21: error: rpc/rpc.h: No such file or directory
lipo: can't figure out the architecture type of: /var/tmp//ccXYV9xx.out
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c conftest.c -o conftest.o
conftest.c:1:23: error: sys/epoll.h: No such file or directory
conftest.c:1:23: error: sys/epoll.h: No such file or directory
lipo: can't figure out the architecture type of: /var/tmp//cctYFimU.out
building 'twisted.test.raiser' extension
gcc-4.0 -fno-strict-aliasing -fno-common -dynamic -arch ppc -arch i386 -g -O2 -DNDEBUG -g -O3 -I/Library/Frameworks/Python.framework/Versions/2.7/include/python2.7 -c twisted/test/raiser.c -o build/temp.macosx-10.3-fat-2.7/twisted/test/raiser.o
and ends with:
lipo: can't figure out the architecture type of: /var/tmp//ccYXFDmd.out
error: command 'gcc-4.0' failed with exit status 1
I'm new to this all and any help to solve this would be great!
Are you on OS X?
Try this:
sudo env ARCHFLAGS="-arch i386 -arch x86_64" pip install scrapy
Related: trying to install lxml on max osx leopard