Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

`Cannot open include file: 'apr_perms_set.h'` when doing `pip install mod_wsgi`

I am trying to roll out a production Django environment on Windows 10 with Apache 2.4.37 x64 OpenSSL 1.1.1 VC14 from ApacheHaus. However, when following these instructions, I'm getting the following error:

  C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\bin\HostX86\x64\cl.exe /c /nologo /Ox /W3 /GL /DNDEBUG /MD -ID:/Servers/Web/Apache/Apache24/include -Ic:\programs\python37\include -Ic:\programs\python37\include "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\ATLMFC\include" "-IC:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.16.27023\include" "-IC:\Program Files (x86)\Windows Kits\NETFXSDK\4.6.1\include\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\ucrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\shared" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\um" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\winrt" "-IC:\Program Files (x86)\Windows Kits\10\include\10.0.17763.0\cppwinrt" /Tcsrc/server\mod_wsgi.c /Fobuild\temp.win-amd64-3.7\Release\src/server\mod_wsgi.obj
  mod_wsgi.c
  d:\servers\web\apache\apache24\include\apr_network_io.h(29): fatal error C1083: Cannot open include file: 'apr_perms_set.h': No such file or directory
  error: command 'C:\\Program Files (x86)\\Microsoft Visual Studio\\2017\\Community\\VC\\Tools\\MSVC\\14.16.27023\\bin\\HostX86\\x64\\cl.exe' failed with exit status 2

  ----------------------------------------
  Failed building wheel for mod-wsgi

I see the following options to C/C++ compiler: -ID:/Servers/Web/Apache/Apache24/include -Ic:\programs\python37\include . So it seems include file apr_perms_set.h is missing from Apache or Python.

How to fix this error with the correct versions of the include files? I'm afraid it's wrong to just take the latest version from a repository because it may not match what's Apache or mod-wsgi expect.

like image 348
Serge Rogatch Avatar asked Jan 19 '19 15:01

Serge Rogatch


2 Answers

I had similar error on Windows Server 2016, when trying to use Apache 2.4 64bit with Python 2.7. Apparently apr header files were missing. I was able to solve it by:

  • making sure I have both Apache and Python 64bit (guess it'll be valid for 32bit as well) installing VC++ Redistributable - of course 64bit in my case
  • downloading Apache Runtime (apr) headers from APR project website
  • copying missing header file from downloaded sources into Apache's include folder
  • installing mod_wsgi with pip install mod_wsgi (inside my virtual environment).
like image 78
Gabriel M Avatar answered Oct 13 '22 01:10

Gabriel M


The distribution from The Apache Haus does not include the aforementioned header file for some strange reason. Try using the distribution from Apache Lounge, it should contain all header files needed to compile mod_wsgi (tested with httpd-2.4.41-win32-VS16.zip).

like image 45
szrg Avatar answered Oct 13 '22 02:10

szrg