Python script to fetch an executable file from local repository git - c

I have an access to the local repository (git) of my company with this url -> "gitolite#10.10.10.55:/Intel/BareRepos/lteue.git" and my python script need to execute any file (.c & .h files) of this project and create a binary. After which the script has to run this binary file.
The code which I have wrote is:
import os
os.system("git clone gitolite#10.10.10.55:/Intel/BareRepos/lteue.git")
os.system("cd /home/saicharan/Documents/lteue")
os.system("gcc somefile.c")
os.system("./a.out")
I am getting the error like this
gcc: error: helloworld.c: No such file or directory
gcc: fatal error:no input files compilation terminated.
sh: ./a.out: No such file or directory
Please help me out with this.

Fortunately I got the solution for this:
os.system("git clone gitolite#10.10.10.55:/Intel/BareRepos/lteue.git")
os.chdir("path/to/file")
os.system("gcc path/to/file/somefile.c")
os.chdir("path/to/file")
os.system("./somefile.out")
and its working fine.!

You can make it even more simpler.
import os
os.system("git clone gitolite#10.10.10.55:/Intel/BareRepos/lteue.git")
os.chdir("path/to/file")
os.system("gcc path/to/file/somefile.c && ./somefile.out")
It Works.!

Related

Cant find project for PackageCompiler

I am trying to create an executable using PackageCompiler.jl. However, whenever I run the command
create_app("src/UnsteadyFlowSolvers.jl","UNSflowCompiled")
I keep getting the error
ERROR: could not find project at "C:\\Users\\Matthew\\OneDrive - Mississippi State University\\Research\\UNSflow\\Ramesh Live\\src\\UnsteadyFlowSolvers.jl"
This is the exact location of the file. For instance:
include("src/UnsteadyFlowSolvers.jl") ; UnsteadyFlowSolvers.julia_main()
works perfectly fine and generates the exact result I would like the executable to return. The Project.toml file is in the current directory if that matters. I have tried an alternate version of the package where the module file is not located in another directory to no avail.
Thanks
create_app(package_dir::String, compiled_app::String; kwargs...)
Compile an app with the source in package_dir to the folder compiled_app.
So the first argument to create_app is the package folder, not the .jl file. I'd suggest a ;cd .. to get outside your project folder, then
create_app("Ramesh Live", "UNSflowCompiled")

Accessing libnetlink.h

I'm trying to access some member variables within libnetlink.h, but when I #include in my source and compile with "gcc source.c -o binary", I get a "fatal error: libnetlink.h: No such file or directory" error.
I'm on Ubuntu 16.04 and I've already installed libnl-3-dev via apt-get install.
You need to put the correct path that must be seen from your source file.
this can be done by either:
1: Full path of the file 'libnetlink.h' like this (for example in linux):
/home/username/Desktop/folder1/libnetlink.h
2: Relative path of the file, corresponding to where your source file exist:
suppose your source file exist on 'Desktop', and your libnetlink.h exist in sub folder of Desktop folders called 'folder1', then the path will:
folder1/libnetlink.h
I guess the following command may help.
apt-get iproute-dev
I am using Fedora Core 26, after installing iproute-dev, the same problem is solved.

PC-Lint error : Error 307: Can't open indirect file 'gcc-include-path.lnt'

I am trying to use PC-Lint on windows for exercising static code analysis on C files. I installed the software and ran the configuration setup for gcc compiler where I got the following files in the config directory:
co-gcc.h, co-gcc.lnt, env-ecl-console.lnt, filea.cpp, fileb.cpp, LIN.BAT,
lset.bat, options.lnt, std.lnt, std_a.lnt
However when I try to run the test sample by typing >lin filea fileb from the config directory, I get the following error:
co-gcc.lnt 37 Error 307: Can't open indirect file 'gcc-include-path.lnt'
How do we get the gcc-include-path.lnt file?
Error got solved by creating lint_cmac.h, lint_cppmac.h, gcc-include-path.lnt, and size-options.lnt files using the makefile co-gcc.mak located in PC-lint9.00h\lnt folder.

