Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crashing with "IOError: [Errno 2] No such file or directory: '[..].c'" #113

Open
hartwork opened this issue Mar 13, 2017 · 9 comments
Open

Comments

@hartwork
Copy link

hartwork commented Mar 13, 2017

Hi!

This looks related to libtool (#23) and similar to #11 but since these are long closed and I am running the latest version, it may not be the same thing:

$ pip list 2>/dev/null | fgrep cpp-coveralls
cpp-coveralls (0.3.12)

$ cpp-coveralls --dryrun
[..]
Traceback (most recent call last):
  File "/usr/local/bin/cpp-coveralls", line 11, in <module>
    sys.exit(run())
  File "/usr/local/lib/python2.7/dist-packages/cpp_coveralls/__init__.py", line 96, in run
    cov_report = coverage.collect(args)
  File "/usr/local/lib/python2.7/dist-packages/cpp_coveralls/coverage.py", line 447, in collect
    with io.open(source_file_path, mode='rb') as src_file:
IOError: [Errno 2] No such file or directory: 'PROJECT_ROOT/SUB_FOLDER/lib/lib/SOME.c'

Related files are located at:

  • PROJECT_ROOT/SUB_FOLDER/lib/.libs/SOME.gcda
  • PROJECT_ROOT/SUB_FOLDER/lib/.libs/SOME.gcno
  • PROJECT_ROOT/SUB_FOLDER/lib/.libs/SOME.o
  • PROJECT_ROOT/SUB_FOLDER/lib/SOME.c
  • PROJECT_ROOT/SUB_FOLDER/lib/SOME.gcno
  • PROJECT_ROOT/SUB_FOLDER/lib/SOME.lo
  • PROJECT_ROOT/SUB_FOLDER/lib/SOME.o
  • PROJECT_ROOT/SUB_FOLDER/SOME.c.gcov

Best, Sebastian

@hartwork
Copy link
Author

Any news? I cannot use Coveralls before this is fixed :(

@eddyxu
Copy link
Owner

eddyxu commented Mar 29, 2017

Could you tell me what is the content in *.gcno and *.gcov? cpp-coveralls uses .gcov to find the files. So we needs to know how these files are generated.

Thanks

@hartwork
Copy link
Author

hartwork commented Mar 29, 2017

Hi!

This is what I do precisely:

git clone https://github.com/libexpat/libexpat.git
cd libexpat
./buildconf.sh
./qa.sh coverage
cpp-coveralls --dryrun --dump FOO.json

The ./qa.sh coverage can be replace by ..

CFLAGS='--coverage --no-inline' CXXFLAGS='--coverage --no-inline' ./configure
make all check
find lib -name '*.gcda' | sort | xargs gcov

.. if you want to keep it minimal. .gcno files seem to be created during make check.

Does that help?

@myint
Copy link
Collaborator

myint commented Apr 9, 2017

@hartwork I can't reproduce this.

$ git clone https://github.com/libexpat/libexpat.git
Cloning into 'libexpat'...
$ cd libexpat
$ ./buildconf.sh
-bash: ./buildconf.sh: No such file or directory

@chrisosaurus
Copy link
Collaborator

it seems buildconf.sh is inside expat/

Here are the updated instructions:

$ git clone https://github.com/libexpat/libexpat.git
Cloning into 'libexpat'...
[...]
$ cd libexpat/expat/
$ ./buildconf.sh
[...]
$ ./qa.sh coverage
[...]
$ cpp-coveralls --dryrun --dump FOO.json

I'm not able to test cpp-coveralls yet, but the other steps WFM.

@hartwork
Copy link
Author

it seems buildconf.sh is inside expat/

Yes, sorry.

$ cd libexpat/expat/

Exactly.

@bagder
Copy link

bagder commented Jun 2, 2017

I think I have the exact same problem when I try to add coveralls support in the curl project, visible in this travis build.

@bagder
Copy link

bagder commented Jun 3, 2017

I found a work-around. By specifying each source directory with -i, it seems this error can be avoided. I still consider it a bug, but this way I think I can still use it.

@blueyed
Copy link
Contributor

blueyed commented Jul 18, 2017

Seeing this also (https://travis-ci.org/awesomeWM/awesome/jobs/255010729):

luacov reports:

CMakeCCompilerId.gcda:cannot open data file, assuming not executed
File 'CMakeCCompilerId.c'
Lines executed:0.00% of 8
Creating 'CMakeCCompilerId.c.gcov'

Then cpp-coveralls crashed on it:

Traceback (most recent call last):
  File "/usr/bin/coveralls", line 11, in <module>
    load_entry_point('cpp-coveralls==0.3.12', 'console_scripts', 'coveralls')()
  File "/usr/lib/python2.7/site-packages/cpp_coveralls/__init__.py", line 96, in run
    cov_report = coverage.collect(args)
  File "/usr/lib/python2.7/site-packages/cpp_coveralls/coverage.py", line 447, in collect
    with io.open(source_file_path, mode='rb') as src_file:
IOError: [Errno 2] No such file or directory: '/src/awesome/build/CMakeCCompilerId.c'

It think in this case the file gets created/considered by specifying/using coverage already before cmake builds the project, via:

  export CFLAGS="-fprofile-arcs -ftest-coverage"
  export LDFLAFS="-fprofile-arcs -ftest-coverage"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants