Code Monkey home page Code Monkey logo

bear's People

Contributors

breser avatar c72578 avatar drbeco avatar handrake0724 avatar leleliu008 avatar lnagyatatlassian avatar mamaria-k avatar moisan avatar morxa avatar nweston avatar okhowang avatar peeweep avatar renovate-bot avatar rizsotto avatar rubyzhou2014 avatar saagarjha avatar samu698 avatar sangwoo-joh avatar sebastinas avatar shrkamat avatar smhc avatar smmckay avatar speclad avatar spongman avatar svenpanne avatar thesamesam avatar timangus avatar volker-weissmann avatar wangnangg avatar xaverklemenschits avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

bear's Issues

All tests failed - anyof({'-c'}, take_action(Action.Compile)) syntax error

Everything appears to build fine, but all the tests fail.

Using Scientific Linux 6 (based on RHEL), Linux kernel 2.6.32-504.el6.x86_64

~/Bear $ cmake --version
cmake version 2.8.12.2

~/Bear $ mkdir build
~/Bear $ cd build/
~/Bear/build $ cmake -DCMAKE_INSTALL_PREFIX:PATH=/workspace/local/ ..
-- The C compiler identification is GNU 4.8.0
-- Check for working C compiler: /opt/apps/ossw/applications/gcc/gcc-4.8/sl6/bin/gcc
-- Check for working C compiler: /opt/apps/ossw/applications/gcc/gcc-4.8/sl6/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Performing Test C99_SUPPORTED
-- Performing Test C99_SUPPORTED - Success
-- Looking for execve
-- Looking for execve - found
-- Looking for execv
-- Looking for execv - found
-- Looking for execvpe
-- Looking for execvpe - found
-- Looking for execvp
-- Looking for execvp - found
-- Looking for execvP
-- Looking for execvP - not found
-- Looking for execl
-- Looking for execl - found
-- Looking for execlp
-- Looking for execlp - found
-- Looking for execle
-- Looking for execle - found
-- Looking for posix_spawn
-- Looking for posix_spawn - found
-- Looking for posix_spawnp
-- Looking for posix_spawnp - found
-- Looking for _NSGetEnviron
-- Looking for _NSGetEnviron - not found
-- Looking for scons
-- Looking for scons -- found
-- Looking for qmake
-- Looking for qmake -- found
-- Found PythonInterp: /usr/bin/python (found version "2.6.6")
-- Configuring done
-- Generating done
-- Build files have been written to: /h1/keith/Bear/build

~/Bear/build $ make all
Scanning dependencies of target ear
[100%] Building C object libear/CMakeFiles/ear.dir/ear.c.o
Linking C shared library libear.so
[100%] Built target ear

~/Bear/build $ make install
[100%] Built target ear
Install the project...
-- Install configuration: "Release"
-- Up-to-date: /workspace/local/share/doc/bear/COPYING
-- Up-to-date: /workspace/local/share/doc/bear/README.md
-- Up-to-date: /workspace/local/share/doc/bear/ChangeLog.md
-- Installing: /workspace/local/lib64/libear.so
-- Installing: /workspace/local/bin/bear
-- Installing: /workspace/local/share/man/man1/bear.1

~/Bear/build $ make check
[ 50%] Built target ear
Scanning dependencies of target exec_anatomy
[100%] Building C object test/exec_anatomy/CMakeFiles/exec_anatomy.dir/main.c.o
Linking C executable exec_anatomy
[100%] Built target exec_anatomy
Scanning dependencies of target check
UpdateCTestConfiguration from :/h1/keith/Bear/build/test/DartConfiguration.tcl
UpdateCTestConfiguration from :/h1/keith/Bear/build/test/DartConfiguration.tcl
Test project /h1/keith/Bear/build/test
Constructing a list of tests
Done constructing a list of tests
Checking test dependency graph...
Checking test dependency graph end
test 1
Start 1: run_shell_test

1: Test command: /usr/bin/make "run_shell_test"
1: Test timeout computed to be: 9.99988e+06
1: [ 50%] Built target ear
1: Scanning dependencies of target run_shell_test
1: [100%] Running module tests with shell
1: File "/h1/keith/Bear/build/test/end-to-end/../../bear/bear", line 351
1: anyof({'-c'}, take_action(Action.Compile)),
1: ^
1: SyntaxError: invalid syntax
1: make[7]: *** [test/end-to-end/CMakeFiles/run_shell_test] Error 1
1: make[6]: *** [test/end-to-end/CMakeFiles/run_shell_test.dir/all] Error 2
1: make[5]: *** [test/end-to-end/CMakeFiles/run_shell_test.dir/rule] Error 2
1: make[4]: *** [test/end-to-end/CMakeFiles/run_shell_test.dir/rule] Error 2
1/5 Test #1: run_shell_test ...................***Failed 0.21 sec
test 2
Start 2: run_scons_test

2: Test command: /usr/bin/make "run_scons_test"
2: Test timeout computed to be: 9.99988e+06
2: [ 50%] Built target ear
2: Scanning dependencies of target run_scons_test
2: [100%] Running module tests with scons
2: File "/h1/keith/Bear/build/test/end-to-end/../../bear/bear", line 351
2: anyof({'-c'}, take_action(Action.Compile)),
2: ^
2: SyntaxError: invalid syntax
2: make[7]: *** [test/end-to-end/CMakeFiles/run_scons_test] Error 1
2: make[6]: *** [test/end-to-end/CMakeFiles/run_scons_test.dir/all] Error 2
2: make[5]: *** [test/end-to-end/CMakeFiles/run_scons_test.dir/rule] Error 2
2: make[4]: *** [test/end-to-end/CMakeFiles/run_scons_test.dir/rule] Error 2
2/5 Test #2: run_scons_test ...................***Failed 0.19 sec
test 3
Start 3: run_qmake_test

3: Test command: /usr/bin/make "run_qmake_test"
3: Test timeout computed to be: 9.99988e+06
3: [ 50%] Built target ear
3: Scanning dependencies of target run_qmake_test
3: [100%] Running module tests with qmake
3: File "/h1/keith/Bear/build/test/end-to-end/../../bear/bear", line 351
3: anyof({'-c'}, take_action(Action.Compile)),
3: ^
3: SyntaxError: invalid syntax
3: make[7]: *** [test/end-to-end/CMakeFiles/run_qmake_test] Error 1
3: make[6]: *** [test/end-to-end/CMakeFiles/run_qmake_test.dir/all] Error 2
3: make[5]: *** [test/end-to-end/CMakeFiles/run_qmake_test.dir/rule] Error 2
3: make[4]: *** [test/end-to-end/CMakeFiles/run_qmake_test.dir/rule] Error 2
3/5 Test #3: run_qmake_test ...................***Failed 0.91 sec
test 4
Start 4: run_exec_anatomy

4: Test command: /h1/keith/Bear/build/test/exec_anatomy/run.sh
4: Test timeout computed to be: 9.99988e+06
4: File "/h1/keith/Bear/build/test/exec_anatomy/../../bear/bear", line 351
4: anyof({'-c'}, take_action(Action.Compile)),
4: ^
4: SyntaxError: invalid syntax
4/5 Test #4: run_exec_anatomy .................***Failed 0.04 sec
test 5
Start 5: result_code_check

5: Test command: /h1/keith/Bear/build/test/result_code/run.sh
5: Test timeout computed to be: 9.99988e+06
5: File "/h1/keith/Bear/build/test/result_code/../../bear/bear", line 351
5: anyof({'-c'}, take_action(Action.Compile)),
5: ^
5: SyntaxError: invalid syntax
5: File "/h1/keith/Bear/build/test/result_code/../../bear/bear", line 351
5: anyof({'-c'}, take_action(Action.Compile)),
5: ^
5: SyntaxError: invalid syntax
5/5 Test #5: result_code_check ................***Failed 0.04 sec

