<div dir="ltr"><div style="border-left:none;padding:0px;display:flex;font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif;font-size:medium"><div style="margin:0px;padding:0px 0px 20px;width:758px"><div style="overflow-wrap: break-word;"><div id="gmail-m_2149023992514511700gmail-:qfe" style="font-size:0.875rem;direction:ltr;margin:8px 0px 0px;padding:0px"><div id="gmail-m_2149023992514511700gmail-:qfd" style="overflow:visible hidden;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;line-height:1.5;font-family:Arial,Helvetica,sans-serif;padding-right:32px"><div dir="ltr" style="overflow-wrap: break-word;">This going to be a relatively long email probably only of interest to a few people .. so <br style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;">TL;DR<br style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;">- I want to create a Conda Forge package for the C# bindings. Should I create an RFC for that?<br style="overflow-wrap: break-word;">- Can anyone help with the error running the C# bindings on Mac and Linux (see RUNTIME ERROR about halfway down)<div style="overflow-wrap: break-word;">- Can anyone help with the compilation issues - particularly around <a href="http://libgdal.la/" target="_blank" style="overflow-wrap: break-word;">libgdal.la</a> (See COMPILE TIME PROBLEMS at the bottom)</div><div style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;"></div><div style="overflow-wrap: break-word;">BACKGROUND</div><div style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;"></div><div style="overflow-wrap: break-word;">I needed to get more experience of the C# bindings and particularly need to work out a way to get them built correctly for Linux and OSX. I decided to do the experimentation in Conda-Build because it is the preferred solution for GDAL and for my project and I know it.<br style="overflow-wrap: break-word;"> </div><div style="overflow-wrap: break-word;">This was partly motivated by HoBu's previous comments about separating out the bindings from the main package - this was a sort of investigation of the concept.<br style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;">I would actually like to take this and create a Conda-Forge package for the C# bindings. Does this make sense? Should I push that through an RFC? The build scripts I have at the moment are no more than proof of concept. There is a lot of work to do to productize them (including the issues listed at the bottom).<br style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;">It is also true that while Conda is a natural choice for doing GDAL based compilation (i.e. creating the DLLs) it is not the natural choice for .NET or Mono distribution. I think that a little work will get around that.<br style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;"><b style="overflow-wrap: break-word;">WINDOWS </b></div><div style="overflow-wrap: break-word;">I repurposed the GDAL conda build scripts as follows  based on <a href="https://trac.osgeo.org/gdal/wiki/GdalOgrCsharpCompile" target="_blank" style="overflow-wrap: break-word;">the docs:</a><br style="overflow-wrap: break-word;"><a href="https://github.com/ViRGIS-Team/staged-recipes/blob/master/recipes/Gdal_CSharp/meta.yaml" target="_blank" style="overflow-wrap: break-word;">meta.yml</a></div><div style="overflow-wrap: break-word;"><a href="https://github.com/ViRGIS-Team/staged-recipes/blob/master/recipes/Gdal_CSharp/bld.bat" target="_blank" style="overflow-wrap: break-word;">build.bat</a></div><div style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;"></div><div style="overflow-wrap: break-word;">This <b style="overflow-wrap: break-word;">works well</b> for Windows and I am getting DLLs that work.<br style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;"><b style="overflow-wrap: break-word;">MAC / LINUX</b><br style="overflow-wrap: break-word;">I used the same approach for mac/ linux although there is no docs onthe Gdal side on these platforms.<br style="overflow-wrap: break-word;"><a href="https://github.com/ViRGIS-Team/staged-recipes/blob/master/recipes/Gdal_CSharp/meta.yaml" target="_blank" style="overflow-wrap: break-word;">meta.yml</a> (same as above)<br style="overflow-wrap: break-word;"></div><div style="overflow-wrap: break-word;"><a href="https://github.com/ViRGIS-Team/staged-recipes/blob/master/recipes/Gdal_CSharp/build.sh" target="_blank" style="overflow-wrap: break-word;">build.sh</a></div><div style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;"></div><div style="overflow-wrap: break-word;">After some fiddling (see below) I have this working on both platforms  and it <b style="overflow-wrap: break-word;">produces all of the files that it is supposed</b> ... BUT<br style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;"><b style="overflow-wrap: break-word;">RUNTIME PROBLEM :</b><br style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;">I can create and successfully compile a mono app using GDAL classes and the GDAL DLL wrapper initializes but fails with errors like <br style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;"><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">Unhandled Exception:</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">System.EntryPointNotFoundException: CSharp_OSGeofGDAL_UseExceptions___ assembly:<unknown assembly> type:<unknown type> member:(null)</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><span style="overflow-wrap: break-word;">  </span>at (wrapper managed-to-native) OSGeo.GDAL.GdalPINVOKE.UseExceptions()</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><span style="overflow-wrap: break-word;">  </span>at OSGeo.GDAL.Gdal.UseExceptions () [0x00001] in <032df0f4cffc4438b8ab5d2bc8d96a7e>:0<span style="overflow-wrap: break-word;"> </span></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><span style="overflow-wrap: break-word;">  </span>at testapp.Program.Main (System.String[] args) [0x0000a] in <2cfd8628af524a47a3df8aa28348af7f>:0<span style="overflow-wrap: break-word;"> </span></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures">[ERROR] FATAL UNHANDLED EXCEPTION: System.EntryPointNotFoundException: CSharp_OSGeofGDAL_UseExceptions___ assembly:<unknown assembly> type:<unknown type> member:(null)</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><span style="overflow-wrap: break-word;">  </span>at (wrapper managed-to-native) OSGeo.GDAL.GdalPINVOKE.UseExceptions()</span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><span style="overflow-wrap: break-word;">  </span>at OSGeo.GDAL.Gdal.UseExceptions () [0x00001] in <032df0f4cffc4438b8ab5d2bc8d96a7e>:0<span style="overflow-wrap: break-word;"> </span></span></p><p style="margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0)"><span style="font-variant-ligatures:no-common-ligatures"><span style="overflow-wrap: break-word;">  </span>at testapp.Program.Main (System.String[] args) [0x0000a] in <2cfd8628af524a47a3df8aa28348af7f>:0<span style="overflow-wrap: break-word;"> </span></span></p><br style="overflow-wrap: break-word;">This is actually not surprising - since if I run dependency Walker on Mac I get something like this (look at the EntryPOint highlighted)</div><div style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;"></div><div style="overflow-wrap: break-word;"><img src="cid:ii_kndcamyf0" alt="Screenshot 2021-04-10 at 16.38.44-min.png" width="500" height="200"><span style="font-size:0.875rem"></span><br></div><div style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;"></div><div style="overflow-wrap: break-word;"><span style="overflow-wrap: break-word;">But on Windows I get this (which matches the request listed in the error message<br style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;"></span><img src="cid:ii_kndcbnab1" alt="Screenshot (52)-min.png" width="542" height="125"><br><span style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;">It looks like SWIG on Mac / Linix is building the library without the namespace? Does anyone have any ideas where I should be looking to solve this problem.<br style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;"><b style="overflow-wrap: break-word;">COMPILE TIME PROBLEMS</b><br style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;">There are also a couple of compile-time problems that I could do with some help with :<br style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;">- At the moment the csharp makefiles seem to be hardcoded about where to look for the gdal include files so in each case I have to copy the Conda distributables to the place where the makefile expects them to be. Is there a way to put the makefile directly at the Conda env. Is there a way to do this? I could not find anything.<br style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;">- More seriously, on mac & Linux the compile script needs the <a href="http://libgdal.la/" target="_blank" style="overflow-wrap: break-word;">libgdal.la</a> file and this is not distributed in the Conda package. To make this work - I had to run a complete GDAl compile on each platform to get a copy of the <a href="http://libgdal.la/" target="_blank" style="overflow-wrap: break-word;">libgdal.la</a> file and manually add that to the csharp build package. That is not a production-ready approach! Does anyone know a way around this?</span></div><div style="overflow-wrap: break-word;"><span style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;"></span></div><div style="overflow-wrap: break-word;"><span style="overflow-wrap: break-word;">If you got this far - thanks for your time</span></div><font color="#888888" style="overflow-wrap: break-word;"><font color="#888888" style="overflow-wrap: break-word;"><div style="overflow-wrap: break-word;"><span style="overflow-wrap: break-word;"><br style="overflow-wrap: break-word;"></span></div><div style="overflow-wrap: break-word;"><span style="overflow-wrap: break-word;">P</span></div></font></font></div><div class="gmail-yj6qo" style="overflow-wrap: break-word;"></div><div class="gmail-adL" style="overflow-wrap: break-word;"></div><div class="gmail-adL" style="overflow-wrap: break-word;"></div></div></div><div class="gmail-adL" style="border-bottom-left-radius:1px;border-bottom-right-radius:1px;padding:0px;width:auto;background:rgb(242,242,242);margin:0px"></div></div></div><div class="gmail-adL" style="clear:both"></div></div><div class="gmail-adL" style="font-size:0.875rem;padding:0px 0px 16px;width:auto;border-bottom-left-radius:0px;border-bottom-right-radius:0px;border-top:none;margin:0px;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;font-family:Roboto,RobotoDraft,Helvetica,Arial,sans-serif"><div style="border-top:0px;padding:0px"><div style="clear:both;margin:0px;padding:16px 0px;border-top:none"><br style="overflow-wrap: break-word;"></div></div></div></div>