I could ran clang with command line and i thought my clang is the default one.
I could ran command like this.
clang -cc1 -analyze -analyzer-checker=debug.DumpCFG a.c
I want to find the source code from clang/lib/StaticAnalyzer/Checkers,but i cannot find the clang folder.
I have tried to search it with finder,ended failure.
Is there any shell command to find where is the command stored?
The file location is here:
/usr/local/llvm/tools/clang/lib/StaticAnalyzer/Checkers/
or
/opt/local/libexec/llvm-x.x/include/clang/StaticAnalyzer/Checkers
by an ls command you can find all the source codes int his list:
https://github.com/CTSRD-CHERI/clang/tree/master/lib/StaticAnalyzer/Checkers
Hope that's what you're looking for!
Related
I have installed eCos OS on a linux system (Ubuntu 13.02). After installation, the eCos files are located in opt/ecos.
As I read the eCos tutorial, I see hello.c is stored in opt/ecos/ecos-3.0/examples/hello.c (And I notice that maybe all main eCos system files store in the ecos-3.0 directory).
I have followed the eCos tutorial found on the official website, but I still cannot successfully compile hello.c.
More detail. When I try to run :
$ export INSTALL_DIR=BASE_DIR/ecos-work/arm_install
$ TARGET-gcc -g -IBASE_DIR/ecos-work/install/include hello.c \
-LBASE_DIR/ecos-work/install/lib -Ttarget.ld -nostdlib
I get the error : TARGET-gcc : command not found
I have tried some other tutorials, but I'm still having issues (too messy to list here).
I am looking for step-by-step instruction on compiling hello.c in eCos system. I see the eCos manual lacking in this area.
Thanks :)
It appears that you've missed a subtle convention in the eCos documentation. Items in italics are provided by you! They are variables.
The documentation mentions this here:
Note: Remember that when this manual shows TARGET-gcc you should use
the full name of the cross compiler, e.g. i386-elf-gcc, arm-elf-gcc,
or sh-elf-gcc. When compiling for the synthetic Linux target, use the
native gcc which must have the features required by eCos.
Replace TARGET with the appropriate value and BASE_DIR with (I think, in your case) /opt/ecos. You should verify the include directory before moving forward:
$ ls -l /opt/ecos/ecos-work/install/include
If that doesn't list directory contents, then you simply need to locate ecos-work
The Ecosconfig on Windows and Linux Quick Start section of the docs has you create the BASE_DIR directory (below is a snippet that I am quoting ... italics will not display).
$ mkdir BASE_DIR/ecos-work
$ cd BASE_DIR/ecos-work
So, this could be the correct invocation.
$ export INSTALL_DIR=/opt/ecos/ecos-work/arm_install
$ arm-elf-gcc -g -I/opt/ecos/ecos-work/install/include hello.c \
-L/opt/ecos/ecos-work/install/lib -Ttarget.ld -nostdlib
you need to do
# source /opt/ecos/ecosenv.sh
Then you can try to compile by changing TARGET=
$ TARGET-gcc -g -IBASE_DIR/ecos-work/install/include hello.c \
-LBASE_DIR/ecos-work/install/lib -Ttarget.ld -nostdlib
In terminal every time I want to compile a C file I have to type out the full path to both the gcc alias and the MacOSX SDK. For example, to run a main.c fine I would type
$ cd /Users/Will/Desktop/C
$ /Users/Will/Desktop/C/gcc -isysroot /Developer/SDKs/MacOSX10.6.sdk main.c
However, my directory is in the Desktop/C folder so I should not have to type the full path, yet when I type
$ cd /Users/Will/Desktop/C
$ gcc main.c
I get
-bash: gcc: command not found
Furthermore, it seems that it should already know to look in /Developer/SDKs/MacOSX10.6.sdk for header files such as stdio.h, yet when I type
$ /Users/Will/Desktop/C/gcc main.c
I get something like
main.c:1:19: error: stdio.h: No such file or directory
How do I fix this?
If it's in your current working directory, use ./gcc.
Otherwise, point your $PATH to that directory, and you'll be able to use it from anywhere as gcc.
As for not having to type out the SDK path each time, you could write a simple bash script and place it in your $HOME/bin (assuming you've already added gcc to your $PATH, otherwise add the full path)...
#!/bin/sh
gcc -isysroot /Developer/SDKs/MacOSX10.6.sdk "$#"
Make sure to give it execute permissions with chmod +x gcc_wrapper. Then you should be able to use it from anywhere, and any arguments passed to it wil be tacked on the end.
in unix systems
open the file .bashrc in your home folder
add an alias in that file
eg :
alias mygcc="/Users/Will/Desktop/C/gcc"
close the terminal and reopen it, now onwards u can use mygcc filename.c for compiling
likewise you can add an alias to mac sdk too .
Refer this link
I installed on windows curl 7.28.0 from curl-7.28.1-devel-mingw32.zip through minGW console to default directory like:
./config && make && make install
All needed headers (aka curl.h, types.h ...) I see in C:\MinGW\msys\1.0\local\include\curl
libcurl.pc placed in C:\MinGW\msys\1.0\local\lib\pkgconfig\
libcurl.a, libcurl.dll.a and libcurl.la placed in C:\MinGW\msys\1.0\local\lib.
My download_file.c file includes are:
...
#include <curl/curl.h>
#include <curl/types.h>
#include <curl/easy.h>
...
I try to compile the C code with followed command through gcc:
$ gcc -IC:/MinGW/msys/1.0/include/
-IC:/MinGW/msys/1.0/local/include/curl
-IC:/MinGW/msys/1.0/local/lib/pkgconfig
-o download_file download_file.c -llibcurl -lcurl
with absolute path get the same error:
gcc -I/include/
-I/local/include/curl
-I/local/lib/pkgconfig
-o download_file download_file.c -llibcurl -lcurl
But I still get an error:
download_file.c:21:23: fatal error: curl/curl.h: No such file or directory compilation terminated.
row 21 is #include <curl/curl.h>
What I did wrong? Please help.
You have the curl/ directory in the source code, but also in the option.
It seems the option should point out the higher-level directory in which curl/ is, so it should be something like:
-I/local/include/
I think the problem is likely that you give your include paths on the command line in the Win32 path format. This is not the same as the one used by msys (or ultimately Cygwin).
Try these:
$ gcc -I/include/
-I/local/include/curl
-I/local/lib/pkgconfig
...
Hope I got the absolut paths right, but you can check in your msys shell.
What ticked me off was that you use ./config, which wouldn't work from the Command Prompt, but works from the msys shell. So you need to give paths that all the programs in MinGW understand.
Basically, most programs in MinGW only have the concept of a single file system root, like on any unixoid system, while Win32 has multiple (the drive letters). Since the MinGW programs are linked accordingly, you need to give paths that they understand.
Thank you very much to #0xC0000022L and #unwind. By your help I fixed my problem.
0xC0000022L you are right about absolute path
unwind you are right about -I/local/include/ instead -I/local/include/curl
I found other problem: -L/local/lib instead -I/local/lib.
So this is a working command:
gcc -I/include/
-I/local/include
-L/local/lib
-o download_file download_file.c -llibcurl -lcurl
When compiling some CUDA code, I get the error, that the libcutil cannot be found even though I checked that the paths are correct.
Example
$ nvcc mycudacode.cu -lcutil -o mycudaproject -I ~/NVIDIA_GPU_Computing_SDK/C/common/inc -L ~/NVIDIA_GPU_Computing_SDK/C/lib
/usr/bin/ld: cannot find -lcutil
compilation terminated.
Even though:
$ ~/NVIDIA_GPU_Computing_SDK/C/lib$ ls
libcutil_x86_64.a libparamgl_x86_64.a librendercheckgl_x86_64.a
I have tried the following:
cp $(HOME)/NVIDIA_GPU_Computing_SDK/C/lib/libcutil_x86_64.a /usr/local/cuda/lib/libcutil.a
and it works.
From the NVIDIA Forums:
On linux 64bit one has to rename libcutil_x86_64.a into libcutil.a.
So cd into the folder $(HOME)/NVIDIA_GPU_Computing_SDK/C/lib/ (or where you installed CUDA) and enter: cp libcutil_x86_64.a libcutil.a
DISCLAIMER
As I already stumbled over this problem twice I added the question and the answer as a form of documentation.
How can I execute a.exe using the Cygwin shell?
I created a C file in Eclipse on Windows and then used Cygwin to navigate to the directory. I called gcc on the C source file and a.exe was produced. I would like to run a.exe.
./a.exe at the prompt
you should just be able to call it by typing in the file name. You may have to call ./a.exe as the current directory is usually not on the path for security reasons.
just type ./a in the shell
To execute a file in the current directory, the syntax to use is: ./foo
As mentioned by allain, ./a.exe is the correct way to execute a.exe in the working directory using Cygwin.
Note: You may wish to use the -o parameter to cc to specify your own output filename. An example of this would be: cc helloworld.c -o helloworld.exe.
Thomas wrote:
Apparently, gcc doesn't behave like the one described in The C Programming language
It does in general. For your program to run on Windows it needs to end in .exe, "the C Programming language" was not written with Windows programmers in mind. As you've seen, cygwin emulates many, but not all, features of a POSIX environment.
gcc under cygwin does not generate a Linux executable output file of type " ELF 32-bit LSB executable," but it generates a windows executable of type "PE32 executable for MS Windows" which has a dependency on cygwin1.dll, so it needs to be run under cygwin shell. If u need to run it under dos prompt independently, they cygwin1.dll needs to be in your Windows PATH.
-AD.
Apparently, gcc doesn't behave like the one described in The C Programming language, where it says that the command cc helloworld.c produces a file called a.out which can be run by typing a.out on the prompt.
A Unix hasn't behaved in that way by default (so you can just write the executable name without ./ at the front) in a long time. It's called a.exe, because else Windows won't execute it, as it gets file types from the extension.
Just call it
> a
Make sure it will be found (path).
When you start in Cygwin you are in the "/home/Administrator" zone, so put your a.exe file there.
Then at the prompt run:
cd a.exe
It will be read in by Cygwin and you will be asked to install it.