How to remove Profiling *.gcda:Cannot open errors with python virtualenv builder?

前端 未结 3 2045
悲&欢浪女
悲&欢浪女 2020-12-18 01:04

In jenkins output I am getting the following errors. Is this a problem or can it be silenced?

profiling:/opt/Python-3.6.1/Python/structmember.gc         


        
相关标签:
3条回答
  • 2020-12-18 01:42

    This happened to me when I did ./configure --enable-optimizations. If you remove --enable-optimizations, compile and install it again - these messages are not shown anymore.

    To sum things up, here's an example with a fresh version of Python:

    wget https://www.python.org/ftp/python/3.6.3/Python-3.6.3.tgz
    tar xvf Python-3.6.3.tgz
    cd Python-3.6.3
    ./configure
    make
    sudo make altinstall
    python3.6
    
    0 讨论(0)
  • 2020-12-18 01:56

    The gcda files are gcc profiling records, which are used for seeing which functions the CPU spent most of its time in. This tells you where you can get the most bang for your buck, when optimising the code.

    You can retain the Python code opinisations, but not have the profiling, by using the configuration options --enable-optimizations --disable-profiling. Well, worked for me.

    As the configure script will tell you, if you do not have the --enable-optimizations you will lose out on the best performance.

    You are probably getting gcda files because you interrupted the Python build part-way through. When you run with --enable-optimizations the Python build run in three phases

    • Builds the code
    • Runs all the test modules to profile the code
    • Re-compiles the code to optimise it based on the profiling

    It pretty common to think the test phase is just to check the code is working correctly, as this is what it looks like it is doing, but be patient and leave it and it will compile again, the second time omitting the profiling.

    So, its better to compile with --enable-optimizations and without --disable-profiling and just wait, as you should get better code that way.

    0 讨论(0)
  • 2020-12-18 01:57

    I fixed this issue by doing change owner. I was setting up homeassistant using Python 3.6.3 build using ./configure --enable-optimizations. From my virtual env i got these errors but fixed them doing: from su / root account

    sudo chown -R homeassistant:homeassistant /home/pi/Python-3.6.3
    

    I thought maybe it could help other people ;) Have a nice day! Ciao!

    0 讨论(0)
提交回复
热议问题