How does Numpy build system detect the change of .c source file?

Hi everyone! I 'm here again. Recently I 'm trying to understand the C code with output-debug method, inserting many print statements. I was doing well with it until one day: I changed a file called loops_utils.h.src located in numpy/core/src/umath by inserting some "printf", but after I re-built the Numpy from source, the changes didn't apply. Specifically, I added: printf(" ??????? "); in line 80, but after re-building it didn't output "??????". I found that when I ran "python setup.py build_ext --inplace", the output info seemed to tell me that nothing has been compiled, because normally when something changed, it will output: > x86-64-conda-linux-gnu-cc: xxxxxx.dispatch.c What's more interesting is that: after I changed the file loops_arithm_fp.dispatch.c.src, and then rebuilt, the change to loops_utils.h.src applied, with the screen full of "??????". I tested it for many times that each time I modify loops_utils.h.src, and the change doesn't apply after re-building; while after I modify loops_arithm_fp.dispatch.c.src, the change to loops_utils.h.src starts to apply. It seems to be related to how build system detects the change, I guuess. Can someone explain why this will happen or point out what I 've missed?

On Wed, Nov 2, 2022 at 9:30 AM 腾刘 <27rabbitlt@gmail.com> wrote:
I don't think you've missed anything, that's a bug in one of the setup.py files. The build system (distutils + numpy.distutils) is bad at automatically figuring out what is used, so sometimes it needs an explicit hint with `depends=['some_header.h.src']` - it looks like that is missing here. Cheers, Ralf

On Wed, Nov 2, 2022 at 9:30 AM 腾刘 <27rabbitlt@gmail.com> wrote:
I don't think you've missed anything, that's a bug in one of the setup.py files. The build system (distutils + numpy.distutils) is bad at automatically figuring out what is used, so sometimes it needs an explicit hint with `depends=['some_header.h.src']` - it looks like that is missing here. Cheers, Ralf
participants (2)
-
Ralf Gommers
-
腾刘