<div dir="ltr">Hi Chris,<br><div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Oct 10, 2013 at 4:14 PM, Chris Nicholas <span dir="ltr"><<a href="mailto:chrisgnicholas@att.net" target="_blank">chrisgnicholas@att.net</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="font-size:10pt;font-family:times new roman,new york,times,serif"><div>hi - wondering if anyone has actually gotten the 2.1 qgis_server stuff to work on MAC/OSX ...</div>

<div><br></div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:times new roman,new york,times,serif">I've gotten it to work on Ubuntu like a champ, and oh-so-close on OSX ... </div>

<div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:times new roman,new york,times,serif"><br></div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:times new roman,new york,times,serif">

I followed all the directions at:</div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:times new roman,new york,times,serif"><a href="http://hub.qgis.org/projects/quantum-gis/wiki/QGIS_Server_Tutorial" target="_blank">http://hub.qgis.org/projects/quantum-gis/wiki/QGIS_Server_Tutorial</a><br>

</div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:times new roman,new york,times,serif"><br></div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:times new roman,new york,times,serif">

nothing worked at first;  I tried to to unravel things using dtrace(1) to see what it was looking for, and for some reason, either hard-coded or by defaults, it looks for a lot of stuff  in "/Users/larrys/ ..."</div>

<div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:times new roman,new york,times,serif"><br></div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:times new roman,new york,times,serif">

so, I put in a symlink from /Users/larrys/QGIS/nightly/QGIS_Apps/QGIS_2.1-dev.app -> /Applications/QGIS_2.1-dev.app , and since it was apparently built in debug mode, the QGIS_LOG_FILE shows it actually rendering things to /private .</div>

</div></div></blockquote><div><br></div><div>This is an oversight on my part with regards to a hard-coded path (CMAKE_INSTALL_PREFIX, saved in qgisconf.h) established during the build process. This is then referenced in qgis_map_serv.cpp and used if the environment variable QGIS_PREFIX_PATH is not set [0].<br>
<br></div><div>For the nightly builds, in qgisconf.h, it is:<br>#define CMAKE_INSTALL_PREFIX "/Users/larrys/QGIS/nightly/QGIS_Apps/QGIS_2.1-dev.app/Contents/MacOS"<br><br></div><div>since I (obviously) do not install the nightly to /Applications. Ideally, Mac apps should be able to move about the filesystem and still function. This is the only hard-coded path remaining, that I know of. So, the fix is to set QGIS_PREFIX_PATH *before* qgis_mapserv.fcgi is spawned at Apache launch. To do this I adjusted FastCgiConfig:<br>
<br><IfModule mod_fastcgi.c><br>  SetEnv QGIS_LOG_FILE /test-projects/qgis_wms_server.log<br>  FastCgiConfig -appConnTimeout 60 -idle-timeout 60 \<br>  -init-start-delay 1 -startDelay 5 -minProcesses 2 -maxClassProcesses 20 \<br>
  -initial-env QGIS_PREFIX_PATH=/Users/larrys/Applications/QGIS_2.1-dev.app/Contents/MacOS \<br>  -initial-env DYLD_FRAMEWORK_PATH=/Users/larrys/Applications/QGIS_2.1-dev.app/Contents/Frameworks<br></div><div>  ... more config ...<br>