0% tests passed, 5 tests failed out of 5

Total Test time (real) = 1.41 sec

The following tests FAILED:
1 - run_shell_test (Failed)
2 - run_scons_test (Failed)
3 - run_qmake_test (Failed)
4 - run_exec_anatomy (Failed)
5 - result_code_check (Failed)
Errors while running CTest
make[3]: *** [test/CMakeFiles/check] Error 8
make[2]: *** [test/CMakeFiles/check.dir/all] Error 2
make[1]: *** [test/CMakeFiles/check.dir/rule] Error 2
make: *** [check] Error 2

add verbose flag

might be useful to dump some statistic at the end of the run. like this:

total number of child processes: 104
..considered as compiler execution: 12
....found source files: 12
....cancel parameters match: 8
......written in output file: 4

As static analyzer, I need each invoked compiler path to select which parser to use.

First of All, Thanks for your distributions.

I have parser for static analysis, which accepts various language dialects. So It need configuration for language dialect(like how to deal with command line argument, language extensions, predefined macro, size of int ...)
Actually, Which compiler used to compile is very important in this area.

What do you think?

How to use compile_commands.json?

I just learn how to wirte clang libtooling. Bear project is very helpful for me. Thanks.
Now I have installed Bear and create the file compile_commands.json by compiling eglibc source code. But when I use libtooling to analyze file, there is still error "LLVM ERROR: Could not auto-detect compilation database for file, No compilation database found json-compilation-database: Error while opening JSON database: No such file or directory".
I get compile_commands.json in the /build. I use ln -s $PWD/compile_commands.json path/to/source/. It is still same error. I also copy compile_commands.json to current directory of the file which is prepared to analyze. Same error.

Can you give me some hits? What did I miss?

Thank you very much!

Sun

Fails with make argument

Hi thanks for the last bugfix. I don't get any errors anymore.

But now it works only in cases where I only pass make without anymore arguments.

It would be awesome if one could call
bear -- make debug

from the description I guess this should already be possible, however it just generates me an empty file.

Cheers

Fails (sometimes) running ./configure of sqlite-autotoconf-3071502

(Ideally I don't actually want to run ./configure under bear, but avoiding doing so is non-trivial, so I'd prefer to put up with the useless conftest.o information.)

It seems to fail more often than not, here:

checking for ftn... no
checking whether we are using the GNU Fortran 77 compiler... no
checking whether accepts -g... no
checking the maximum length of command line arguments... malloc: Cannot allocate memory
connect: Connection refused

Incorrect escaping

I'm using Bear to create a compilation database for PostgreSQL. One of the commands executed by the the PostgreSQL build system is:

/usr/local/bin/clang -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-    strict-aliasing -fwrapv -g -I../../../../src/include -D_GNU_SOURCE  -DDLSUFFIX=\".so\"  -c -o dfmgr.o dfmgr.c

Notice the -DDLSUFFIX=\".so\" flag.

The compilation database entry created by bear is:

{
    "command": "/usr/local/bin/clang -O2 -Wall -Wmissing-prototypes -Wpointer-arith -Wdeclaration-after-statement -Wendif-labels -Wmissing-format-attribute -Wformat-security -fno-strict-aliasing -fwrapv -g -../../../../src/include -D_GNU_SOURCE -DDLSUFFIX=\".so\" -c -o dfmgr.o dfmgr.c",
    "directory": "/dataware/postgres/src/backend/utils/fmgr",
    "file": "/dataware/postgres/src/backend/utils/fmgr/dfmgr.c"
}

Notice the -DDLSUFFIX=\".so\" flag. This is incorrect, because CMake is interpreting this flag after escaping, i.e., as -DDLSUFFIX=".so", which is causing that file to compile incorrectly. (I can't tell if the \character is being dropped altogether but the " character is being escaped correctly, or if no escaping is happening at all.) Instead, the compilation database entry created by bear should have -DDLSUFFIX=\\\".so\\\", which will then be interpreted by CMake as -DDLSUFFIX=\".so\", as desired.

rpath stripping -- is that intended?

I notice when building and installing bear on a different box, I get the following at build time:
[root@nydevd015 Bear-master]# make install
[ 60%] Built target bear
[100%] Built target ear
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/share/doc/bear/COPYING
-- Installing: /usr/local/share/doc/bear/README.md
-- Installing: /usr/local/share/doc/bear/ChangeLog.md
-- Installing: /usr/local/bin/bear
-- Removed runtime path from "/usr/local/bin/bear"
-- Installing: /usr/local/lib64/libear.so
-- Installing: /usr/local/etc/bear.conf
-- Installing: /usr/local/share/man/man1/bear.1

Needless to say, this requires that /usr/local/lib be added to the LD_LIBRARY_PATH.

I decided instead to modify the build script to add:
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)

Which approach do you prefer?

4 out of 6 tests failed

ant@rh-6:~/Packages/Bear-master$ make check
[ 33%] Built target bear
[ 60%] Built target ear
[ 66%] Built target exec_anatomy
[100%] Built target unit_test
UpdateCTestConfiguration  from :/home/ajs4/Packages/Bear-master/test/DartConfiguration.tcl
UpdateCTestConfiguration  from :/home/ajs4/Packages/Bear-master/test/DartConfiguration.tcl
Test project /home/ajs4/Packages/Bear-master/test
Constructing a list of tests
Done constructing a list of tests
Checking test dependency graph...
Checking test dependency graph end
test 1
    Start 1: unit_test

1: Test command: /home/ajs4/Packages/Bear-master/test/unit_test/unit_test
1: Test timeout computed to be: 9.99988e+06
1/6 Test #1: unit_test ........................   Passed    0.05 sec
test 2
    Start 2: run_shell_test

2: Test command: /usr/bin/make "run_shell_test"
2: Test timeout computed to be: 9.99988e+06
2: make[4]: *** No rule to make target `run_shell_test'.  Stop.
2/6 Test #2: run_shell_test ...................***Failed    0.05 sec
test 3
    Start 3: run_scons_test

3: Test command: /usr/bin/make "run_scons_test"
3: Test timeout computed to be: 9.99988e+06
3: make[4]: *** No rule to make target `run_scons_test'.  Stop.
3/6 Test #3: run_scons_test ...................***Failed    0.05 sec
test 4
    Start 4: run_qmake_test