libqrencode - Segmentation fault couldn't read "qrspec.c"

I previously made this question and got a light at the end of the tunnel by the response that I got. But now that I found the problem, I don't understand it. I don't have root priv. Whenever I run the program I get segmentation fault and a core file. When I analyse it with dbx I get this
reading symbolic information ...
Segmentation fault in QRspec_newFrame at line 546 in file "" ($t1)
couldn't read "qrspec.c"
How come he can't find qrspec.c if that file was included on the process of generating the lib? (I wasn't involved on that process so I have no idea if it went 100% but I gave the .tar with all the files). Also that file belongs to libqrencode.
Compiling:
xlc_r7 -g qrgen.c -lqrencode -L/usr/local/lib -I/usr/local/include
I'm starting to bealive it can't find the file because there is a .so symbolic link missing on the /usr/local/lib folder. Could that be it? (Only .a , .la and .so.3 in there)
I think my problem is similiar to this one but I can't install the lib again unless that is the real problem.
Machine: Unix AIX powerpc model: IBM,9117-MMB
xlc version: 12.01.0000.0000
I'm guessing you need to tell dbx where to find your source files
From man dbx
-I Directory
(Uppercase i) Includes directory specified by the Directory variable in the list of directories searched for source files. The default is to look for source files in the following directories:
* The directory the source file was located in when it was compiled. This directory is searched only if the compiler placed the source path in the object.
* The current directory.
* The directory where the program is currently located.
I found the problem... The installation of the lib generated problems and caused the symbolic links to exist as a simple file and the library just wasn't there...
This is the missing file "/usr/local/lib/libqrencode.so.3.4.4" which is the code itself... I was looking at the files and didn't notice it because there was a file called libqrencode.so.3.4 but this file was supose to be a symbolic link to libqrencode.so.3.4.4 since libqrencode.so.3.4.4 didn't exist, instead of the symbolic link failing, it created a empty file with that same name...

Compiling C code with external library references

I am on RHEL 6.0 and got hold of the source code for join command(hopefully from the right source!!). I rarely work on a C code and hence finding this difficult. I am trying to compile and run the C code for join, but running into compile time errors.
g++ join.c
join.c:19:20: error: config.h: No such file or directory
join.c:25:20: error: system.h: No such file or directory
join.c:27:25: error: hard-locale.h: No such file or directory
join.c:28:24: error: linebuffer.h: No such file or directory
join.c:29:24: error: memcasecmp.h: No such file or directory
join.c:30:19: error: quote.h: No such file or directory
join.c:31:21: error: stdio--.h: No such file or directory
join.c:32:22: error: xmemcoll.h: No such file or directory
join.c:33:21: error: xstrtol.h: No such file or directory
join.c:34:22: error: argmatch.h: No such file or directory
Since I am not aware of where to find these libraries(I did google for each one and they are spread all over different websites), can anyone please guide me as to how I can link these libraries together and compile the source code of join command?
This is not a linking problem as you suggest. Instead, you get these errors because g++ can't find these files: config.h, system.h, ..., that are #included (indirectly) by join.c.
What you could do is find these files on your system, and then add as many -I<directory> options behind the g++ as there were directories you found these files in. Do man g++ for more info.
You'll also need to find the where the libraries are you need to link against. So you'll need to specify more than -I's.
On the other hand, aren't there 'configure' or other package files? Normally you don't have to specify compiler flags (like this -I) by hand. Instead, it's common that for example Makefile's are generated from such a configuration file, after which you just have to type make.
I advise you to get someone that has done this before, because you don't seem to understand the basics of C program compilation. This can cost you a lot of your precious time without results. But good luck anyway!
Perhaps you don't have everything in place to compile your code. Try installing the build-essential package.
sudo yum install build-essential
On a relevant note, I'm not aware of the script join.c but if you are looking for a way to concatenate a bunch of files together, you can do cat FILE1 FILE2 FILE3 > BIG_FILE where FILE1 FILE2 FILE3 are the files you want to join them. Under RHEL 6.0, you can use asterisks too, if there is a pattern. For example, cat FILE.00* > BIG_FILE

Resources