VulkanSceneGraph icon indicating copy to clipboard operation
VulkanSceneGraph copied to clipboard

Build is broken on MacOS

Open artemkulyk opened this issue 3 years ago • 7 comments

Describe the bug PR #635, CL 14b6e7df63cf8f77bd3f4a493f9662bc9b5d77f4 broke MacOS build.

FAILED: src/vsg/CMakeFiles/vsg.dir/io/FileSystem.cpp.o /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ -DGLSLANG_EShLangRayGen -DGLSLANG_ResourceLimits_maxDualSourceDrawBuffersEXT -DGLSLANG_ResourceLimits_maxMeshViewCountEXT -I/Users/artemkulyk/VulkanSceneGraph/VulkanSceneGraph/include -I/Users/artemkulyk/VulkanSceneGraph/VulkanSceneGraph/cmake-build-debug/include -isystem /usr/local/include -g -arch arm64 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX13.0.sdk -fPIC -fcolor-diagnostics -std=gnu++17 -MD -MT src/vsg/CMakeFiles/vsg.dir/io/FileSystem.cpp.o -MF src/vsg/CMakeFiles/vsg.dir/io/FileSystem.cpp.o.d -o src/vsg/CMakeFiles/vsg.dir/io/FileSystem.cpp.o -c /Users/artemkulyk/VulkanSceneGraph/VulkanSceneGraph/src/vsg/io/FileSystem.cpp /Users/artemkulyk/VulkanSceneGraph/VulkanSceneGraph/src/vsg/io/FileSystem.cpp:120:19: error: variable has incomplete type 'struct stat64' struct stat64 stbuf; ^ /Users/artemkulyk/VulkanSceneGraph/VulkanSceneGraph/src/vsg/io/FileSystem.cpp:120:12: note: forward declaration of 'stat64' struct stat64 stbuf; ^ 1 error generated.

To Reproduce Steps to reproduce the behavior: cmake && make on MacOS

Expected behavior Successful build

Desktop (please complete the following information):

  • OS: Mac OS Ventura
  • HW: Apple Silicon (M1)
  • Compiler: Apple clang version 14.0.0 (clang-1400.0.29.202)
  • Target: arm64-apple-darwin22.1.0
  • MoltenVK Vulkan SDK 1.3.231
  • VulkanSceneGraph master

Additional context See build logs below. build.log

artemkulyk avatar Dec 08 '22 20:12 artemkulyk

The macOS automated build succeeds but I see a warning:

https://github.com/vsg-dev/VulkanSceneGraph/actions/runs/3651070236/jobs/6167843268

/Users/runner/work/VulkanSceneGraph/VulkanSceneGraph/src/vsg/io/FileSystem.cpp:121:9: warning: 'stat64' is deprecated: first deprecated in macOS 10.6 [-Wdeprecated-declarations] if (stat64(path.c_str(), &stbuf) != 0 ) return FILE_NOT_FOUND; ^ /Applications/ Xcode_13.2.1.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.1.sdk/usr/include/sys/stat.h:427:9: note: 'stat64' has been explicitly marked deprecated here int stat64(const char *, struct stat64 *) __OSX_AVAILABLE_BUT_DEPRECATED(__MAC_10_5, __MAC_10_6, __IPHONE_NA, __IPHONE_NA);

I presume you are compiling without support for deprecated APIs.

--

Is there a recommended alternative to using the posix stat64?

robertosfield avatar Dec 08 '22 20:12 robertosfield

It seems the issue is related to Apple Silicon based systems. I found similar issue in another project: https://github.com/NXPmicro/mfgtools/issues/274 and a fix for it: https://github.com/NXPmicro/mfgtools/commit/3c02ae8b2f2b64823b19c425816252fa36229974

I propose to use the same approach:

#if defined(_MSC_VER)
    struct __stat64 stbuf;
    if (_wstat64(path.c_str(), &stbuf) != 0) return FILE_NOT_FOUND;
#elif defined(__APPLE__)
    struct stat stbuf;
    if (stat(path.c_str(), &stbuf) != 0) return FILE_NOT_FOUND;
#else
    struct stat64 stbuf;
    if (stat64(path.c_str(), &stbuf) != 0 ) return FILE_NOT_FOUND;
#endif

artemkulyk avatar Dec 08 '22 21:12 artemkulyk

The suggested change looks sensible. Could you generate a PR for it thanks.

robertosfield avatar Dec 08 '22 21:12 robertosfield

22:44:29.464: [VulkanSceneGraph] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/stat64deprecated_fix:refs/heads/stat64deprecated_fix --set-upstream remote: Permission to vsg-dev/VulkanSceneGraph.git denied to artemkulyk. fatal: unable to access 'https://github.com/vsg-dev/VulkanSceneGraph.git/': The requested URL returned error: 403

Probably, I have no permission to the repo. I usually use Perforce at work and have no enough experience with github. Probably I'm doing something wrong...

artemkulyk avatar Dec 08 '22 21:12 artemkulyk

Hi Artem,

You have to

  • fork vsg-dev/VulkanSceneGraph to your own Github account
  • clone your fork on your local machine
  • create a new branch for your fix.
  • make the fix
  • push the branch back to your own Github repo
  • log into Github and go to your fork. There will be a prompt to create a PR back to vsg-dev/VulkanSceneGraph

That's how I do it anyway. There are some shortcuts I think, but this way I can see what's going on.

Regards, Roland

On Fri, 9 Dec 2022 at 08:51, artemkulyk @.***> wrote:

22:44:29.464: [VulkanSceneGraph] git -c credential.helper= -c core.quotepath=false -c log.showSignature=false push --progress --porcelain origin refs/heads/stat64deprecated_fix:refs/heads/stat64deprecated_fix --set-upstream remote: Permission to vsg-dev/VulkanSceneGraph.git denied to artemkulyk. fatal: unable to access 'https://github.com/vsg-dev/VulkanSceneGraph.git/': The requested URL returned error: 403

Probably, I have no permission to the repo. I usually use Perforce at work and have no enough experience with github. Probably I'm doing something wrong...

— Reply to this email directly, view it on GitHub https://github.com/vsg-dev/VulkanSceneGraph/issues/637#issuecomment-1343419330, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAPOEQ3ZV7F6GSZFVKCZAMLWMJJ73ANCNFSM6AAAAAASYRE6PI . You are receiving this because you are subscribed to this thread.Message ID: @.***>

rolandhill avatar Dec 08 '22 21:12 rolandhill

Hi @rolandhill,

Thanks.

artemkulyk avatar Dec 08 '22 22:12 artemkulyk

The suggested change looks sensible. Could you generate a PR for it thanks.

Done

artemkulyk avatar Dec 08 '22 22:12 artemkulyk