Solved, the reason is that $HOME is not replaced with exec*. On 23 May 2018 at 23:05, Egor Pugin <egor.pugin@xxxxxxxxx> wrote: > Ok, seems system(""); call works fine, so the issue is probably with > libuv spawn code and not related to gcc. > But if you still have some ideas, I appreciate if you share. > > On 23 May 2018 at 22:44, Egor Pugin <egor.pugin@xxxxxxxxx> wrote: >> Hi! >> >> Summary >> >> I'm spawning gcc from my program via fork/exec* (via libuv) and it fails. >> When I run the same command from bash (ubuntu 18.04), it works. >> How can I debug the issue? Any guesses how to resolve it? >> >> Details >> >> All of gcc commands invoked from my program works well except this >> one. When I add -include option (-includesw/driver/cpp/sw.h), gcc >> fails with >> cc1plus: fatal error: sw/driver/cpp/sw.h: No such file or directory >> compilation terminated. >> >> When I add full path, gcc sees that include, incudes it and then >> completely miss any include from that file: >> /home/egor/dev/cppan3/include/sw/driver/cpp/sw.h:4:10: fatal error: >> solution.h: No such file or directory >> #include <solution.h> >> ^~~~~~~~~~~~ >> compilation terminated. >> >> Include paths are present on command line and correct (everything is >> passed via -I, also tried with -isystem). Both variants above works >> well from bash. >> -include file is not precompiled. >> libuv spawns gcc process with same environment as my app. >> >> Full command: https://pastebin.com/2UryXrUM >> >> -- >> Egor Pugin > > > > -- > Egor Pugin -- Egor Pugin