[cfe-users] Adding linker flag `-save-temps` resolves the clang-8 error: "unable to make temporary file"
Hi clang users, I am using Windows10 + Cygwin + Eclipse + LLVM toolchain to build a C/C++ project. The files compile fine, but linking with `clang++` fails with multiple `error: unable to make temporary file: No such file or directory`. clang++ -o test "source1.bc" "source2.bc" "source3.bc" clang-8: error: unable to make temporary file: No such file or directory clang-8: error: unable to make temporary file: No such file or directory clang-8: error: unable to make temporary file: No such file or directory Linker generates one error per each object file. However, when I add the `-save-temps` option to linker, it works OK. I am launching Eclipse.exe from within Cygwin. I have tried to set TMP, TEMP to /temp, /temp/, /cygdrive/c/temp, etc, but nothing worked. What could be the problem? Thanks, Danijel Domazet -- - Confidential - ___ cfe-users mailing list cfe-users@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
Re: [cfe-users] Adding linker flag `-save-temps` resolves the clang-8 error: "unable to make temporary file"
Thanks David. Why do you think this could be about current dir? Isn't it about TMP (or TEMP or TMPDIR) environment variables? Thanks, Danijel Domazet On Thu, Aug 13, 2020 at 12:11 AM David Blaikie wrote: > Looks like it writes the files to the current directory - do you have > permission to access the current directory? > > On Wed, Aug 12, 2020 at 6:28 AM Danijel DOMAZET via cfe-users > wrote: > > > > Hi clang users, > > I am using Windows10 + Cygwin + Eclipse + LLVM toolchain to build a > C/C++ > > project. > > > > The files compile fine, but linking with `clang++` fails with multiple > > `error: unable to make temporary file: No such file or directory`. > > > > clang++ -o test "source1.bc" "source2.bc" "source3.bc" > > clang-8: error: unable to make temporary file: No such file or > directory > > clang-8: error: unable to make temporary file: No such file or > directory > > clang-8: error: unable to make temporary file: No such file or > directory > > > > Linker generates one error per each object file. > > > > However, when I add the `-save-temps` option to linker, it works OK. > > > > I am launching Eclipse.exe from within Cygwin. I have tried to set TMP, > > TEMP to /temp, /temp/, /cygdrive/c/temp, etc, but nothing worked. > > > > What could be the problem? > > > > Thanks, > > Danijel Domazet > > > > > > > > - Confidential - > > ___ > > cfe-users mailing list > > cfe-users@lists.llvm.org > > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users > -- - Confidential - ___ cfe-users mailing list cfe-users@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
Re: [cfe-users] Adding linker flag `-save-temps` resolves the clang-8 error: "unable to make temporary file"
Thanks Fang-rui. I still haven't been able to fix the issue, I still use --save-temps, and that makes linking very slow. Why does this error go away when I set --save-temps, any idea?? On Thu, Aug 13, 2020 at 7:16 PM Fāng-ruì Sòng wrote: > On Thu, Aug 13, 2020 at 8:59 AM David Blaikie wrote: > > > > On Thu, Aug 13, 2020 at 2:59 AM Danijel DOMAZET > > wrote: > > > > > > Thanks David. > > > Why do you think this could be about current dir? > > > Isn't it about TMP (or TEMP or TMPDIR) environment variables? > > Neither the driver option -save-temps nor the linker option > --save-temps (driver option -Wl,--save-temps) respects > TMP/TEMP/TMPDIR. > The temporary files are saved relative to the current working > directory, which can be changed via -working-directory= > > > Because I ran it locally, and observed that that's where the files > > were written to. > > > > > > > > Thanks, > > > Danijel Domazet > > > > > > > > > On Thu, Aug 13, 2020 at 12:11 AM David Blaikie > wrote: > > >> > > >> Looks like it writes the files to the current directory - do you have > > >> permission to access the current directory? > > >> > > >> On Wed, Aug 12, 2020 at 6:28 AM Danijel DOMAZET via cfe-users > > >> wrote: > > >> > > > >> > Hi clang users, > > >> > I am using Windows10 + Cygwin + Eclipse + LLVM toolchain to build > a C/C++ > > >> > project. > > >> > > > >> > The files compile fine, but linking with `clang++` fails with > multiple > > >> > `error: unable to make temporary file: No such file or directory`. > > >> > > > >> > clang++ -o test "source1.bc" "source2.bc" "source3.bc" > > >> > clang-8: error: unable to make temporary file: No such file or > directory > > >> > clang-8: error: unable to make temporary file: No such file or > directory > > >> > clang-8: error: unable to make temporary file: No such file or > directory > > >> > > > >> > Linker generates one error per each object file. > > >> > > > >> > However, when I add the `-save-temps` option to linker, it works OK. > > >> > > > >> > I am launching Eclipse.exe from within Cygwin. I have tried to set > TMP, > > >> > TEMP to /temp, /temp/, /cygdrive/c/temp, etc, but nothing worked. > > >> > > > >> > What could be the problem? > > >> > > > >> > Thanks, > > >> > Danijel Domazet > > >> > > > >> > > > >> > > > >> > - Confidential - > > >> > ___ > > >> > cfe-users mailing list > > >> > cfe-users@lists.llvm.org > > >> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users > > > > > > > > > - Confidential - > > > > -- > 宋方睿 > -- - Confidential - ___ cfe-users mailing list cfe-users@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users
Re: [cfe-users] Adding linker flag `-save-temps` resolves the clang-8 error: "unable to make temporary file"
;-ladvapi32" "-lshell32" "-luser32" "-lkernel32" "/usr/lib/default-manifest.o" "/usr/lib/gcc/x86_64-pc-cygwin/10/crtend.o" So, again "my_files\\my_file1.o" "my_files\\my_file2.o" " my_files\\my_file3.o" is lost and substituted with empty strings "" "" "". Does this info help resolve my problem? Danijel On Thu, Aug 13, 2020 at 8:27 PM David Blaikie wrote: > Oh, sorry, I didn't read the question in detail about how -save-temps > was making things work when they otherwise were not. > > If you run clang with -### it'll show the command lines it's using, > which should show you where it's trying to write the files so you can > change that/make them writable. I'm not sure which variable is used to > influence clang's temporary directory choice, though. > > On Thu, Aug 13, 2020 at 11:22 AM Danijel DOMAZET > wrote: > > > > Thanks Fang-rui. > > I still haven't been able to fix the issue, I still use --save-temps, > and that makes linking very slow. > > Why does this error go away when I set --save-temps, any idea?? > > > > > > > > On Thu, Aug 13, 2020 at 7:16 PM Fāng-ruì Sòng > wrote: > >> > >> On Thu, Aug 13, 2020 at 8:59 AM David Blaikie > wrote: > >> > > >> > On Thu, Aug 13, 2020 at 2:59 AM Danijel DOMAZET > >> > wrote: > >> > > > >> > > Thanks David. > >> > > Why do you think this could be about current dir? > >> > > Isn't it about TMP (or TEMP or TMPDIR) environment variables? > >> > >> Neither the driver option -save-temps nor the linker option > >> --save-temps (driver option -Wl,--save-temps) respects > >> TMP/TEMP/TMPDIR. > >> The temporary files are saved relative to the current working > >> directory, which can be changed via -working-directory= > >> > >> > Because I ran it locally, and observed that that's where the files > >> > were written to. > >> > > >> > > > >> > > Thanks, > >> > > Danijel Domazet > >> > > > >> > > > >> > > On Thu, Aug 13, 2020 at 12:11 AM David Blaikie > wrote: > >> > >> > >> > >> Looks like it writes the files to the current directory - do you > have > >> > >> permission to access the current directory? > >> > >> > >> > >> On Wed, Aug 12, 2020 at 6:28 AM Danijel DOMAZET via cfe-users > >> > >> wrote: > >> > >> > > >> > >> > Hi clang users, > >> > >> > I am using Windows10 + Cygwin + Eclipse + LLVM toolchain to > build a C/C++ > >> > >> > project. > >> > >> > > >> > >> > The files compile fine, but linking with `clang++` fails with > multiple > >> > >> > `error: unable to make temporary file: No such file or > directory`. > >> > >> > > >> > >> > clang++ -o test "source1.bc" "source2.bc" "source3.bc" > >> > >> > clang-8: error: unable to make temporary file: No such file > or directory > >> > >> > clang-8: error: unable to make temporary file: No such file > or directory > >> > >> > clang-8: error: unable to make temporary file: No such file > or directory > >> > >> > > >> > >> > Linker generates one error per each object file. > >> > >> > > >> > >> > However, when I add the `-save-temps` option to linker, it works > OK. > >> > >> > > >> > >> > I am launching Eclipse.exe from within Cygwin. I have tried to > set TMP, > >> > >> > TEMP to /temp, /temp/, /cygdrive/c/temp, etc, but nothing worked. > >> > >> > > >> > >> > What could be the problem? > >> > >> > > >> > >> > Thanks, > >> > >> > Danijel Domazet > >> > >> > > >> > >> > > >> > >> > > >> > >> > - Confidential - > >> > >> > ___ > >> > >> > cfe-users mailing list > >> > >> > cfe-users@lists.llvm.org > >> > >> > https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users > >> > > > >> > > > >> > > - Confidential - > >> > >> > >> > >> -- > >> 宋方睿 > > > > > > - Confidential - > -- - Confidential - ___ cfe-users mailing list cfe-users@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-users