Andersbakken / rtags

A client/server indexer for c/c++/objc[++] with integration for Emacs based on clang.
http://www.rtags.net
GNU General Public License v3.0
1.83k stars 253 forks source link

rc does not seem to forward stdin to the compiler #815

Open squidbidness opened 7 years ago

squidbidness commented 7 years ago

I'm working under a proprietary build system, a part of whose process is to do some compiler feature checks by piping a simple program to the compiler's standard input; if that test fails, the build fails. Trying to get this to work, I've begun to suspect that rc does not forward its stdin input to the compiler it invokes. Is this a case you would like rtags to cover?

Some more detail about my deduction that it's a stdin forwarding problem I'm seeing:

For various reasons, I've been trying to set up my build under the above proprietary system to invoke rc -c $CXX $CXXFLAGS in its process, rather than use the rtags man-in-the-middle technique I had been using, but the above mentioned test step is failing. The command it issues winds up as something like echo 'int main(){return 0;}' | rc -c $CXX $CXXFLAGS -xc++ - -o /dev/null, which is apparently returning an error code (since the build system stops there with an error message), but I don't see any new output in the rdm log file after running this. If I tweak this to create a deliberate compile error, e.g. echo 'int main(){return 0;0} | ..., I still see no new output in the rdm log.

Andersbakken commented 7 years ago

Hi

I think I've fixed this now.

Note that rc's return value is unrelated to whether or not the file compiles cleanly. Only whether we're able to grok the command line. In this case I added something so that rc will return 0 for things like this:

echo int main(){return 0;}' | rc -c $CXX $CXXFLAGS -xc++ - -o /dev/null

Note that we still don't read stdin and pass it on. We just special case - as the source file.

Can you check and see if it works for you?

regards

Anders

On Wed, Oct 5, 2016 at 3:21 PM, squidbidness notifications@github.com wrote:

I'm working under a proprietary build system, a part of whose process is to do some compiler feature checks by piping a simple program to the compiler's standard input; if that test fails, the build fails. Trying to get this to work, I've begun to suspect that rc does not forward its stdin input to the compiler it invokes. Is this a case you would like rtags to cover?

Some more detail about my deduction that it's a stdin forwarding problem I'm seeing:

For various reasons, I've been trying to set up my build under the above proprietary system to invoke rc -c $CXX $CXXFLAGS in its process, rather than use the rtags man-in-the-middle technique I had been using, but the above mentioned test step is failing. The command it issues winds up as something like echo 'int main(){return 0;}' | rc -c $CXX $CXXFLAGS -xc++

  • -o /dev/null, which is apparently returning an error code (since the build system stops there with an error message), but I don't see any new output in the rdm log file after running this. If I tweak this to create a deliberate compile error, e.g. echo 'int main(){return 0;0} | ..., I still see no new output in the rdm log.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Andersbakken/rtags/issues/815, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEdSlZkyQq5aDHhwHvKlrrQnQeSwpCTks5qxCLUgaJpZM4KPWhG .

squidbidness commented 7 years ago

Thank you! That was very quick. I'll build rtags and test it as soon as I can. On Oct 5, 2016 10:26 PM, "Anders Bakken" notifications@github.com wrote:

Hi

I think I've fixed this now.

Note that rc's return value is unrelated to whether or not the file compiles cleanly. Only whether we're able to grok the command line. In this case I added something so that rc will return 0 for things like this:

echo int main(){return 0;}' | rc -c $CXX $CXXFLAGS -xc++ - -o /dev/null

Note that we still don't read stdin and pass it on. We just special case - as the source file.

Can you check and see if it works for you?

regards

Anders

On Wed, Oct 5, 2016 at 3:21 PM, squidbidness notifications@github.com wrote:

I'm working under a proprietary build system, a part of whose process is to do some compiler feature checks by piping a simple program to the compiler's standard input; if that test fails, the build fails. Trying to get this to work, I've begun to suspect that rc does not forward its stdin input to the compiler it invokes. Is this a case you would like rtags to cover?

Some more detail about my deduction that it's a stdin forwarding problem I'm seeing:

For various reasons, I've been trying to set up my build under the above proprietary system to invoke rc -c $CXX $CXXFLAGS in its process, rather than use the rtags man-in-the-middle technique I had been using, but the above mentioned test step is failing. The command it issues winds up as something like echo 'int main(){return 0;}' | rc -c $CXX $CXXFLAGS -xc++

  • -o /dev/null, which is apparently returning an error code (since the build system stops there with an error message), but I don't see any new output in the rdm log file after running this. If I tweak this to create a deliberate compile error, e.g. echo 'int main(){return 0;0} | ..., I still see no new output in the rdm log.

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/Andersbakken/rtags/issues/815, or mute the thread https://github.com/notifications/unsubscribe-auth/ AAEdSlZkyQq5aDHhwHvKlrrQnQeSwpCTks5qxCLUgaJpZM4KPWhG .

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/Andersbakken/rtags/issues/815#issuecomment-251864147, or mute the thread https://github.com/notifications/unsubscribe-auth/ABRHz3VeZRzexdY-4OJ33wkO61c2RbATks5qxHiIgaJpZM4KPWhG .

squidbidness commented 7 years ago

I've installed using Homebrew with --HEAD (on OS X); I'm still seeing the issue, but I want to be sure what I've installed actually includes the fix. rdm --version gives 2.5.103. Is that a current enough version? If brew install rtags --HEAD hasn't gotten the tip of the master branch to me, I'll do a manual checkout and build.

squidbidness commented 7 years ago

I've reduced/isolated at least one reason it's still failing for me: the /dev/null at the end of the arguments is also tripping up rc:

anhall@leviathan: rc -o /dev/null  
Couldn't parse argument /dev/null
Try 'rc --help' for more information.

I get the same with simple rc /dev/null