Your browser was unable to load all of the resources. They may have been blocked by your firewall, proxy or browser configuration.
Press Ctrl+F5 or Ctrl+Shift+R to have your browser try again.

gcov linking issue #3

I'm seeing this linking issue with a new bugzoo bug I'm trying to repair. Any ideas of what is the problem? I'm using configure-and-make

2425 challenge_src/src/main.o: In function `bugzoo_sighandler(int)':^M
2426 main.cpp:(.text+0x4): undefined reference to `__gcov_flush'^M
2427 clang: ^[[0;1;31merror: ^[[0mlinker command failed with exit code 1 (use -v      to see invocation)^[[0m^M

here's the majority of the .bugzoo.yml:

languages:
    - CPP
    # getting error with C++
    #- C++
    source-location: /experiment/src
    test-harness:
      context: /experiment/src
      command: ./test.sh ./myprog __ID__
      time-limit: 5
      failing: 1
      passing: 7
      time-limit: 2500
      type: genprog
    compiler:
      context: /experiment/src
      time-limit: 300 
      type: configure-and-make
    coverage:
      context: /experiment/src
      type: gcov
      files-to-instrument:
         - challenge_src/src/main.cpp
  • replies 6
  • views 4.3K
  • likes 0
#2

and the docker container does have the gcov lib:

docker@d79f9349bbbf:/experiment/src$ find / -type f -name "libgcov.a"
/usr/lib/gcc/x86_64-linux-gnu/8/libgcov.a
/usr/lib/gcc/x86_64-linux-gnu/7/libgcov.a

I launched a bugzoo container and manually launched the --coverage with the configuration command and didn’t run into the linking issue.

Looking at the bugzoo log, it looks like the file-with-instrumentation was manipulated. Is that correct? If so, How can I locally reproduce that process?

Edit: Found it in bugzoo/mgr/coverage/gcov.py

#4

It looks like this could be a clang/glibc issue. When you manually compiled, I'm guessing that you didn't manually inject the source code instrumentation that BugZoo/Darjeeling adds when computing coverage? https://github.com/squaresLab/BugZoo/blob/master/bugzoo/mgr/coverage/gcov.py#L18

It might be helpful to try to manually add that instrumentation (to the top of challenge_src/src/main.cpp) and to try to compile the program.

#5

You’re totally right - haven’t injected that code yet. I’ll try that ASAP.
The program I’m working on required clang-7 and libcstd++-8 (for c++17 compatibility), and some other packages. Probably the root of the issue :-/

Okay, figured out the problem, but not sure why it's happening yet.
I also should have noticed it earlier, but I'll blame that on rushing to the airport and then the plane.
Basically the Makefile isn't getting regenerated/overwritten with the configure where CFLAGS/CXXFLAGS/LDFLAGS have --coverage added
When I manually fixed the Makefile, the compile worked.
FYI: my Makefile.am contains:

CXXFLAGS = -MD -Wall -Werror -std=c++17 -O3  -DNO_TESTBED
LDFLAGS = -std=c++17 -lstdc++fs -O3

...and that's it. i'm new to automake (as in this is the first time I've ever done it) and it looks like I have to always pass these flags via configure.

BUT I'm not seeing how I can tell BugZoo YML file to pass in these flags as a baseline compile for configure-and-make type?

Instead, it looks like I can convert it to simple and follow your bugzoo example with the instrumentation command specifically outlined.