Monday, September 14, 2020

MacOS High Sierra: Security going against the developer

The first major roadblock I faced was getting Vulkan to compile, install, and run on MacOS so that I could test with Gateware. This Vulkan install would make developing on iOS much easier for the graphics libraries, as much of the same code could be used with MacOS. The main problem was security, or rather user permissions. As of MacOS High Sierra, the user no longer has permission to write to the "/usr/local" directory. Vulkan uses a Python script to install to your local machine, and this script assumes a few things, one, that you already have a couple of folders made in the "/usr/local" directory, and that those directories can be written to by a user.

The solution that I ended up using was not a very clean one. I had run the script many times, looking out for the error messages, and changed my folder structure and user permissions until I got the installer to install Vulkan. First the installer wanted a folder at the directory "/usr/local/include" to be created, but there is a problem, the average user cannot make folders in the "/usr/local/" directory. So I had to change the permissions to allow myself to change the folder structure there. I ended up creating the folder and when I ran the Vulkan installer again, I found that it wanted more folders to be created, first the "include" folder, then the "library" folder, then the "bin" folder, and so on. These errors would only appear one at a time, after I created each folder. So the process went like so: Run the installer and see what folder needed to be created next, then create the folder, and repeat for every folder that the installer will make in the "/usr/local/" directory. After all of the folders were created, then the installer would give errors such as "/usr/local/library/ directory permission denied" and I had to change the permission level of all of the folders that I just created. Eventually I had every folder created and Vulkan would then finally install properly. All that was left was to build and run Gateware and get the Unit Tests working on Mac. 

Overall this experience has taught me a lot about the permission system on Unix based machines. I did not know much about it until this experience requiring me to go and research many commands to do what I needed to do. Getting Vulkan on MacOS should enable me to develop graphics libraries on iOS much easier, as I wouldn't have to write a new graphics library from scratch. Now I should be able to reuse at least some of the code from the MacOS implementation of Vulkan to get things going.

No comments:

Post a Comment