Xcode won't compile sources


John Brownie
 

With a working application written in a mixture of Obj-C, Obj-C++ and straight C++, I added some Swift files. After a bit of mucking around due to some header path issues, I have come to the point where it won't build, because it doesn't compile the sources. As far as I can tell, the sources are listed in the Compile Sources phase, but it gets skipped, and the linker complains that it can't find the files.

This is Xcode 8.3.2, on macOS 10.12.6. I've restarted the computer, cleaned the Build Folder, and tried what can think of, but this has me stumped.

Any pointers?

John
--
John Brownie
SIL-PNG, Ukarumpa, Eastern Highlands, Papua New Guinea
Mussau-Emira language, New Ireland Province, Papua New Guinea


Peter Teeson
 

I assume you did a clean? What does the log file say?
Does your backup version before you added the Swift files still compile?
Can you compile a file using the Product/Perform Action/Compile of a files selected in the navigator?
Can you do that for one of the newly added Swift files?

respect

Peter
P.S. Ukelele is a godsend… <grin>

On Nov 19, 2017, at 9:28 PM, John Brownie <john_brownie@sil.org> wrote:

With a working application written in a mixture of Obj-C, Obj-C++ and straight C++, I added some Swift files. After a bit of mucking around due to some header path issues, I have come to the point where it won't build, because it doesn't compile the sources. As far as I can tell, the sources are listed in the Compile Sources phase, but it gets skipped, and the linker complains that it can't find the files.

This is Xcode 8.3.2, on macOS 10.12.6. I've restarted the computer, cleaned the Build Folder, and tried what can think of, but this has me stumped.

Any pointers?

John
--
John Brownie
SIL-PNG, Ukarumpa, Eastern Highlands, Papua New Guinea
Mussau-Emira language, New Ireland Province, Papua New Guinea

-=-=-=-=-=-=-=-=-=-=-=-


Quincey Morris
 

On Nov 19, 2017, at 18:28 , John Brownie <john_brownie@...> wrote:

Any pointers?

Also, check what scheme and device is currently selected (also the target, if it’s multi-target project), and make sure that the scheme is not corrupted (builds the correct target, for example).

Also, look in the build transcript to follow through the steps of what it does and what it doesn’t do.



John Brownie
 

OK, a bit of digging through things in response to suggestions showed part of the problem. When I was fiddling with the header paths, I had the boost headers as recursive, which led to an error of the argument list being too long. Trying to fix that by telling it to ignore the tools folder stopped that error, but apparently caused the failure to compile.

Thanks for the tips, which enabled me to find the problem (or at least, one of the problems).

John
--
John Brownie
SIL-PNG, Ukarumpa, Eastern Highlands, Papua New Guinea
Mussau-Emira language, New Ireland Province, Papua New Guinea


Alex Zavatone
 

Getting the header search paths right can be hell, once they are borked.

The sanest thing would be to revert to before you added the Swift files, make sure you can build and add the Swift files again.

The other thing you will want to do is output the build variables, see what Xcode thinks the header search paths are and verify that they are indeed present.

You can do this easily by clicking a check box to do this in the Build Phases, or add a phase that echos the build variables to the build process and before compile time.

Good luck. Sounds like fun times.

On Nov 19, 2017, at 8:28 PM, John Brownie <john_brownie@sil.org> wrote:

With a working application written in a mixture of Obj-C, Obj-C++ and straight C++, I added some Swift files. After a bit of mucking around due to some header path issues, I have come to the point where it won't build, because it doesn't compile the sources. As far as I can tell, the sources are listed in the Compile Sources phase, but it gets skipped, and the linker complains that it can't find the files.

This is Xcode 8.3.2, on macOS 10.12.6. I've restarted the computer, cleaned the Build Folder, and tried what can think of, but this has me stumped.

Any pointers?

John
--
John Brownie
SIL-PNG, Ukarumpa, Eastern Highlands, Papua New Guinea
Mussau-Emira language, New Ireland Province, Papua New Guinea



John Brownie
 

Fun times, indeed!

The headers issue turns up because, in adding Swift files, I have to make the minimum OS version 10.9 rather than 10.8. For some reason, that makes an include line like:

#include <tr1/functional>

fails to compile, with the message "fatal error: 'tr1/functional' file not found".

After extensive investigation, the only factor that makes this fail to compile is the switch of minimum OS version. I have had warning messages about libstdc++ before, when it was 10.8, so I presume something changed at that point, but I have no clue as to where to look to solve this issue. Hopefully someone else has seen and resolved this one!

John
--
John Brownie
SIL-PNG, Ukarumpa, Eastern Highlands, Papua New Guinea
Mussau-Emira language, New Ireland Province, Papua New Guinea


John Brownie
 

Ick, it turns out to be the fact that I have some older C++ code that requires the older libstdc++ rather than the newer libc++, and this is quickly turning into a nightmare, as I need to dig into some of that older code and rework it.

The pains of trying to develop a replacement in pieces rather than a complete rework in Swift...

John

20 November 2017 at 17:02
Fun times, indeed!

The headers issue turns up because, in adding Swift files, I have to make the minimum OS version 10.9 rather than 10.8. For some reason, that makes an include line like:

#include <tr1/functional>

fails to compile, with the message "fatal error: 'tr1/functional' file not found".

After extensive investigation, the only factor that makes this fail to compile is the switch of minimum OS version. I have had warning messages about libstdc++ before, when it was 10.8, so I presume something changed at that point, but I have no clue as to where to look to solve this issue. Hopefully someone else has seen and resolved this one!

John
20 November 2017 at 14:48
Getting the header search paths right can be hell, once they are borked.

The sanest thing would be to revert to before you added the Swift files, make sure you can build and add the Swift files again.

The other thing you will want to do is output the build variables, see what Xcode thinks the header search paths are and verify that they are indeed present.

You can do this easily by clicking a check box to do this in the Build Phases, or add a phase that echos the build variables to the build process and before compile time.

Good luck. Sounds like fun times.









20 November 2017 at 12:28
With a working application written in a mixture of Obj-C, Obj-C++ and straight C++, I added some Swift files. After a bit of mucking around due to some header path issues, I have come to the point where it won't build, because it doesn't compile the sources. As far as I can tell, the sources are listed in the Compile Sources phase, but it gets skipped, and the linker complains that it can't find the files.

This is Xcode 8.3.2, on macOS 10.12.6. I've restarted the computer, cleaned the Build Folder, and tried what can think of, but this has me stumped.

Any pointers?

John

--
John Brownie
SIL-PNG, Ukarumpa, Eastern Highlands, Papua New Guinea
Mussau-Emira language, New Ireland Province, Papua New Guinea