</IfModule><br><br></div><div>Couple of things to note about this config:<br><br>* Notice QGIS_LOG_FILE env var is set at the Apache 
level, not for, or passed to, the FCGI process, where (for some reason) 
it doesn't work. QGIS has to be a debug variant build for output to file.<br><br>* /Users/larrys/Applications/QGIS_2.1-dev.app is where my download of the nightly resides - denoted even though the qgis_mapserv.fcgi binary is inside it. I now know of some Mac-specific C++ code to find the absolute path to a launched binary (from inside itself) and can probably nix the need for setting QGIS_PREFIX_PATH in the future.<br>
<br>* DYLD_FRAMEWORK_PATH is set because I have several versions/installs of Qt on my Mac. When dynamically loading Qt frameworks, you will often see warnings or errors about multiple copies being found and maybe get a crash. Use DYLD_FRAMEWORK_PATH to append the app's embedded Qt frameworks' path. These errors can also occur when the PyQt4 modules used by QGIS and QGIS itself differ in found Qt frameworks as well. ANY Qt framework in a standard location, beyond that found in the app, will cause the issue.<br>
<br></div><div>* DYLD_FRAMEWORK_PATH is still necessary if you are using the qgis_mapserv.fcgi binary directly from the build directory of a locally built QGIS source, and you have multiple Qt installs, as noted above.<br>
<br>These fixes should not be needed with a standard Kyngchaos.com QGIS.app 
install into /Applications, unless maybe you move the .app bundle, or have extra Qt installs.<br><br></div><div>Also of note, you should not move the qgis_mapserv.fcgi binary out of the QGIS.app bundle, as it links to many resources/libs from that location. You can set its directory up in Apache, a la the Server Tutorial [1], or symlink it to a fcgi-bin and set 'Options FollowSymLinks' for the fcgi-bin directory. However, you *can* relocate/copy the qgis_mapserv.fcgi binary from the <build>/output/bin directory, as it is not bundle-specific, just be sure to adjust the env vars to non-bundle resources accordingly, if necessary.<br>
<br></div><div>Finally, after getting Server to work from the relocated nightly bundle, I noticed there seems to be a rendering issue with latest master, where layers would randomly not show up. It is unrelated to this issue because it happens on other installs as well.<br>
<br></div><div>Please let me know if your test results differ. I will be adding these notes to the nightly download site, its README, and probably the Server tutorial page.<br></div><div><br>[0] <a href="https://github.com/qgis/QGIS/blob/master/src/mapserver/qgis_map_serv.cpp#L163">https://github.com/qgis/QGIS/blob/master/src/mapserver/qgis_map_serv.cpp#L163</a><br>
[1] <a href="http://hub.qgis.org/projects/quantum-gis/wiki/QGIS_Server_Tutorial">http://hub.qgis.org/projects/quantum-gis/wiki/QGIS_Server_Tutorial</a></div><div><br></div><div>Regards,<br></div><div><br>Larry Shaffer<br>

Dakota Cartography<br>Black Hills, South Dakota<br> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div><div style="font-size:10pt;font-family:times new roman,new york,times,serif">

<div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:times new roman,new york,times,serif">rc/core/qgsmaprenderer.cpp: 625: (render) Done rendering map layers<br>rc/core/qgsvectorlayer.cpp: 328: (drawLabels) Starting draw of labels: world_shapes20130924190607981<br>

rc/core/qgsmaprenderer.cpp: 692: (render) Rendering completed in (seconds): 0.021<br>rc/mapserver/qgswmsserver.cpp: 689: (getMap) clearing
 filters<br>rc/mapserver/qgis_map_serv.cpp: 554: (main) Sending GetMap response<br>rc/mapserver/qgshttprequesthandler.cpp: 96: (sendGetMapResponse) Sending getmap response...<br>rc/mapserver/qgshttprequesthandler.cpp: 45: (sendHttpResponse) Checking byte array is ok to send...<br>

rc/mapserver/qgis_map_serv.cpp: 556: (main) Response sent<br></div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:times new roman,new york,times,serif"><br></div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:times new roman,new york,times,serif">

But for some reason, at the very end, I get a 500 error ...  :-(</div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:times new roman,new york,times,serif"><br></div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:times new roman,new york,times,serif">

comment/suggestions/RTFMs welcomed!</div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:times new roman,new york,times,serif"><br></div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:times new roman,new york,times,serif">

thanks - <br></div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:times new roman,new york,times,serif">Chris<br></div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:times new roman,new york,times,serif">

<br></div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:times new roman,new york,times,serif"><br></div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:times new roman,new york,times,serif">

<br></div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:times new roman,new york,times,serif"><br></div><div style="font-style:normal;font-size:13.3333px;background-color:transparent;font-family:times new roman,new york,times,serif">

</div></div></div><br>_______________________________________________<br>
Qgis-user mailing list<br>
<a href="mailto:Qgis-user@lists.osgeo.org" target="_blank">Qgis-user@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/qgis-user" target="_blank">http://lists.osgeo.org/mailman/listinfo/qgis-user</a><br></blockquote></div><br></div></div></div>