Bug report #21583
qgis_map.fcgi on macOS doesn't find libraries
Status: | Open | ||
---|---|---|---|
Priority: | Normal | ||
Assignee: | - | ||
Category: | QGIS Server | ||
Affected QGIS version: | 3.6.0 | Regression?: | No |
Operating System: | macOS | Easy fix?: | No |
Pull Request or Patch supplied: | No | Resolution: | |
Crashes QGIS or corrupts data: | No | Copied to github as #: | 29399 |
Description
I try to run the qgis server via spawn-fcgi on macOS. The server seems to start, but when trying to access the webpage I get an ServerException "Layer(s) not valid"
The server log says:11:26:03 WARNING No Data Providers[53228]: No QGIS data provider plugins found in:
/Applications/QGIS3.6.app/Contents/MacOS/fcgi-bin/../PlugIns/qgis
No vector layers can be loaded. Check your QGIS installation
11:26:04 WARNING No Authentication Methods[53228]: No QGIS auth method plugins found in:
/Applications/QGIS3.6.app/Contents/MacOS/fcgi-bin/../PlugIns/qgis
No authentication methods can be used. Check your QGIS installation
11:26:04 WARNING [53228]: Couldn't load Python support library: Cannot load library /Applications/QGIS3.6.app/Contents/MacOS/fcgi-bin/lib/qgispython: (dlopen(/Applications/QGIS3.6.app/Contents/MacOS/fcgi-bin/lib/libqgispython.dylib, 10): image not found)
It looks like the application is using /Applications/QGIS3.6.app/Contents/MacOS/fcgi-bin
as prefix, when it should use /Applications/QGIS3.6.app/Contents/MacOS
- i.e. the library it tries to load (/Applications/QGIS3.6.app/Contents/MacOS/fcgi-bin/lib/libqgispython.dylib
) is in /Applications/QGIS3.6.app/Contents/MacOS/lib/libqgispython.dylib
History
#1 Updated by Alessandro Pasotti over 5 years ago
try to set the env var QGIS_PREFIX_PATH and point it to the base directory where QGIS libraries are (on Linux is "/usr" by default).
#2 Updated by Arno Lepisk over 5 years ago
with QGIS_PREFIX_PATH
set to /Applications/QGIS3.6.app/Contents/MacOS/
I get a bit further, but then get these warnings:11:51:33 WARNING [53420]: Failed to load library /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libdummy.so: Cannot load library /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libdummy.so: (dlopen(/Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libdummy.so, 5): Library not loaded: @loader_path/../lib/libqgis_server.3.6.0.dylib
Referenced from: /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libdummy.so
Reason: image not found)
11:51:33 WARNING [53420]: Failed to load library /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwcs.so: Cannot load library /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwcs.so: (dlopen(/Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwcs.so, 5): Library not loaded: @loader_path/../lib/libqgis_server.3.6.0.dylib
Referenced from: /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwcs.so
Reason: image not found)
11:51:33 WARNING [53420]: Failed to load library /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwfs.so: Cannot load library /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwfs.so: (dlopen(/Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwfs.so, 5): Library not loaded: @loader_path/../lib/libqgis_server.3.6.0.dylib
Referenced from: /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwfs.so
Reason: image not found)
11:51:33 WARNING [53420]: Failed to load library /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwms.so: Cannot load library /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwms.so: (dlopen(/Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwms.so, 5): Library not loaded: @loader_path/../lib/libqgis_server.3.6.0.dylib
Referenced from: /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwms.so
Reason: image not found)
11:51:33 WARNING [53420]: Failed to load library /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwmts.so: Cannot load library /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwmts.so: (dlopen(/Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwmts.so, 5): Library not loaded: @loader_path/../lib/libqgis_server.3.6.0.dylib
Referenced from: /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwmts.so
Reason: image not found)
and requesting /qgisserver?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities
gives me<ServiceExceptionReport version="1.3.0">
<ServiceException code="Service configuration error">Service unknown or unsupported</ServiceException>
</ServiceExceptionReport>
#3 Updated by Giovanni Manghi over 5 years ago
and requesting
/qgisserver?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities
gives me<ServiceExceptionReport version="1.3.0">
<ServiceException code="Service configuration error">Service unknown or unsupported</ServiceException>
</ServiceExceptionReport>
this is correct, you need to add the "map" parameter, and eventually the "service" and the "request" one
http://ip/cgi-bin/qgis_mapserv.fcgi?map=/path/to/project.qgs&service=WMS&request=GetCapabilities
#4 Updated by Giovanni Manghi over 5 years ago
- Status changed from Open to Feedback
- Category changed from Browser to QGIS Server
#5 Updated by Arno Lepisk over 5 years ago
I have set the map parameter with an environment variable (QGIS_PROJECT_FILE
)
The server log says 12:34:15 INFO Server[53632]: ******************** New request ***************
12:34:15 INFO Server[53632]: SERVER_NAME: localhost
12:34:15 INFO Server[53632]: REQUEST_URI: /qgisserver?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities
12:34:15 INFO Server[53632]: REMOTE_ADDR: 127.0.0.1
12:34:15 INFO Server[53632]: CONTENT_TYPE:
12:34:15 INFO Server[53632]: HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:65.0) Gecko/20100101 Firefox/65.0
12:34:15 INFO Server[53632]: REQUEST:GetCapabilities
12:34:15 INFO Server[53632]: SERVICE:WMS
12:34:15 INFO Server[53632]: VERSION:1.3.0
12:34:16 WARNING [53632]: Service WMS is not registered
12:34:16 INFO Server[53632]: Request finished in 785 ms
Probably as the wms library failed to load12:33:47 WARNING [53632]: Failed to load library /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwms.so: Cannot load library /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwms.so: (dlopen(/Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwms.so, 5): Library not loaded: @loader_path/../lib/libqgis_server.3.6.0.dylib
Referenced from: /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwms.so
Reason: image not found)
#6 Updated by Giovanni Manghi over 5 years ago
Arno Lepisk wrote:
I have set the map parameter with an environment variable (
QGIS_PROJECT_FILE
)
The server log says12:34:15 INFO Server[53632]: ******************** New request ***************
12:34:15 INFO Server[53632]: SERVER_NAME: localhost
12:34:15 INFO Server[53632]: REQUEST_URI: /qgisserver?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities
12:34:15 INFO Server[53632]: REMOTE_ADDR: 127.0.0.1
12:34:15 INFO Server[53632]: CONTENT_TYPE:
12:34:15 INFO Server[53632]: HTTP_USER_AGENT: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.14; rv:65.0) Gecko/20100101 Firefox/65.0
12:34:15 INFO Server[53632]: REQUEST:GetCapabilities
12:34:15 INFO Server[53632]: SERVICE:WMS
12:34:15 INFO Server[53632]: VERSION:1.3.0
12:34:16 WARNING [53632]: Service WMS is not registered
12:34:16 INFO Server[53632]: Request finished in 785 ms
Probably as the wms library failed to load12:33:47 WARNING [53632]: Failed to load library /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwms.so: Cannot load library /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwms.so: (dlopen(/Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwms.so, 5): Library not loaded: @loader_path/../lib/libqgis_server.3.6.0.dylib
Referenced from: /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server/libwms.so
Reason: image not found)
the url needs a "map" paramter pointing to a QGIS project, does it makes any difference if you add it?
#7 Updated by Alessandro Pasotti over 5 years ago
Giovanni Manghi wrote:
and requesting
/qgisserver?SERVICE=WMS&VERSION=1.3.0&REQUEST=GetCapabilities
gives me<ServiceExceptionReport version="1.3.0">
<ServiceException code="Service configuration error">Service unknown or unsupported</ServiceException>
</ServiceExceptionReport>this is correct, you need to add the "map" parameter, and eventually the "service" and the "request" one
http://ip/cgi-bin/qgis_mapserv.fcgi?map=/path/to/project.qgs&service=WMS&request=GetCapabilities
Actually: that is NOT correct, the error message when MAP is missing is different. "Service unknown or unsupported" means that the SERVICE is missing or wrong, in this case it is NOT missing or wrong, but the library that provides WMS service was not loaded.
#8 Updated by Arno Lepisk over 5 years ago
- Status changed from Feedback to Open
Removing the environment variable and providing a MAP parameter doesn't make a difference (omitting the parameter on the other hand gives an expected "Project file error")
#9 Updated by Alessandro Pasotti over 5 years ago
So, the problem is that QGIS server cannot find and load the libraries that implement the services (wms, wfs etc. etc.).
On linux they are in:
/usr/lib/qgis/server:
libdummy.so libwcs.so libwfs.so libwms.so libwmts.so
I'm sorry bu I'm no mac developer and I've no idea if the libraries are actually missing or if they are just in the wrong place...
#10 Updated by Arno Lepisk over 5 years ago
They aren't missing, they are in /Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/server
The problem seems to be that the libraries they need have wrong paths in the library files.
I actually got it working by adding two symlinks:/Applications/QGIS3.6.app/Contents/MacOS/lib/qgis/lib -> ../../lib
/Applications/QGIS3.6.app/Contents/MacOS/lib/Frameworks -> ../../Frameworks