rbenv / ruby-build

A tool to download, compile, and install Ruby on Unix-like systems.
https://rbenv.org/man/ruby-build.1
MIT License
3.89k stars 785 forks source link

Warning in installation v3.3.4 #2433

Closed XAJX179 closed 2 months ago

XAJX179 commented 3 months ago

Hello,

after running rbenv install 3.3.4 --verbose ,the installation was success but i noticed this warning in between image

Im a beginner still learning programming , is this warning something i should be worried about?

thank you for your time!

i run xubuntu 22.04 LTS

mislav commented 2 months ago

Hi, the short answer: no, these warnings are nothing that you need to worry about or even understand. They should not visibly affect your Ruby installation in any way.


The long answer, since you're learning: this warning was printed by the C compiler while processing the thread.c source file from the Ruby codebase. It indicates something that the compiler thinks could potentially be a problem, but it not enough of an issue to actually abort compilation. Mostly, the only error messages that you should be worried about will have error: in the message instead of warning: or note:, but errors typically also halt compilation, so rbenv install will fail if that happens.

These warnings and other notes are mostly meant to be read and understood by people with knowledge with the source code for Ruby itself, for example the developers and contributors to the Ruby core project. Generally, if a program generates too many warning messages while it's compiling or running, that should be a red flag for developers who are working on the source code for that program, and they could potentially choose to do something about it. Ideally, as an aspiring programmer, you would make it one of your goals that your software should ideally produce zero warnings at compile time or run time, but you will also find that in practice that is very hard to achieve with large codebases. The Ruby source code was developed for over 25 years by potentially thousands of people and is meant to run on a wide variety of operating systems. In addition, C compilers are many and they all behave differently, including choosing which warnings to print. It would be virtually impossible to produce a piece of software on a scale of Ruby and have it print no warnings anywhere in its build system.

Now, a project like this one where you're opening this issue (ruby-build) could potentially choose to filter out these warnings so that developers like you don't worry about something that is fundamentally not your fault. However, we at ruby-build choose not to do any output processing so that you're as close to directly compiling Ruby as possible, including getting all the unfiltered output. It could be potentially dangerous to silence all warnings, as more and more warnings of increased seriousness could increase over time, so the warnings are staying as a very common part of the output, even at the risk of occasionally confusing someone like yourself.

Closing as not an issue with our project. Hope this helps. Good luck!

P.S. If you find yourself having learned C enough to know how to avoid this compiler warning, you could try proposing a code change to the Ruby core project so that the compiler wouldn't complain anymore. I don't know C so well, but I know some other programming languages much better, and I found that it's a nice way to contribute back to open source project by submitting changes to their code so that they produce fewer errors, warnings, or other confusing output. Most project maintainers really appreciate such contributions, as it makes software slightly better for everyone.

XAJX179 commented 2 months ago

Hi, the short answer: no, these warnings are nothing that you need to worry about or even understand. They should not visibly affect your Ruby installation in any way.

The long answer, since you're learning: this warning was printed by the C compiler while processing the thread.c source file from the Ruby codebase. It indicates something that the compiler thinks could potentially be a problem, but it not enough of an issue to actually abort compilation. Mostly, the only error messages that you should be worried about will have error: in the message instead of warning: or note:, but errors typically also halt compilation, so rbenv install will fail if that happens.

These warnings and other notes are mostly meant to be read and understood by people with knowledge with the source code for Ruby itself, for example the developers and contributors to the Ruby core project. Generally, if a program generates too many warning messages while it's compiling or running, that should be a red flag for developers who are working on the source code for that program, and they could potentially choose to do something about it. Ideally, as an aspiring programmer, you would make it one of your goals that your software should ideally produce zero warnings at compile time or run time, but you will also find that in practice that is very hard to achieve with large codebases. The Ruby source code was developed for over 25 years by potentially thousands of people and is meant to run on a wide variety of operating systems. In addition, C compilers are many and they all behave differently, including choosing which warnings to print. It would be virtually impossible to produce a piece of software on a scale of Ruby and have it print no warnings anywhere in its build system.

Now, a project like this one where you're opening this issue (ruby-build) could potentially choose to filter out these warnings so that developers like you don't worry about something that is fundamentally not your fault. However, we at ruby-build choose not to do any output processing so that you're as close to directly compiling Ruby as possible, including getting all the unfiltered output. It could be potentially dangerous to silence all warnings, as more and more warnings of increased seriousness could increase over time, so the warnings are staying as a very common part of the output, even at the risk of occasionally confusing someone like yourself.

Closing as not an issue with our project. Hope this helps. Good luck!

P.S. If you find yourself having learned C enough to know how to avoid this compiler warning, you could try proposing a code change to the Ruby core project so that the compiler wouldn't complain anymore. I don't know C so well, but I know some other programming languages much better, and I found that it's a nice way to contribute back to open source project by submitting changes to their code so that they produce fewer errors, warnings, or other confusing output. Most project maintainers really appreciate such contributions, as it makes software slightly better for everyone.

Thank you @mislav , i have been learning ruby and its fun and everything runs fine. Also so much thanks for taking time to explain so many things to me,You rock :metal: I got better understanding of warning and errors and recently learned to read stack trace and use debugger too :smile:

PS: i only know little bit of C and looked but i couldn't figure out anything :sweat_smile: