Skip to content

analyzes and helps to solve various compilation and system errors

Notifications You must be signed in to change notification settings

makelinux/errors_resolver

Repository files navigation

Errors Resolver

Errors Resolver provides resolutions or recommendations for standard errors. For example, it analyzes some build errors caused by missing components, searches the missing components in the system environment and provides a location to these missing components.

For example:

echo "undefined reference to `pthread_create'" | ./errors_resolver.py

Output with solution:

LDLIBS+=' -l pthread';

In this example errors_resolver.py searches tags and provides the missing header file.

Demonstrations:

Resolving compilation configuration errors:

./errors_resolver_demo

You can see saved output in file errors_resolver_demo.log

Run above demo with cross compiler:

CC=arm-linux-gnueabi-gcc ./errors_resolver_demo

This demo was tested on Ubuntu, where gcc-arm-linux-gnueabi and qemu-user are installed.

Demo of resolving error 'command not found'

Helper /usr/lib/command-not-found resolves the error in interactive shell. To resolve errors in subroutine run:

./command-not-found-demo

Analyze system logs

sudo ./errors_resolver.py /var/log/*log

Resolving various errors from a log file:

./errors_resolver.py < errors.log

Description of core application errors_resolver.py

Input:

Compilation and system errors. Output of compilation or execution log with errors can passed to output of resolver.

Output:

Fixes or recommendations to solve errors in form of modification of environment variables or shell commands.

Features:

Analyzes warnings and errors:

  • implicit declaration
  • undeclared symbol
  • undefined symbol
  • library not found or missing
  • command not found
  • decodes numeric system errno
  • catches some disk errors

Demo supports cross compiler

Provides modification of standard environment variables:

  • CPATH, CPPFLAGS, LIBRARY_PATH, LDFLAGS, LDLIBS, LD_LIBRARY_PATH

Uses tools for searching of missing components:

  • ctags, nm, find
  • /usr/lib/command-not-found
  • apt-file search

Searching for not installed packages

 # assure that demo package is not installed
 test -e /usr/include/aalib.h && (sudo apt-get -y remove libaa1-dev || sudo yum remove -y aalib-devel)
 echo "#include <aalib.h>" | gcc -E - |& ./errors_resolver.py
 gcc -l aa |& ./errors_resolver.py

Both examples above give output: install+=' libaa1-dev'

Regression test:

(./errors_resolver_demo && CC=arm-linux-gnueabi-gcc ./errors_resolver_demo && ./command-not-found-demo && ./errors_resolver.py errors.log && echo PASSED) > regression_test.log 2>&1 && echo PASSED || (tail regression_test.log; false)

To to list:

  • Analyze more ./configure errors.

You are welcome to request additional features in the form of erroneous sample source code (see errors_resolver_sample.c), sample errors and solutions.

For further information you are welcome to read sources.

Thanks

About

analyzes and helps to solve various compilation and system errors

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published