atom-community / atom-community/atom-script

Strange results attempting to compile Objective-C with clang using Script in Atom

Open
#1,202 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
730
Forks
264
PR merge metrics
No merged PRs in 30d

Description

I am getting weird results trying to compile an Objective-C file with clang using Script in Atom on OS X 10.11, as follows.

I have a file `File.m`.To compile it from the command line I would do:
```
clang -g -fobjc-arc -framework Foundation File.m -o File
```
Here's what I have done so far in my attempt to accomplish the equivalent in Atom:

- downloaded Atom
- used it a little for some JavaScript I was working on
- run Atom on the the command line in the project directory, so Atom will get my environment variables, as per [the Script documentation](https://atom.io/packages/script) (search for “my socks”)
- edited `File.m`
- configured it for Script as follows:
- Current Working Directory: blank
- Command: `clang`
- Command Arguments: `-g -fobjc-arc -framework Foundation File.m-o File`
- Program Arguments: `Data.txt`
- (I attempted to “Save as profile”, but I am obviously not doing something right because it never gets saved — maybe I misunderstand the whole profile mechanism: how they get saved, where they get stored, how they get recalled, etc.)
- ran it with Script

What I got was:
```
[Command: clang -g -fobjc-arc -framework Foundation File.m -o File -c 'xcrun clang -fcolor-diagnostics -Wall -include stdio.h -framework Cocoa --home .../ProjectDir/File.m -o /tmp/objc-c.out && /tmp/objc-c.out' Data.txt]
clang: error: no such file or directory: 'xcrun clang -fcolor-diagnostics -Wall -include stdio.h -framework Cocoa --home .../ProjectDir/File.m -o /tmp/objc-c.out && /tmp/objc-c.out'
clang: warning: -framework Foundation: 'linker' input unused
clang: warning: Data.txt: 'linker' input unused
[Finished in 0.056s]
```
Why is it adding
```
-c 'xcrun clang -fcolor-diagnostics -Wall -include stdio.h -framework Cocoa --home--/ProjectDir/File.m -o /tmp/objc-c.out && /tmp/objc-c.out'
```
I also tried making `xcrun` the command and putting `clang` at the beginning of the command arguments. Either I have set things up incorrectly or there is a problem using clang on Objective-C files with Script. What the profile be for a simple Objective-C program? (And how do I save that profile? Are profiles file-specific? How do I apply one to the current file?)

One more thing: how would I set things up to compile several Objective-C files into one executable?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.