4: Test command: /usr/bin/make "run_qmake_test"
4: Test timeout computed to be: 9.99988e+06
4: make[4]: *** No rule to make target `run_qmake_test'.  Stop.
4/6 Test #4: run_qmake_test ...................***Failed    0.05 sec
test 5
    Start 5: run_exec_anatomy

5: Test command: /home/ajs4/Packages/Bear-master/test/exec_anatomy/run.sh
5: Test timeout computed to be: 9.99988e+06
5: bear: connect: No such file or directory
5: children process has non zero exit code
5/6 Test #5: run_exec_anatomy .................***Failed    0.47 sec
test 6
    Start 6: result_code_check

6: Test command: /home/ajs4/Packages/Bear-master/test/result_code/run.sh
6: Test timeout computed to be: 9.99988e+06
6/6 Test #6: result_code_check ................   Passed    0.17 sec

33% tests passed, 4 tests failed out of 6

Total Test time (real) =   1.21 sec

The following tests FAILED:
      2 - run_shell_test (Failed)
      3 - run_scons_test (Failed)
      4 - run_qmake_test (Failed)
      5 - run_exec_anatomy (Failed)
Errors while running CTest
make[3]: *** [test/CMakeFiles/check] Error 8
make[2]: *** [test/CMakeFiles/check.dir/all] Error 2
make[1]: *** [test/CMakeFiles/check.dir/rule] Error 2
make: *** [check] Error 2

(RHEL6.1)

Error message on missing config file

When the configuration file cannot be found in the default path, the error message is:

bear: failed to configure: 'file I/O error' in file (null) at line 0

This could be something more descriptive instead.

Empty compile_commands.json when compiling GNOME programs

I tried with gcr and seahorse, two GNOME programs, and the resulting file has only:
[
]

There is output shown when -d is passed though. Here is a sample (the full thing is 2MB -- too big for github).

{
"pid": "26143",
"ppid": "25330",
"function": "execvp",
"directory": "/media/data/sources/gnome-checkout/gcr/gcr",
"command": "mv -f .deps/libgcr_base_3_la-gcr-openssh.Tpo .deps/libgcr_base_3_la-gcr-openssh.Plo"
}
,
{
"pid": "26144",
"ppid": "25330",
"function": "execvp",
"directory": "/media/data/sources/gnome-checkout/gcr/gcr",
"command": "/bin/sh -c "echo " CC " libgcr_base_3_la-gcr-openssh-importer.lo;/bin/sh ../libtool --silent --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I.. -pthread -I/home/hashem/sources/gnome-install/include/gio-unix-2.0/ -I/home/hashem/sources/gnome-install/include/glib-2.0 -I/home/hashem/sources/gnome-install/lib64/glib-2.0/include -I/home/hashem/sources/gnome-install/include/p11-kit-1 -DG_LOG_DOMAIN=\"Gcr\" -DGCR_API_SUBJECT_TO_CHANGE -DLOCALEDIR=\""/home/hashem/sources/gnome-install/share/locale"\" -DGCK_API_SUBJECT_TO_CHANGE -DP11_KIT_API_SUBJECT_TO_CHANGE -DGCR_COMPILATION -Wall -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align -Wsign-compare -g -O2 -g -O0 -Wno-strict-aliasing -Wno-sign-compare -MT libgcr_base_3_la-gcr-openssh-importer.lo -MD -MP -MF .deps/libgcr_base_3_la-gcr-openssh-importer.Tpo -c -o libgcr_base_3_la-gcr-openssh-importer.lo test -f 'gcr-openssh-importer.c' || echo './'gcr-openssh-importer.c""
}
,
{
"pid": "26146",
"ppid": "26144",
"function": "execve",
"directory": "/media/data/sources/gnome-checkout/gcr/gcr",
"command": "/bin/sh ../libtool --silent --tag=CC --mode=compile gcc -DHAVE_CONFIG_H -I. -I.. -I.. -I.. -pthread -I/home/hashem/sources/gnome-install/include/gio-unix-2.0/ -I/home/hashem/sources/gnome-install/include/glib-2.0 -I/home/hashem/sources/gnome-install/lib64/glib-2.0/include -I/home/hashem/sources/gnome-install/include/p11-kit-1 -DG_LOG_DOMAIN="Gcr" -DGCR_API_SUBJECT_TO_CHANGE -DLOCALEDIR="/home/hashem/sources/gnome-install/share/locale" -DGCK_API_SUBJECT_TO_CHANGE -DP11_KIT_API_SUBJECT_TO_CHANGE -DGCR_COMPILATION -Wall -Wchar-subscripts -Wmissing-declarations -Wmissing-prototypes -Wnested-externs -Wpointer-arith -Wcast-align -Wsign-compare -g -O2 -g -O0 -Wno-strict-aliasing -Wno-sign-compare -MT libgcr_base_3_la-gcr-openssh-importer.lo -MD -MP -MF .deps/libgcr_base_3_la-gcr-openssh-importer.Tpo -c -o libgcr_base_3_la-gcr-openssh-importer.lo gcr-openssh-importer.c"
}
,
{
"pid": "26152",
"ppid": "26150",
"function": "execve",
"directory": "/media/data/sources/gnome-checkout/gcr/gcr",
"command": "/usr/bin/sed s/([`"$\])/\\1/g"
}

bear fails to build on OS X 10.7.5

Linking C shared library libear.dylib
Undefined symbols for architecture x86_64:
"_environ", referenced from:
_bear_get_environ in environ.c.o
(maybe you meant: _bear_get_environ, _bear_update_environ )
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [src/libear.dylib] Error 1
make[1]: *** [src/CMakeFiles/ear.dir/all] Error 2
make: *** [all] Error 2

tests run_shell_test and run_exec_anatomy on OS X Mavericks

Hi @rizsotto ... I was trying to install Bear on my computer and building goes without errors but when trying to run make check 2 of the 5 test cases fail for me: run_shell_test and run_exec_anatomy.

run_shell_test:
In this case the compilation database file is generated but I see that there are duplicated entries. It has 12 entries and according to the ./test/end-to-end/compile.sh script it should have only 4. Looks like each call to g++ ends up generating two more. Here you have the json file in case you want to have a look at it:
http://pastebin.com/M8p49t9j

run_exec_anatomy:
Again, the compilation database generated by the test case seems to be different from the one expected (/test/exec_anatomy/expected.json). And here the json file for this case:
http://pastebin.com/Evb2bzfv

I am running on:
Darwin tlf32.wu-wien.ac.at 13.1.0 Darwin Kernel Version 13.1.0: Thu Jan 16 19:40:37 PST 2014; root:xnu-2422.90.20~2/RELEASE_X86_64 x86_64

bear -d changes format of output json

First time using bear, I included the -d debug flag just to get an idea what it was doing.
So filtering was turned off, apparently as a result of this line:
https://github.com/rizsotto/Bear/blob/master/src/main.c#L82

and the resulting output had the pid, ppid, etc keys instead of the "file" key,
as per this line here:
https://github.com/rizsotto/Bear/blob/master/src/output.c#L76

making it unusable with oclint, which was the intended consumer for the JSON.

removing -d makes it work fine, but IMO a 'debug' flag shouldn't change the behavior this much. It took some digging to figure out a solution.

Bear breaks when stopped

Hi,

when I built with GNU make under bear (under Linux here)

$ bear -- make

sending bear SIGSTOP (e.g. by pressing CtrlZ) and letting it continue leads to failures like

bear: connect: No such file or directory

and hard failures in make.

bear generate redundant database when using wllvm

This is a rare use-case: when using wllvm Bear always generates more compilation database entries than expected.

As the README.md mentioned, that project does 2 things when CC=wllvm and CXX=wllvm++ during compilation:

  • invoke regular compiler to build a real object
  • Do bitcode compilation with the corresponding compiler commands specified.

In this sense, I was hoping

min.out: main.o min.o
        $(CC) main.o min.o -o $@
main.o:
        $(CC) main.c -c -o $@ 
min.o:
        $(CC) min.c -c -o $@

Will generate compile commands like:

clang main.c -c -o main.o
clang min.c -c -o min.o
clang -emit-llvm main.c -c -o .main.o.bc
clang -emit-llvm main.c -c -o .min.o.bc

But the inside compiler_commands.json there are 9 entries for the same compilation commands for each build target. Also I notice that wllvm seems correct here since when set WLLVM_OUTPUT=debug it only prints each compilation once. So this may be an issue for Bear.
But as my case is not the regular compilation practice, I guess this should be of low priority.

unlink: Is a directory

Hi i wanted to try your tool but it always fails:

[pc]$ bear -d -- make
unlink: Is a directory
[pc]$ g++ -c -m64 -pipe -march=x86-64 -mtune=generic -O2 -pipe -fstack-protector --param=ssp-buffer-size=4 -Wall -W -I/usr/share/qt4/mkspecs/linux-g++-64 -I. -o main.o main.cpp
connect: Connection refused
make: *** [main.o] Error 1
^C

the file contains only "["

I use archlinux with gcc 4.8.1, linux 3.9.4-1 do you have any Idea why this happens?

execle causes bear to segfault on 32 bit systems

A simple execle example causes bear to segfault consistently on 32 bit systems.

#include <unistd.h>

int main()
{
  char* const envp[] = {
    "THIS=THAT",
    NULL
  };

  execle("/bin/echo", "echo", "one", "two", "three", "four", NULL, envp);
}

Compiling it and running it through bear gives me the following traceback:

#0  strlen () at ../sysdeps/i386/i486/strlen.S:39
#1  0xf7ed90b6 in __GI___strdup (s=0x616c62 <Address 0x616c62 out of bounds>) at strdup.c:41
#2  0xf7fd6be6 in bear_strings_copy (in=in@entry=0x80484ee) at /tmp/bear-1.3/src/stringarray.c:73
#3  0xf7fd7197 in update_environment (envp=envp@entry=0x80484ee) at /tmp/bear-1.3/src/execs.c:354
#4  0xf7fd725b in call_execve (path=0x80484f2 "/bin/echo", argv=0x804a048, envp=0x80484ee) at /tmp/bear-1.3/src/execs.c:252
#5  0xf7fd7636 in execle (path=0x80484f2 "/bin/echo", arg=arg@entry=0x80484f7 "echo") at /tmp/bear-1.3/src/execs.c:201
#6  0x0804834d in main () at test-execle.c:11

It works perfectly fine on any 64 bit system I've tried it on. I've debugged this a bit and noticed that envp is some bytes of in execle but I don't know why.

Note that this makes bear's test suite fail (exec_anatomy fails) on 32 bit systems.

filter out failed exec calls

This requires post processing or delayed writes. The information about the exec fails is available only when the exec returns with an error code. It means the client lib shall connect twice. (And maybe the between the two connections there were another client wrote something.)

Plan to change the protocol between the client lib and the bin...

MSG { pid, method, args, cwd }
MSG { pid, result }

Client code would write all of them into a file and do post processing when child process quits.

Looking for _NSGetEnviron ( Debian ) - not found on 1.3, 1.4, master

On:
PRETTY_NAME="Debian GNU/Linux 7 (wheezy)"
NAME="Debian GNU/Linux"
VERSION_ID="7"
VERSION="7 (wheezy)"
ID=debian
ANSI_COLOR="1;31"
HOME_URL="http://www.debian.org/"
SUPPORT_URL="http://www.debian.org/support/"
BUG_REPORT_URL="http://bugs.debian.org/"

With cmake2.8.12 and same with 2.8.8 I get:
2014-01-15 19:57:05 oj@fatman ~/clang-tools/Bear-1.4/build $ cmake ..
-- The C compiler identification is GNU 4.7.2
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Found PkgConfig: /usr/bin/pkg-config (found version "0.26")
-- checking for module 'libconfig>=1.4'
-- package 'libconfig>=1.4' not found
CMake Error at /usr/local/share/cmake-2.8/Modules/FindPkgConfig.cmake:279 (message):
A required package was not found
Call Stack (most recent call first):
/usr/local/share/cmake-2.8/Modules/FindPkgConfig.cmake:333 (_pkg_check_modules_internal)
CMakeLists.txt:22 (pkg_check_modules)

-- Try C99 C flag = [ ]
-- Performing Test C99_FLAG_DETECTED
-- Performing Test C99_FLAG_DETECTED - Failed
-- Try C99 C flag = [-std=c99]
-- Performing Test C99_FLAG_DETECTED
-- Performing Test C99_FLAG_DETECTED - Success
-- Looking for vfork
-- Looking for vfork - found
-- Looking for execve
-- Looking for execve - found
-- Looking for execv
-- Looking for execv - found
-- Looking for execvpe
-- Looking for execvpe - found
-- Looking for execvp
-- Looking for execvp - found
-- Looking for execvP
-- Looking for execvP - not found
-- Looking for execl
-- Looking for execl - found
-- Looking for execlp
-- Looking for execlp - found
-- Looking for execle
-- Looking for execle - found
-- Looking for posix_spawn
-- Looking for posix_spawn - found
-- Looking for posix_spawnp
-- Looking for posix_spawnp - found
-- Looking for _NSGetEnviron
-- Looking for _NSGetEnviron - not found
-- Looking for scons
-- Looking for qmake
-- Found PythonInterp: /usr/bin/python (found version "2.7.3")
-- Configuring incomplete, errors occurred!
See also "/home/ole_jak/clang-tools/Bear-1.4/build/CMakeFiles/CMakeOutput.log".
See also "/home/ole_jak/clang-tools/Bear-1.4/build/CMakeFiles/CMakeError.log".

I get this for current master, 1.4 release, 1.3 release.


CMakeError.log:
Performing C SOURCE FILE Test C99_FLAG_DETECTED failed with the following output:
Change Dir: /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec1153439699/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec1153439699.dir/build.make CMakeFiles/cmTryCompileExec1153439699.dir/build
make[1]: Entering directory /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp' /usr/local/bin/cmake -E cmake_progress_report /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec1153439699.dir/src.c.o /usr/bin/cc -DC99_FLAG_DETECTED -o CMakeFiles/cmTryCompileExec1153439699.dir/src.c.o -c /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/src.c /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/src.c:51:29: error: expected ‘;’, ‘,’ or ‘)’ before ‘text’ /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/src.c: In function ‘main’: /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/src.c:107:18: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘newvar’ /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/src.c:107:18: error: ‘newvar’ undeclared (first use in this function) /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/src.c:107:18: note: each undeclared identifier is reported only once for each function it appears in /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/src.c:117:3: error: ‘for’ loop initial declarations are only allowed in C99 mode /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/src.c:117:3: note: use option -std=c99 or -std=gnu99 to compile your code make[1]: Leaving directory/home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp'
make[1]: *** [CMakeFiles/cmTryCompileExec1153439699.dir/src.c.o] Error 1
make: *** [cmTryCompileExec1153439699/fast] Error 2

Source file was:

include <stdarg.h>

include <stdbool.h>

include <stdlib.h>

include <wchar.h>

include <stdio.h>

// Check varargs macros. These examples are taken from C99 6.10.3.5.

define debug(...) fprintf (stderr, VA_ARGS)

define showlist(...) puts (#VA_ARGS)

define report(test,...) ((test) ? puts (#test) : printf (VA_ARGS))

static void
test_varargs_macros (void)
{
int x = 1234;
int y = 5678;
debug ("Flag");
debug ("X = %d\n", x);
showlist (The first, second, and third items.);
report (x>y, "x is %d but y is %d", x, y);
}

// Check long long types.

define BIG64 18446744073709551615ull

define BIG32 4294967295ul

define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)

if !BIG_OK

your preprocessor is broken;

endif

if BIG_OK

else

your preprocessor is broken;

endif

static long long int bignum = -9223372036854775807LL;
static unsigned long long int ubignum = BIG64;

struct incomplete_array
{
int datasize;
double data[];
};

struct named_init {
int number;
const wchar_t *name;
double average;
};

typedef const char *ccp;

static inline int
test_restrict (ccp restrict text)
{
// See if C++-style comments work.
// Iterate through items via the restricted pointer.
// Also check for declarations in for loops.
for (unsigned int i = 0; *(text+i) != '\0'; ++i)
continue;
return 0;
}

// Check varargs and va_copy.
static void
test_varargs (const char *format, ...)
{
va_list args;
va_start (args, format);
va_list args_copy;
va_copy (args_copy, args);

const char *str = NULL;
int number = 0;
float fnumber = 0.0;

while (_format)
{
switch (_format++)
{
case 's': // string
str = va_arg (args_copy, const char *);
break;
case 'd': // int
number = va_arg (args_copy, int);
break;
case 'f': // float
fnumber = va_arg (args_copy, double);
break;
default:
break;
}
}
va_end (args_copy);
va_end (args);

number = (number != 0) && (str != NULL) && (fnumber != 0.0);
}

int
main ()
{

// Check bool.
_Bool success = false;

// Check restrict.
if (test_restrict ("String literal") == 0)
success = true;
char *restrict newvar = "Another string";

// Check varargs.
test_varargs ("s, d' f .", "string", 65, 34.234);
test_varargs_macros ();

// Check flexible array members.
struct incomplete_array *ia =
malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
ia->datasize = 10;
for (int i = 0; i < ia->datasize; ++i)
ia->data[i] = i * 1.234;

// Check named initializers.
struct named_init ni = {
.number = 34,
.name = L"Test wide string",
.average = 543.34343,
};

ni.number = 58;

int dynamic_array[ni.number];
dynamic_array[ni.number - 1] = 543;

// work around unused variable warnings
return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
|| dynamic_array[ni.number - 1] != 543);

;
return 0;
}
Determining if the function execvP exists failed with the following output:
Change Dir: /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec2273797866/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec2273797866.dir/build.make CMakeFiles/cmTryCompileExec2273797866.dir/build
make[1]: Entering directory /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp' /usr/local/bin/cmake -E cmake_progress_report /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec2273797866.dir/CheckFunctionExists.c.o /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=execvP -o CMakeFiles/cmTryCompileExec2273797866.dir/CheckFunctionExists.c.o -c /usr/local/share/cmake-2.8/Modules/CheckFunctionExists.c Linking C executable cmTryCompileExec2273797866 /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec2273797866.dir/link.txt --verbose=1 /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=execvP CMakeFiles/cmTryCompileExec2273797866.dir/CheckFunctionExists.c.o -o cmTryCompileExec2273797866 -rdynamic CMakeFiles/cmTryCompileExec2273797866.dir/CheckFunctionExists.c.o: In functionmain':
CheckFunctionExists.c:(.text+0x15): undefined reference to execvP' collect2: error: ld returned 1 exit status make[1]: Leaving directory/home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp'
make[1]: *** [cmTryCompileExec2273797866] Error 1
make: *** [cmTryCompileExec2273797866/fast] Error 2

Determining if the _NSGetEnviron exist failed with the following output:
Change Dir: /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec2610045503/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec2610045503.dir/build.make CMakeFiles/cmTryCompileExec2610045503.dir/build
make[1]: Entering directory /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp' /usr/local/bin/cmake -E cmake_progress_report /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec2610045503.dir/CheckSymbolExists.c.o /usr/bin/cc -std=c99 -o CMakeFiles/cmTryCompileExec2610045503.dir/CheckSymbolExists.c.o -c /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/CheckSymbolExists.c /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/CheckSymbolExists.c:2:25: fatal error: crt_externs.h: No such file or directory compilation terminated. make[1]: *** [CMakeFiles/cmTryCompileExec2610045503.dir/CheckSymbolExists.c.o] Error 1 make[1]: Leaving directory/home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp'
make: *** [cmTryCompileExec2610045503/fast] Error 2

File /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */

include <crt_externs.h>

int main(int argc, char** argv)
{
(void)argv;

ifndef _NSGetEnviron

return ((int*)(&_NSGetEnviron))[argc];

else

(void)argc;
return 0;

endif

}


CMakeOutput.log:
The system is: Linux - 3.2.0-4-amd64 - x86_64
Compiling the C compiler identification source file "CMakeCCompilerId.c" succeeded.
Compiler: /usr/bin/cc
Build flags:
Id flags:

The output was:
0

Compilation of the C compiler identification source "CMakeCCompilerId.c" produced "a.out"

The C compiler identification is GNU, found in "/home/oj/clang-tools/Bear-1.3/CMakeFiles/2.8.12/CompilerIdC/a.out"

Determining if the C compiler works passed with the following output:
Change Dir: /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec472759118/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec472759118.dir/build.make CMakeFiles/cmTryCompileExec472759118.dir/build
make[1]: Entering directory /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp' /usr/local/bin/cmake -E cmake_progress_report /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec472759118.dir/testCCompiler.c.o /usr/bin/cc -o CMakeFiles/cmTryCompileExec472759118.dir/testCCompiler.c.o -c /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/testCCompiler.c Linking C executable cmTryCompileExec472759118 /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec472759118.dir/link.txt --verbose=1 /usr/bin/cc CMakeFiles/cmTryCompileExec472759118.dir/testCCompiler.c.o -o cmTryCompileExec472759118 -rdynamic make[1]: Leaving directory/home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp'

Detecting C compiler ABI info compiled with the following output:
Change Dir: /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec3819238834/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec3819238834.dir/build.make CMakeFiles/cmTryCompileExec3819238834.dir/build
make[1]: Entering directory /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp' /usr/local/bin/cmake -E cmake_progress_report /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec3819238834.dir/CMakeCCompilerABI.c.o /usr/bin/cc -o CMakeFiles/cmTryCompileExec3819238834.dir/CMakeCCompilerABI.c.o -c /usr/local/share/cmake-2.8/Modules/CMakeCCompilerABI.c Linking C executable cmTryCompileExec3819238834 /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3819238834.dir/link.txt --verbose=1 /usr/bin/cc -v CMakeFiles/cmTryCompileExec3819238834.dir/CMakeCCompilerABI.c.o -o cmTryCompileExec3819238834 -rdynamic Using built-in specs. COLLECT_GCC=/usr/bin/cc COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper Target: x86_64-linux-gnu Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu Thread model: posix gcc version 4.7.2 (Debian 4.7.2-5) COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.7/:/usr/lib/gcc/x86_64-linux-gnu/4.7/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.7/:/usr/lib/gcc/x86_64-linux-gnu/ LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.7/:/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../:/lib/:/usr/lib/ COLLECT_GCC_OPTIONS='-v' '-o' 'cmTryCompileExec3819238834' '-rdynamic' '-mtune=generic' '-march=x86-64' /usr/lib/gcc/x86_64-linux-gnu/4.7/collect2 --sysroot=/ --build-id --no-add-needed --eh-frame-hdr -m elf_x86_64 --hash-style=both -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTryCompileExec3819238834 /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.7/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/4.7 -L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../.. CMakeFiles/cmTryCompileExec3819238834.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/4.7/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crtn.o make[1]: Leaving directory/home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp'

Parsed C implicit link information from above output:
link line regex: [^( _|._[/])(ld|([^/]+-)?ld|collect2)[^/]*( |$)]
ignore line: [Change Dir: /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp]
ignore line: []
ignore line: [Run Build Command:/usr/bin/make "cmTryCompileExec3819238834/fast"]
ignore line: [/usr/bin/make -f CMakeFiles/cmTryCompileExec3819238834.dir/build.make CMakeFiles/cmTryCompileExec3819238834.dir/build]
ignore line: [make[1]: Entering directory `/home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp']
ignore line: [/usr/local/bin/cmake -E cmake_progress_report /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/CMakeFiles 1]
ignore line: [Building C object CMakeFiles/cmTryCompileExec3819238834.dir/CMakeCCompilerABI.c.o]
ignore line: [/usr/bin/cc -o CMakeFiles/cmTryCompileExec3819238834.dir/CMakeCCompilerABI.c.o -c /usr/local/share/cmake-2.8/Modules/CMakeCCompilerABI.c]
ignore line: [Linking C executable cmTryCompileExec3819238834]
ignore line: [/usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3819238834.dir/link.txt --verbose=1]
ignore line: [/usr/bin/cc -v CMakeFiles/cmTryCompileExec3819238834.dir/CMakeCCompilerABI.c.o -o cmTryCompileExec3819238834 -rdynamic ]
ignore line: [Using built-in specs.]
ignore line: [COLLECT_GCC=/usr/bin/cc]
ignore line: [COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-linux-gnu/4.7/lto-wrapper]
ignore line: [Target: x86_64-linux-gnu]
ignore line: [Configured with: ../src/configure -v --with-pkgversion='Debian 4.7.2-5' --with-bugurl=file:///usr/share/doc/gcc-4.7/README.Bugs --enable-languages=c,c++,go,fortran,objc,obj-c++ --prefix=/usr --program-suffix=-4.7 --enable-shared --enable-linker-build-id --with-system-zlib --libexecdir=/usr/lib --without-included-gettext --enable-threads=posix --with-gxx-include-dir=/usr/include/c++/4.7 --libdir=/usr/lib --enable-nls --with-sysroot=/ --enable-clocale=gnu --enable-libstdcxx-debug --enable-libstdcxx-time=yes --enable-gnu-unique-object --enable-plugin --enable-objc-gc --with-arch-32=i586 --with-tune=generic --enable-checking=release --build=x86_64-linux-gnu --host=x86_64-linux-gnu --target=x86_64-linux-gnu]
ignore line: [Thread model: posix]
ignore line: [gcc version 4.7.2 (Debian 4.7.2-5) ]
ignore line: [COMPILER_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.7/:/usr/lib/gcc/x86_64-linux-gnu/4.7/:/usr/lib/gcc/x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.7/:/usr/lib/gcc/x86_64-linux-gnu/]
ignore line: [LIBRARY_PATH=/usr/lib/gcc/x86_64-linux-gnu/4.7/:/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/:/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib/:/lib/x86_64-linux-gnu/:/lib/../lib/:/usr/lib/x86_64-linux-gnu/:/usr/lib/../lib/:/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../:/lib/:/usr/lib/]
ignore line: [COLLECT_GCC_OPTIONS='-v' '-o' 'cmTryCompileExec3819238834' '-rdynamic' '-mtune=generic' '-march=x86-64']
link line: [ /usr/lib/gcc/x86_64-linux-gnu/4.7/collect2 --sysroot=/ --build-id --no-add-needed --eh-frame-hdr -m elf_x86_64 --hash-style=both -export-dynamic -dynamic-linker /lib64/ld-linux-x86-64.so.2 -o cmTryCompileExec3819238834 /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crti.o /usr/lib/gcc/x86_64-linux-gnu/4.7/crtbegin.o -L/usr/lib/gcc/x86_64-linux-gnu/4.7 -L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu -L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib -L/lib/x86_64-linux-gnu -L/lib/../lib -L/usr/lib/x86_64-linux-gnu -L/usr/lib/../lib -L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../.. CMakeFiles/cmTryCompileExec3819238834.dir/CMakeCCompilerABI.c.o -lgcc --as-needed -lgcc_s --no-as-needed -lc -lgcc --as-needed -lgcc_s --no-as-needed /usr/lib/gcc/x86_64-linux-gnu/4.7/crtend.o /usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crtn.o]
arg [/usr/lib/gcc/x86_64-linux-gnu/4.7/collect2] ==> ignore
arg [--sysroot=/] ==> ignore
arg [--build-id] ==> ignore
arg [--no-add-needed] ==> ignore
arg [--eh-frame-hdr] ==> ignore
arg [-m] ==> ignore
arg [elf_x86_64] ==> ignore
arg [--hash-style=both] ==> ignore
arg [-export-dynamic] ==> ignore
arg [-dynamic-linker] ==> ignore
arg [/lib64/ld-linux-x86-64.so.2] ==> ignore
arg [-o] ==> ignore
arg [cmTryCompileExec3819238834] ==> ignore
arg [/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crt1.o] ==> ignore
arg [/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crti.o] ==> ignore
arg [/usr/lib/gcc/x86_64-linux-gnu/4.7/crtbegin.o] ==> ignore
arg [-L/usr/lib/gcc/x86_64-linux-gnu/4.7] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/4.7]
arg [-L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu]
arg [-L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib]
arg [-L/lib/x86_64-linux-gnu] ==> dir [/lib/x86_64-linux-gnu]
arg [-L/lib/../lib] ==> dir [/lib/../lib]
arg [-L/usr/lib/x86_64-linux-gnu] ==> dir [/usr/lib/x86_64-linux-gnu]
arg [-L/usr/lib/../lib] ==> dir [/usr/lib/../lib]
arg [-L/usr/lib/gcc/x86_64-linux-gnu/4.7/../../..] ==> dir [/usr/lib/gcc/x86_64-linux-gnu/4.7/../../..]
arg [CMakeFiles/cmTryCompileExec3819238834.dir/CMakeCCompilerABI.c.o] ==> ignore
arg [-lgcc] ==> lib [gcc]
arg [--as-needed] ==> ignore
arg [-lgcc_s] ==> lib [gcc_s]
arg [--no-as-needed] ==> ignore
arg [-lc] ==> lib [c]
arg [-lgcc] ==> lib [gcc]
arg [--as-needed] ==> ignore
arg [-lgcc_s] ==> lib [gcc_s]
arg [--no-as-needed] ==> ignore
arg [/usr/lib/gcc/x86_64-linux-gnu/4.7/crtend.o] ==> ignore
arg [/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu/crtn.o] ==> ignore
remove lib [gcc]
remove lib [gcc_s]
remove lib [gcc]
remove lib [gcc_s]
collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/4.7] ==> [/usr/lib/gcc/x86_64-linux-gnu/4.7]
collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu]
collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/4.7/../../../../lib] ==> [/usr/lib]
collapse library dir [/lib/x86_64-linux-gnu] ==> [/lib/x86_64-linux-gnu]
collapse library dir [/lib/../lib] ==> [/lib]
collapse library dir [/usr/lib/x86_64-linux-gnu] ==> [/usr/lib/x86_64-linux-gnu]
collapse library dir [/usr/lib/../lib] ==> [/usr/lib]
collapse library dir [/usr/lib/gcc/x86_64-linux-gnu/4.7/../../..] ==> [/usr/lib]
implicit libs: [c]
implicit dirs: [/usr/lib/gcc/x86_64-linux-gnu/4.7;/usr/lib/x86_64-linux-gnu;/usr/lib;/lib/x86_64-linux-gnu;/lib]
implicit fwks: []

Performing C SOURCE FILE Test C99_FLAG_DETECTED succeded with the following output:
Change Dir: /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec508479782/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec508479782.dir/build.make CMakeFiles/cmTryCompileExec508479782.dir/build
make[1]: Entering directory /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp' /usr/local/bin/cmake -E cmake_progress_report /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec508479782.dir/src.c.o /usr/bin/cc -DC99_FLAG_DETECTED -std=c99 -o CMakeFiles/cmTryCompileExec508479782.dir/src.c.o -c /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/src.c Linking C executable cmTryCompileExec508479782 /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec508479782.dir/link.txt --verbose=1 /usr/bin/cc -DC99_FLAG_DETECTED -std=c99 CMakeFiles/cmTryCompileExec508479782.dir/src.c.o -o cmTryCompileExec508479782 -rdynamic make[1]: Leaving directory/home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp'

Source file was:

include <stdarg.h>

include <stdbool.h>

include <stdlib.h>

include <wchar.h>

include <stdio.h>

// Check varargs macros. These examples are taken from C99 6.10.3.5.

define debug(...) fprintf (stderr, VA_ARGS)

define showlist(...) puts (#VA_ARGS)

define report(test,...) ((test) ? puts (#test) : printf (VA_ARGS))

static void
test_varargs_macros (void)
{
int x = 1234;
int y = 5678;
debug ("Flag");
debug ("X = %d\n", x);
showlist (The first, second, and third items.);
report (x>y, "x is %d but y is %d", x, y);
}

// Check long long types.

define BIG64 18446744073709551615ull

define BIG32 4294967295ul

define BIG_OK (BIG64 / BIG32 == 4294967297ull && BIG64 % BIG32 == 0)

if !BIG_OK

your preprocessor is broken;

endif

if BIG_OK

else

your preprocessor is broken;

endif

static long long int bignum = -9223372036854775807LL;
static unsigned long long int ubignum = BIG64;

struct incomplete_array
{
int datasize;
double data[];
};

struct named_init {
int number;
const wchar_t *name;
double average;
};

typedef const char *ccp;

static inline int
test_restrict (ccp restrict text)
{
// See if C++-style comments work.
// Iterate through items via the restricted pointer.
// Also check for declarations in for loops.
for (unsigned int i = 0; *(text+i) != '\0'; ++i)
continue;
return 0;
}

// Check varargs and va_copy.
static void
test_varargs (const char *format, ...)
{
va_list args;
va_start (args, format);
va_list args_copy;
va_copy (args_copy, args);

const char *str = NULL;
int number = 0;
float fnumber = 0.0;

while (_format)
{
switch (_format++)
{
case 's': // string
str = va_arg (args_copy, const char *);
break;
case 'd': // int
number = va_arg (args_copy, int);
break;
case 'f': // float
fnumber = va_arg (args_copy, double);
break;
default:
break;
}
}
va_end (args_copy);
va_end (args);

number = (number != 0) && (str != NULL) && (fnumber != 0.0);
}

int
main ()
{

// Check bool.
_Bool success = false;

// Check restrict.
if (test_restrict ("String literal") == 0)
success = true;
char *restrict newvar = "Another string";

// Check varargs.
test_varargs ("s, d' f .", "string", 65, 34.234);
test_varargs_macros ();

// Check flexible array members.
struct incomplete_array *ia =
malloc (sizeof (struct incomplete_array) + (sizeof (double) * 10));
ia->datasize = 10;
for (int i = 0; i < ia->datasize; ++i)
ia->data[i] = i * 1.234;

// Check named initializers.
struct named_init ni = {
.number = 34,
.name = L"Test wide string",
.average = 543.34343,
};

ni.number = 58;

int dynamic_array[ni.number];
dynamic_array[ni.number - 1] = 543;

// work around unused variable warnings
return (!success || bignum == 0LL || ubignum == 0uLL || newvar[0] == 'x'
|| dynamic_array[ni.number - 1] != 543);

;
return 0;
}
Determining if the function vfork exists passed with the following output:
Change Dir: /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec3987380200/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec3987380200.dir/build.make CMakeFiles/cmTryCompileExec3987380200.dir/build
make[1]: Entering directory /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp' /usr/local/bin/cmake -E cmake_progress_report /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec3987380200.dir/CheckFunctionExists.c.o /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=vfork -o CMakeFiles/cmTryCompileExec3987380200.dir/CheckFunctionExists.c.o -c /usr/local/share/cmake-2.8/Modules/CheckFunctionExists.c Linking C executable cmTryCompileExec3987380200 /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3987380200.dir/link.txt --verbose=1 /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=vfork CMakeFiles/cmTryCompileExec3987380200.dir/CheckFunctionExists.c.o -o cmTryCompileExec3987380200 -rdynamic make[1]: Leaving directory/home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp'

Determining if the function execve exists passed with the following output:
Change Dir: /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec3766393174/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec3766393174.dir/build.make CMakeFiles/cmTryCompileExec3766393174.dir/build
make[1]: Entering directory /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp' /usr/local/bin/cmake -E cmake_progress_report /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec3766393174.dir/CheckFunctionExists.c.o /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=execve -o CMakeFiles/cmTryCompileExec3766393174.dir/CheckFunctionExists.c.o -c /usr/local/share/cmake-2.8/Modules/CheckFunctionExists.c Linking C executable cmTryCompileExec3766393174 /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3766393174.dir/link.txt --verbose=1 /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=execve CMakeFiles/cmTryCompileExec3766393174.dir/CheckFunctionExists.c.o -o cmTryCompileExec3766393174 -rdynamic make[1]: Leaving directory/home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp'

Determining if the function execv exists passed with the following output:
Change Dir: /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec664966407/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec664966407.dir/build.make CMakeFiles/cmTryCompileExec664966407.dir/build
make[1]: Entering directory /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp' /usr/local/bin/cmake -E cmake_progress_report /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec664966407.dir/CheckFunctionExists.c.o /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=execv -o CMakeFiles/cmTryCompileExec664966407.dir/CheckFunctionExists.c.o -c /usr/local/share/cmake-2.8/Modules/CheckFunctionExists.c Linking C executable cmTryCompileExec664966407 /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec664966407.dir/link.txt --verbose=1 /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=execv CMakeFiles/cmTryCompileExec664966407.dir/CheckFunctionExists.c.o -o cmTryCompileExec664966407 -rdynamic make[1]: Leaving directory/home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp'

Determining if the function execvpe exists passed with the following output:
Change Dir: /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec1044600673/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec1044600673.dir/build.make CMakeFiles/cmTryCompileExec1044600673.dir/build
make[1]: Entering directory /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp' /usr/local/bin/cmake -E cmake_progress_report /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec1044600673.dir/CheckFunctionExists.c.o /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=execvpe -o CMakeFiles/cmTryCompileExec1044600673.dir/CheckFunctionExists.c.o -c /usr/local/share/cmake-2.8/Modules/CheckFunctionExists.c Linking C executable cmTryCompileExec1044600673 /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec1044600673.dir/link.txt --verbose=1 /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=execvpe CMakeFiles/cmTryCompileExec1044600673.dir/CheckFunctionExists.c.o -o cmTryCompileExec1044600673 -rdynamic make[1]: Leaving directory/home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp'

Determining if the function execvp exists passed with the following output:
Change Dir: /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec2332119349/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec2332119349.dir/build.make CMakeFiles/cmTryCompileExec2332119349.dir/build
make[1]: Entering directory /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp' /usr/local/bin/cmake -E cmake_progress_report /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec2332119349.dir/CheckFunctionExists.c.o /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=execvp -o CMakeFiles/cmTryCompileExec2332119349.dir/CheckFunctionExists.c.o -c /usr/local/share/cmake-2.8/Modules/CheckFunctionExists.c Linking C executable cmTryCompileExec2332119349 /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec2332119349.dir/link.txt --verbose=1 /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=execvp CMakeFiles/cmTryCompileExec2332119349.dir/CheckFunctionExists.c.o -o cmTryCompileExec2332119349 -rdynamic make[1]: Leaving directory/home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp'

Determining if the function execl exists passed with the following output:
Change Dir: /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec3118399448/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec3118399448.dir/build.make CMakeFiles/cmTryCompileExec3118399448.dir/build
make[1]: Entering directory /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp' /usr/local/bin/cmake -E cmake_progress_report /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec3118399448.dir/CheckFunctionExists.c.o /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=execl -o CMakeFiles/cmTryCompileExec3118399448.dir/CheckFunctionExists.c.o -c /usr/local/share/cmake-2.8/Modules/CheckFunctionExists.c Linking C executable cmTryCompileExec3118399448 /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3118399448.dir/link.txt --verbose=1 /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=execl CMakeFiles/cmTryCompileExec3118399448.dir/CheckFunctionExists.c.o -o cmTryCompileExec3118399448 -rdynamic make[1]: Leaving directory/home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp'

Determining if the function execlp exists passed with the following output:
Change Dir: /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec2300573743/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec2300573743.dir/build.make CMakeFiles/cmTryCompileExec2300573743.dir/build
make[1]: Entering directory /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp' /usr/local/bin/cmake -E cmake_progress_report /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec2300573743.dir/CheckFunctionExists.c.o /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=execlp -o CMakeFiles/cmTryCompileExec2300573743.dir/CheckFunctionExists.c.o -c /usr/local/share/cmake-2.8/Modules/CheckFunctionExists.c Linking C executable cmTryCompileExec2300573743 /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec2300573743.dir/link.txt --verbose=1 /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=execlp CMakeFiles/cmTryCompileExec2300573743.dir/CheckFunctionExists.c.o -o cmTryCompileExec2300573743 -rdynamic make[1]: Leaving directory/home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp'

Determining if the function execle exists passed with the following output:
Change Dir: /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec3786624990/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec3786624990.dir/build.make CMakeFiles/cmTryCompileExec3786624990.dir/build
make[1]: Entering directory /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp' /usr/local/bin/cmake -E cmake_progress_report /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec3786624990.dir/CheckFunctionExists.c.o /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=execle -o CMakeFiles/cmTryCompileExec3786624990.dir/CheckFunctionExists.c.o -c /usr/local/share/cmake-2.8/Modules/CheckFunctionExists.c Linking C executable cmTryCompileExec3786624990 /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3786624990.dir/link.txt --verbose=1 /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=execle CMakeFiles/cmTryCompileExec3786624990.dir/CheckFunctionExists.c.o -o cmTryCompileExec3786624990 -rdynamic make[1]: Leaving directory/home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp'

Determining if the function posix_spawn exists passed with the following output:
Change Dir: /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec3053370790/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec3053370790.dir/build.make CMakeFiles/cmTryCompileExec3053370790.dir/build
make[1]: Entering directory /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp' /usr/local/bin/cmake -E cmake_progress_report /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec3053370790.dir/CheckFunctionExists.c.o /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=posix_spawn -o CMakeFiles/cmTryCompileExec3053370790.dir/CheckFunctionExists.c.o -c /usr/local/share/cmake-2.8/Modules/CheckFunctionExists.c Linking C executable cmTryCompileExec3053370790 /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3053370790.dir/link.txt --verbose=1 /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=posix_spawn CMakeFiles/cmTryCompileExec3053370790.dir/CheckFunctionExists.c.o -o cmTryCompileExec3053370790 -rdynamic make[1]: Leaving directory/home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp'

Determining if the function posix_spawnp exists passed with the following output:
Change Dir: /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp

Run Build Command:/usr/bin/make "cmTryCompileExec3084343941/fast"
/usr/bin/make -f CMakeFiles/cmTryCompileExec3084343941.dir/build.make CMakeFiles/cmTryCompileExec3084343941.dir/build
make[1]: Entering directory /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp' /usr/local/bin/cmake -E cmake_progress_report /home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp/CMakeFiles 1 Building C object CMakeFiles/cmTryCompileExec3084343941.dir/CheckFunctionExists.c.o /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=posix_spawnp -o CMakeFiles/cmTryCompileExec3084343941.dir/CheckFunctionExists.c.o -c /usr/local/share/cmake-2.8/Modules/CheckFunctionExists.c Linking C executable cmTryCompileExec3084343941 /usr/local/bin/cmake -E cmake_link_script CMakeFiles/cmTryCompileExec3084343941.dir/link.txt --verbose=1 /usr/bin/cc -std=c99 -DCHECK_FUNCTION_EXISTS=posix_spawnp CMakeFiles/cmTryCompileExec3084343941.dir/CheckFunctionExists.c.o -o cmTryCompileExec3084343941 -rdynamic make[1]: Leaving directory/home/oj/clang-tools/Bear-1.3/CMakeFiles/CMakeTmp'

Bear needs to canonicalise file paths

Bear currently doesn't resolve relative path components for the file key in each compilation entry. So if you invoke Bear with something like the following:
bear -- sh -c "gcc /home/nick/foo/bar/../../fee.c", you get a compilation database entry like:

{
  "directory": "/home/nick",
  "command": "gcc /home/nick/foo/bar/../../fee.c",
  "file": "/home/nick/foo/bar/../../fee.c"
}

This is a problem, because when you feed a compilation database to libclang's CXCompilationDatabase, it doesn't canonicalise these paths for you. (At least not with LLVM 3.4.) If you ask it for the flags for /home/nick/fee.c, it won't return any results.

Couldn't applying Bear to Android build system

Hello,
I am not sure about this is right place for question. If I am rude, sorry about that.

I want to use Bear to generating compilation db from build of Google's Android Platform.
But, Bear seems not working with Android Platform's build system.

What am I missing?

[Request] Ignore some flags while compiling and generating dependencies .d

Bear has already helped me a lot.
But I'm facing an issue and I'm not sure if it was the case with 1.x releases

When I compile my project I use the flags :

cc .... -MMD -MP   ... -o my_unit.o -c my_unit.c

in order to generate the corresponding .d files and I would like that Bear don't store these flags because if it does, then oclint recreate the .d files in the wrong directory.

Remove commands for dependency file generation

I discovered an issue in oclint/oclint#76.
The problem is that the Makefile creates a dependency file in a separate build step and then compiles the source. This creates two entries in the compile_command.json.

Since the dependency command can be ignored for creating and parsing the AST, bear could remove this commands (that only do dependency file generation and no compilation).

What do you think?

Error while building Mono

First of all thanks for your work on this tool.

I am seeing a problem when using Bear to build the Mono runtime.

cd /Users/joao/Dev/mono/mcs && /Library/Developer/CommandLineTools/usr/bin/make --no-print-directory -s NO_DIR_CHECK=1 PROFILES='net_4_0 net_4_5 xbuild_12 xbuild_14   ' CC='gcc' all-profiles
dyld: could not load inserted library '/usr/local/lib/libear.dylib' because no suitable image found.  Did find:
    /usr/local/lib/libear.dylib: mach-o, but wrong architecture

make[6]: *** [build/deps/basic-profile-check.exe] Trace/BPT trap: 5
*** The compiler 'mcs' doesn't appear to be usable.
*** You need Mono version 3.2 or better installed to build MCS
*** Check mono README for information on how to bootstrap a Mono installation.
dyld: could not load inserted library '/usr/local/lib/libear.dylib' because no suitable image found.  Did find:
    /usr/local/lib/libear.dylib: mach-o, but wrong architecture

You can reproduce by cloning Mono and then doing something like:

./autogen.sh --prefix=`pwd`/build
bear -- make

Bear truncates output.json on resuming compilation

Hi Bear-team, firstoff: great software, thanks a lot for your efforts! One minor issue anyway: I would really love being able to interrupt and resume compilation, especially on big projects this could be a major improvement. I had the problem just yesterday that the compilation crashed at some point, after fixing the problem and resuming the compilation, Bear truncated the compile_commands.json-file.
If I find the time, I may do the patch myself, for now I first wanted to leave this "feature-request" here, thanks again for your awesome piece of work!

spurious missing dependency

First off, thanks! This is a whole lot better than converting my huge mess of Makefile's to cmake (although I wish I had the time to do that).

I did run into a problem building current version, however. I installed pkg-config and libconfig as stated in docs, but still get:
-- checking for module 'libconfig>=1.4'
-- package 'libconfig>=1.4' not found

I was able to work around the problem by:

  • removing REQUIRED parameter from pkg_check_modules
  • manually setting:
    set(LIBCONFIG_LIBRARIES "-lconfig")

WIth that I'm able to build and run Bear, much to my delight!

I suspect that the source of the problem may be that you have /usr/local/lib on your LD_LIBRARY_PATH, whereas I do not. (In fact, my LD_LIBRARY_PATH is empty).

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.