1

The source files of interest are on a network share hosted on a Win7 machine, but the symlinks are created on this Mac using ln -sf

These are .h files, and sometimes one or more of them are not found by the C++ compiler. I get an error like foo.h is not found, when I can see it and read the (linked-to) contents using Finder.

My work-around is to copy the file instead of symlink to it. Then I find that the other files (symlink .h files in the same directory linking to files in the same source directory; just like the "bad" one) have no problems.

Which one(s) are affected will vary, too.

Any idea what could be causing this? It started when updating Mac OSX to Mavericks, which has different CIFS network code. It still happens with Yosemite.

Note that the symlink does work on the Mac in general; I make it on that Mac, and even when it's having the error in Xcode I can see the file contents resolved as expected in the Columns view in Finder, or with cat on the bash prompt. It's only Xcode's compiler's problem.

More Specifics

The files are part of a “framework” and the link (example)

cd /Volumes/There/blah/blah2/blah3/blah3/CocoaPods/Pods/BuildHeaders/Cheeseburger
ln -sf ../../Cheeseburger/Burger/head1.h
  ⋮ a bunch of files in same path, head2.h, head3.h, etc.

cd ../../Headers/Cheeseburger
ln -sf ../../Cheeseburger/Burger/head1.h
  ⋮ etc.

I'll get an error finding head5.h, and the others work fine.

2
  • Are the original files on the same physical disk, or one which needs to be mounted via AFP or SMB?
    – Kent
    Feb 12, 2015 at 6:40
  • The symlink and the file linked-to are on the same volume. I'll add more details to the Q.
    – JDługosz
    Feb 12, 2015 at 7:33

1 Answer 1

2

Symlinks are often destroyed by some archiving tools, especially by those built into some versions of PHP, for example. Try to pack and unpack an archive and check if symlinks are still alive. Also, symlinks won't be saved on NTFS or similar non-mac filesystem. Please check if symlinks get broken after you access the drive from Windows computer.

2
  • I'm (re)making the links on that computer just because of compatibility issues. If a Win tool clobbers them, I remade them on this Mac. Note that they do work as symlinks and the bad file in particular is visible and resolved in Finder. That is, it's not a case of the link getting broken. The link is fine in Finder, Preview, cat, etc.
    – JDługosz
    Feb 12, 2015 at 7:50
  • That is not correct re NTFS: First, NTFS and CIFS (SMB) shares do have native symlinks; second, the Mac has its own fallback mechanism for non-supported file systems where it uses an ordinary text file with some signature that it recognizes, as well as the linked-to name. Links made on the Mac (as of Mavericks!) will be seen as real symbolic links on the Windows host machine as well, though they are different than what you get from using mklink on Windows (which don't work)
    – JDługosz
    Feb 12, 2015 at 7:57

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .