Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

I need help with XCode 7.3

87 views
Skip to first unread message

Tom Stiller

unread,
Mar 26, 2016, 9:54:13 PM3/26/16
to
I only use XCode to compile the occasional "C" program but after
updating to OS X 10.11.4 and XCode 7.3 I cannot even compile a
"hello world" file.

Source:
#include <stdio.h>
#
int main(int argc, char** argv)
{
printf("Hello world.\n");
}
}
Result:
bash-3.2$ which cc
/Developer/usr/bin/cc
bash-3.2$ cc hello.c
couldn't understand kern.osversion `15.4.0'
hello.c:1:21: error: unistd.h: No such file or directory
hello.c: In function 'main':
hello.c:5: warning: incompatible implicit declaration of built-in
function 'printf'
bash-3.2$

I don't understand what generates the
couldn't understand kern.osversion `15.4.0'
message and I don't know how to prevent the error.

Can someone help?

TIA

Tom Stiller

unread,
Mar 27, 2016, 11:05:49 AM3/27/16
to
On 2016-03-27, Michael Vilain <mev9...@yahoo.com> wrote:
> In article <dlosq2...@mid.individual.net>,
> I don't know when the last time was you installed Xcode, but they split
> the Xcode binary into two packages--the app and the command-line tools.
> You need both to compile stuff from the command line. This started with
> 10.9.
>

Thanks, I did install the new command-line tools when prompted but I guess
something went wrong. I'll revisit that.

Alan Browne

unread,
Mar 27, 2016, 11:51:39 AM3/27/16
to
For small programs (CL) that don't need all the fluff I use Lightweight
IDE (for Pascal, C and Ada). Indeed I recently removed XCode to avoid
the monster updates.

http://www.ragnemalm.se/lightweight/

Very basic editor. Just compiled and ran your hello program in about 30
seconds after opening the editor, pasting, saving, correcting the extra
closing brace and compiling again.

You still need to install the Apple CL tools.



--
"But I am somehow extraordinarily lucky, for a guy with shitty luck."
..Harrison Ford, Rolling Stone - 2015-12-02

Tom Stiller

unread,
Mar 27, 2016, 12:14:45 PM3/27/16
to
On 2016-03-27, Tom Stiller <clusterf...@gmail.com> wrote:
> On 2016-03-27, Michael Vilain <mev9...@yahoo.com> wrote:
>> In article <dlosq2...@mid.individual.net>,
>> Tom Stiller <clusterf...@gmail.com> wrote:
>>
>>> I only use XCode to compile the occasional "C" program but after
>>> updating to OS X 10.11.4 and XCode 7.3 I cannot even compile a
>>> "hello world" file.
>>>

[snip]

>>> bash-3.2$ cc hello.c
>>> couldn't understand kern.osversion `15.4.0'

[snip]

>>> I don't understand what generates the
>>> couldn't understand kern.osversion `15.4.0'
>>> message and I don't know how to prevent the error.
>>>
>>> Can someone help?
>>>
>> I don't know when the last time was you installed Xcode, but they split
>> the Xcode binary into two packages--the app and the command-line tools.
>> You need both to compile stuff from the command line. This started with
>> 10.9.
>>
>
> Thanks, I did install the new command-line tools when prompted but I guess
> something went wrong. I'll revisit that.

I downloaded XCode 7.3 and the command-line tools and reinstalled.
Compilations and makes generate proper outputs but I still get
couldn't understand kern.osversion `15.4.0'

As well as:
ld: warning: bad symbol version: $ld$hide$os10.10$_atomic_flag_clear
in dylib /usr/lib/system/libcompiler_rt.dylib

I can live with that but…


Jolly Roger

unread,
Mar 27, 2016, 3:06:30 PM3/27/16
to
On 2016-03-27, Tom Stiller <clusterf...@gmail.com> wrote:
Interesting. I just updated this morning and didn't see your problem
before or after the update:

Before:
-------

[jr on macpro at Desktop]# cc --version

Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.3.0
Thread model: posix

[jr on macpro at Desktop]# cc hello.c -o hello

[jr on macpro at Desktop]# file hello

hello: Mach-O 64-bit executable x86_64

[jr on macpro at Desktop]# ./hello

Hello world.

After:
------

[jr on macpro at Desktop]# cc --version

Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
InstalledDir:
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

[jr on macpro at Desktop]# cc hello.c -o hello

[jr on macpro at Desktop]# file hello

hello: Mach-O 64-bit executable x86_64

[jr on macpro at Desktop]# ./hello

Hello world.


--
E-mail sent to this address may be devoured by my ravenous SPAM filter.
I often ignore posts from Google. Use a real news client instead.

JR

Lloyd Parsons

unread,
Mar 27, 2016, 3:24:24 PM3/27/16
to
Now I'm confused. Had Xcode and the command line tools, deleted Xcode.
Things were good. Then the latest update happened and it wouldn't update
the command line tools though it showed them available. So I found the dmg
for the command line tools and installed them just fine. Things seem to be
working as they should.


--
Lloyd

Lewis

unread,
Mar 27, 2016, 5:26:00 PM3/27/16
to
In message <dlqp9k...@mid.individual.net>
$ cc --version
Apple LLVM version 7.3.0 (clang-703.0.29)
Target: x86_64-apple-darwin15.4.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin

(not XCode installed on this laptop)

> Hello world.

Yeah, no errors or warnings here.

$ cc test.c
$ ./a.out
Hello world.


--
I want a party where all the women wear new dresses and all the men
drink beer. -- Jason Gaes

Tom Stiller

unread,
Mar 28, 2016, 2:05:07 PM3/28/16
to
> /xctoolchain/usr/bin
> [jr on macpro at Desktop]# cc hello.c -o hello
> [jr on macpro at Desktop]# file hello
> hello: Mach-O 64-bit executable x86_64
> [jr on macpro at Desktop]# ./hello
> Hello world.
>
OK. So When I entered cc --version
I got the same complaints couldn't understand kern.osversion `15.4.0'
along with an obsolete version number (which I neglected to copy).
and which cc still returned /Developer/usr/bin/cc

Now this system has been upgraded in place many times and I can't
remember when the /Developer directory was first installed so I
just wiped it out and re-installed XCode and the Command-line tools
and
now everything is neat and my test compiles are clean and execute as
expected.

Many thanks to all who offered help and advise.

Jolly Roger

unread,
Mar 28, 2016, 2:18:12 PM3/28/16
to
Ah. Yes, /Developer was deprecated a while ago. I suppose the shell was
finding the cc in that location before others. You may want to check
your PATH environment variable and remove /Developer from it as well if
it's there.

Paul Sture

unread,
Mar 28, 2016, 5:48:55 PM3/28/16
to
On 2016-03-28, Tom Stiller <clusterf...@gmail.com> wrote:
>>>
>>> I don't understand what generates the
>>> couldn't understand kern.osversion `15.4.0'
>>> message and I don't know how to prevent the error.
>>>
>>
> OK. So When I entered cc --version
> I got the same complaints couldn't understand kern.osversion `15.4.0'
> along with an obsolete version number (which I neglected to copy).
> and which cc still returned /Developer/usr/bin/cc

Aha. I was getting a similar message about kern.osversion with gfortran
at one point last year. Finding a later set of binaries fixed that in
my case, but it's nice to know what the likely cause was.

> Now this system has been upgraded in place many times and I can't
> remember when the /Developer directory was first installed so I
> just wiped it out and re-installed XCode and the Command-line tools
> and
> now everything is neat and my test compiles are clean and execute as
> expected.
>
> Many thanks to all who offered help and advise.

Problem filed in case anyone else comes across it.

--
There are two hard things in computer science: cache invalidation,
naming, and off-by-one errors.
0 new messages