On one of my mac systems I have to run nimrod c afile.nim using sudo.
I have accepted the stupid xtools license agreement.
I can't tell if it is something to do with clang or that the target directory for writing the output files requires super user privileges, which makes no sense. I am the owner and the owner has rwx privileges.
As a result, the sublime text build always fails. I can't find where the heck sublime text 3 hides the build files or where the NimLine package hides them. Here are the messages resulting from the sublime build process (which is no more than just executing nimrod compile $filename):
ld: can't write output file: /Users/lewislevin/Dropbox/Nim-lang-code/lines for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) config/nimrod.cfg(37, 2) Hint: added path: '/Users/lewislevin/.babel/pkgs/' [Path] Hint: used config file '/usr/local/nimrod/config/nimrod.cfg' [Conf] Hint: system [Processing] Hint: lines [Processing] clang -o /Users/lewislevin/Dropbox/Nim-lang-code/lines /Users/lewislevin/Dropbox/Nim-lang-code/nimcache/stdlib_system.o /Users/lewislevin/Dropbox/Nim-lang-code/nimcache/lines.o -ldl Error: execution of an external program failed [Finished in 0.1s with exit code 1] [cmd: ['nimrod', 'c', '/Users/lewislevin/Dropbox/Nim-lang-code/lines.nim']] [dir: /Users/lewislevin/Dropbox/Nim-lang-code] [path: /usr/bin:/bin:/usr/sbin:/sbin]
Can't write output file suggests a privileges problem.
Here is the output from executing the compile command from terminal. Not surprisingly it is the same--it's doing the same exact operation: config/nimrod.cfg(37, 2) Hint: added path: '/Users/lewislevin/.babel/pkgs/' [Path] Hint: used config file '/usr/local/nimrod/config/nimrod.cfg' [Conf] Hint: system [Processing] Hint: lines [Processing] clang -o /Users/lewislevin/Dropbox/Nim-lang-code/lines /Users/lewislevin/Dropbox/Nim-lang-code/nimcache/stdlib_system.o /Users/lewislevin/Dropbox/Nim-lang-code/nimcache/lines.o -ldl ld: can't write output file: /Users/lewislevin/Dropbox/Nim-lang-code/lines for architecture x86_64 clang: error: linker command failed with exit code 1 (use -v to see invocation) Error: execution of an external program failed
Spotlight, as usual, can't find anything so it's no help. I would like to figure out why sudo is necessary, but I could update the command in the build package to include sudo if I could just find the silly package.
Anyone seen this issue with requiring sudo on os x? First I've seen it.
Thanks.
I've got rwx rights on the parent directory, nimcache, and all files in the parent and nimcache.
It's like nimrod is not allowed to run with my permissions.
Answer: the fault is clang's.
Since 5.1 the linker needs super user rights to write its output file. Some notion of greater security from Apple. Sheesh.
Mavericks 10.9.
I need to compare 2 machines. No sudo on one and need it on the other. will report back.
Hi,
well i can't help u with u're problem on mac, but im using ST3 too.
ST3 is packing it's files and u need to download the package resource viewer to unpack the files.(if u downloaded the nimrod mod)
Where its unpacking the files u have to look for... I dont own and know mac.
Maybe i could help u a bit.
Greetz Panda
Success. Solved.
@Jehan: When I first upgraded to Xcode 6.0.1 (why?--I don't know; I am a sheep and took the upgrade) I didn't immediately accept the license agreement. Had to use sudo to compile. This left a .o file owned by root that "owner" could not remove/replace when I recompiled. Have since accepted said license agreement and deleted root's .o files. No prob any more.
@FroznPanda: Yeah, got the package resource viewer and picked out the nimrod.sublime-build and created a modified nim.sublime-build file and put in ..../Packages/User. It shows up among the build systems. I jammed sudo into the command as follows, but it doesn't work. ST3 can't run sudo via its console (using Python execfile I believe...). I don't need it for nim any more, but am curious if this can be made to work.
{
"cmd": ["sudo", "nimrod", "c", "$file"],
"selector": "source.nimrod",
"variants": [
{
"cmd": ["sudo", "nimrod", "c", "-r", "--verbosity:0", "--hints:off", "$file"],
"selector": "source.nimrod",
"name": "Run"
}
]
}
Thanks to both of you.
Nim progress proceeds....