[pdal] Trouble compiling PDAL with MATLAB Plugin on Mac OS
Patrick Rennich
patrick.rennich at aloftsensing.com
Tue Jun 4 08:00:57 PDT 2024
Ok, so here’s what I had to do to get things to compile with BUILD_PLUGIN_MATLAB=ON on macOS:
1. In matlab.cmake, I commented out the find_library(Matlab REQUIRED) directive.
2. Replaced FindMatlab.cmake with the latest version from https://github.com/Kitware/CMake/
3. Added FindPackageHandleStandardArgs.cmake and FindPackageMessage.cmake also from https://github.com/Kitware/CMake/
The command
% cmake -G Ninja -DBUILD_PLUGIN_MATLAB=ON ..
now finds and configures things properly, and ninja builds the executables. I tested by modifying the “Reading data from EPT” tutorial to write to a MAT file instead of a GeoTIFF and then loaded this file into Matlab.
Success!
Patrick
From: Patrick Rennich <patrick.rennich at aloftsensing.com>
Date: Monday, June 3, 2024 at 11:55 AM
To: pdal at lists.osgeo.org <pdal at lists.osgeo.org>
Cc: karney at alum.mit.edu <karney at alum.mit.edu>, Charles Karney <charles.karney at gmail.com>, Andrew Bell <andrew.bell.ia at gmail.com>
Subject: Re: [pdal] Trouble compiling PDAL with MATLAB Plugin on Mac OS
Makes sense. I’ll debug on my end and report back when fixed.
From: Andrew Bell <andrew.bell.ia at gmail.com>
Date: Monday, June 3, 2024 at 11:45 AM
To: Patrick Rennich <patrick.rennich at aloftsensing.com>
Cc: karney at alum.mit.edu <karney at alum.mit.edu>, pdal at lists.osgeo.org <pdal at lists.osgeo.org>, Charles Karney <charles.karney at gmail.com>
Subject: Re: [pdal] Trouble compiling PDAL with MATLAB Plugin on Mac OS
This doesn't seem to have anything to do with PDAL, so I would do the normal debug process of making a simple reproducer. In this case that means using the most basic CMakeLists.txt that requires matlab and debug that. If you can recreate the error with something simple, you should be able to ask questions elsewhere to resolve the issue of go through it until you can figure it out.
On Mon, Jun 3, 2024 at 11:07 AM Patrick Rennich via pdal <pdal at lists.osgeo.org<mailto:pdal at lists.osgeo.org>> wrote:
Thanks for the pointers. I pulled the latest FindMatlab.cmake from the cmake repository. This latest file has updates for Matlab 2024a which is what I’m using, but it doesn’t seem to help. I still get the same error.
Patrick
From: pdal <pdal-bounces at lists.osgeo.org<mailto:pdal-bounces at lists.osgeo.org>> on behalf of Charles Karney via pdal <pdal at lists.osgeo.org<mailto:pdal at lists.osgeo.org>>
Date: Monday, June 3, 2024 at 10:50 AM
To: pdal at lists.osgeo.org<mailto:pdal at lists.osgeo.org> <pdal at lists.osgeo.org<mailto:pdal at lists.osgeo.org>>
Cc: Charles Karney <charles.karney at gmail.com<mailto:charles.karney at gmail.com>>
Subject: Re: [pdal] Trouble compiling PDAL with MATLAB Plugin on Mac OS
Note well that the error is occurring in find_library(Matlab REQUIRED)
before it gets to find_package. (But I don't know why find_library
is needed in addition to find_package.)
On 6/3/24 10:34, Howard Butler via pdal wrote:
> I also no longer have access to Matlab but I remember the Find logic
> being extra finicky on MacOS with the frameworks and weird OSXisms that
> are possible. It might also be worth it to track down a more recent
> FindMatlab.cmake file out there.
>
>> On Jun 3, 2024, at 8:48 AM, Andrew Bell via pdal
>> <pdal at lists.osgeo.org<mailto:pdal at lists.osgeo.org>> wrote:
>>
>> I have no access to Matlab and I don't know who does at this point.
>>
>> Looking at the FindMatlab file, you might try just setting
>> Matlab_ROOT_DIR and lose the defines for the specific libraries. :shrug:
>>
>> On Mon, Jun 3, 2024 at 9:41 AM Patrick Rennich via pdal
>> <pdal at lists.osgeo.org<mailto:pdal at lists.osgeo.org> <mailto:pdal at lists.osgeo.org>> wrote:
>>
>> Hello,____
>>
>> ____
>>
>> I’m having trouble compiling PDAL from source on Mac OS when
>> turning on the BUILD_MATLAB_PLUGIN=ON. PDAL compiles fine without
>> this, but when I execute cmake as follows:____
>>
>> ____
>>
>> cmake -G Ninja -DBUILD_PLUGIN_MATLAB=ON
>> -DMatlab_MX_LIBRARY=/Applications/MATLAB_R2024a.app/bin/maca64
>> -DMatlab_MAT_LIBRARY=/Applications/MATLAB_R2024a.app/bin/maca64
>> -DMatlab_ENG_LIBRARY=/Applications/MATLAB_R2024a.app/bin/maca64
>> -DMatlab_INCLUDE_DIRS=/Applications/MATLAB_R2024a.app/extern/include ..____
>>
>> ____
>>
>> I get the following error message:____
>>
>> ____
>>
>> CMake Error at cmake/matlab.cmake:4 (find_library):____
>>
>> Could not find Matlab using the following names:____
>>
>> Call Stack (most recent call first):____
>>
>> plugins/matlab/CMakeLists.txt:3 (include)____
>>
>> ____
>>
>> Let me know if there’s any other info I can provide, and any help
>> is much appreciated. Thanks.____
>>
>> __ __
>>
>> __ __
>>
>> Patrick
_______________________________________________
pdal mailing list
pdal at lists.osgeo.org<mailto:pdal at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/pdal
_______________________________________________
pdal mailing list
pdal at lists.osgeo.org<mailto:pdal at lists.osgeo.org>
https://lists.osgeo.org/mailman/listinfo/pdal
--
Andrew Bell
andrew.bell.ia at gmail.com<mailto:andrew.bell.ia at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/pdal/attachments/20240604/fb056115/attachment-0001.htm>
More information about the pdal
mailing list