Strange Xcode behavior


Owen Hartnett
 

I’ve set up a remote build server, and a project that had been building fine is suddenly giving very strange errors.

This is an objective C project with one Swift file in it.  The project, when attempting to compile, shows an error:

<module-includes>:74:9: note: in file included from <module-includes>:74:
#import "net/if_dl.h"
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/net/if_dl.h:93:2: error: unknown type name 'u_char'; did you mean 'char'?
        u_char  sdl_len;        /* Total length of sockaddr */
        ^
<module-includes>:74:9: note: in file included from <module-includes>:74:
#import "net/if_dl.h"
        ^
/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator14.5.sdk/usr/include/net/if_dl.h:94:2: error: unknown type name 'u_char'; did you mean 'char'?
        u_char  sdl_family;     /* AF_LINK */
        ^

repeated 27 times, for each instance of u_char in the if_dl.h file. It fails when trying to compile the only Swift file.

If I copy the entire project folder to my laptop, it compiles fine without the above messages. Other team members also have no problems compiling it.  It is only on this one computer.  The source is checked out from git, there seems to be no differences in setup that I can tell.  I suppose I could drop a define for u_char in the settings, but I’d really like to find out why this is happening.  This if_dl.h file looks like a holdover from 2011.  The server is being used as a remote xcode server, and I’ve also been testing fastlane on it, but no code changes in the project itself.

-Owen


Sak Wathanasin
 



On 17 Aug 2021, at 15:02, Owen Hartnett <owen@...> wrote:

I’ve set up a remote build server, and a project that had been building fine is suddenly giving very strange errors.

Have you tried clearing out the “DerivedData” folder? Maybe it has stuff cached from older/newer SDKs.

Regards
Sak


Owen Hartnett
 

Thanks for the reply.  Yes, I tried that.  It’s looking like some of the header paths in the build settings need to be adjusted.  Still plugging at it.

-Owen

On Aug 23, 2021, at 1:43 PM, Sak Wathanasin <sw@...> wrote:



On 17 Aug 2021, at 15:02, Owen Hartnett <owen@...> wrote:

I’ve set up a remote build server, and a project that had been building fine is suddenly giving very strange errors.

Have you tried clearing out the “DerivedData” folder? Maybe it has stuff cached from older/newer SDKs.

Regards
Sak



Sak Wathanasin
 



On 23 Aug 2021, at 19:22, Owen Hartnett <owen@...> wrote:

Thanks for the reply.  Yes, I tried that.  It’s looking like some of the header paths in the build settings need to be adjusted.  Still plugging at it.

Is the problem with the Obj-C or the Swift files?

An explicit #import <sys/types.h> should pull in the definition of u_char, but that is usually in the import chain already. In my test project I didn’t have to explicitly include it. Something to do with search paths?

Sak


Owen Hartnett
 

It’s an obj-C project overall, but it has one Swift file, and that is where it fails.  I’ve tried manually adding include files as you’ve suggested, but it then complains about double declarations of other terms.

I was able to reproduce on another system, and then I preened the include search paths and fixed it.  I retried on the server and still has the issue, so I must have done something on the fixed machine that I also need to do on the server.

So now it’s just a case of diff and comparisons.

Thanks for your help!

-Owen

On Aug 23, 2021, at 2:59 PM, Sak Wathanasin <sw@...> wrote:



On 23 Aug 2021, at 19:22, Owen Hartnett <owen@...> wrote:

Thanks for the reply.  Yes, I tried that.  It’s looking like some of the header paths in the build settings need to be adjusted.  Still plugging at it.

Is the problem with the Obj-C or the Swift files?

An explicit #import <sys/types.h> should pull in the definition of u_char, but that is usually in the import chain already. In my test project I didn’t have to explicitly include it. Something to do with search paths?

Sak