Tag Info

Hot answers tagged

61

You can't just ./fork.c (it's not a program; it's the source for a program): this assumes that the file is a script (which it isn't) and treats it accordingly. (However, as noted in another answer, there are compilers (like Tiny C Compiler) that can execute C code without explicitly compiling it) Since it's a C program, you have to compile the program. Try ...


25

AFAIK the only way to be completely sure of security would be to write a compiler in assembly language (or modifying the disk directly yourself). Only then can you ensure that your compiler isn't inserting a backdoor - this works because you're actually eliminating the compiler completely. From there, you may use your from-scratch compiler to bootstrap e.g. ...


22

That's not a program, that's the source code for a program. C is a compiled language, meaning it must be "compiled" into machine-readable instructions before you can run it. As you are using C, the "C Compiler" (cc) can do this. cc -o fork for.c # compile the code chmod +x fork # ensure it it executable ./fork # run the compiled program ...


20

One possible way, although it would take an exceedingly long time in practice, would be to go back to the roots. Development of GNU began in 1984, and the original version of Minix (which was used during early Linux development for bootstrapping purposes) was released in 1987. This entire answer is based on your premise that "[you] or others have the ...


18

There isn't a universal way, but you can make an educated guess by looking for things only done by one compiler. GCC is the easiest; it writes a .comment section that contains the GCC version string (the same string you get if you run gcc --version). I don't know if there's a way to display it with readelf, but with objdump it's: objdump -s --section ...


10

In simple terms, you can think of make as having a (possibly large) number of steps, where each step takes a number of files as input and creates one file as output. A step might be "compile file.c to file.o" or "use ld to link main.o and file.o into program". If you interrupt make with CtrlC, then the currently executing step will be terminated which will ...


9

If you need a trusted compiler, you could get a look at academic work, like the compcert project. It's a compiler built by the INRIA (a French IT public laboratory) designed to be ''certified'', i.e. to produce an executable semantically perfectly equivalent to the code (and of course, it has been mathematically proven).


7

Ctrl+C causes a SIGINT to be sent to the process running. This signal can be caught by the process. In the make source code you can find a trap for this signal in commands.c: /* If we got a signal that means the user wanted to kill make, remove pending targets. */ if (sig == SIGTERM || sig == SIGINT ... remove childrens ... /* Delete any ...


6

You can try using the strings command. It will create a lot of text output; by checking it you might guess the compiler. pubuntu@pubuntu:~$ strings -a a.out |grep -i gcc GCC: (Ubuntu 4.4.3-4ubuntu5) 4.4.3 Here I know it's compiled with gcc but you can always redirect strings output to a file and examine it. There is one very good utility called peid ...


5

You would treat the ports clang as an alternative compiler, just like when GCC was the default. As per the FreeBSD wiki, add the following lines to /etc/make.conf (if you want to use clang for everything, even ports), or /etc/src.conf (if you want to use clang just for world and kernel): CC=/path/to/clang CXX=/path/to/clang++ CPP=/path/to/clang-cpp Check ...


5

On Debian, there are apt-cross and dpkg-cross from Emdebian, which let you set up cross-compilation for many architectures (you get cross-compilers and libraries). On Ubuntu, there's a crosschain for ARM, and a project to improve on this. You can also create toolchain using crosstool-ng which is not link to a distribution.


4

You can also use this clever script that counts the numbers of various CPU instructions used by the binary. It is based on parsing objdump output. Beware that it can take quite a long time to finish if you use it on a big binary.


4

How about: readelf -p .comment a.out


3

You can assume I or others have the ability to read and understand source code for security flaws, so source code will be vetted first before compiling. Sorry, but I can't assume that, as I know it to be false. The sheer scope of source code involved in a Unix or Linux system with all packages these days is enormous - human review of every one of ...


2

While manually creating your own compiler as a starting point would be the most secure, another option is to install a system from a 5 (or 10) year old install CD that you trust was created before these exploits existed. Then use that as a foundation to compile the new audited source from.


2

sudo update-alternatives --config cc sudo update-alternatives --config c++ Choose gcc 4.8 version in both cases.


1

The files you say are missing, is because only Debian provides them, transmission sources doesn't have any init script to start. So as you noticed checkinstall can't figure this out. The best course of action is copying the debian/ directory of upstream and compiling using debuild -us -uc instead.


1

When something stops make (be it ctrl-C, shutdown, or even a command that fails), the work already done stays. When restated, make does as always: it figures out what still needs to be done (because a file changed or make never got to have it processed doesn't matter) and goes on with the job. The above description clearly presumes the relevant Makefiles ...


1

The possible solution would be to update Code::Blocks to the latest version. In Code::Blocks 13.12 clang is listed as one of the supported compilers.


1

You should first try one available from K-team. If that does not work, your distro may have an ARM cross-compiler package available; since the debian wiki makes mention of the PXA270, these presumably work. I notice looking around people using this chip and gcc with -march=armv5te and/or -mabi=iwmmxt; iwmmxt is also available as a -mcpu and -march, but a ...


1

How can I install C++ compiler for eclipse on Fedora 20? yum install gcc-c++


1

Since Apple has bundled it's own version of gcc/llvm, you need to enable homebrew/versions repo before you can install different version of GCC. brew tap homebrew/versions brew install gcc48 Replace gcc48 with the version of gcc you want. See also https://github.com/mxcl/homebrew/wiki/Custom-GCC-and-cross-compilers


1

Never do this, use a remote repository instead, i.e git. But if you insist, here's two working solution, Use scp protocol within VIM, i.e gvim scp://konimi@vim.org//var/www/html/tips/add_tip.php Mount remote directory through SSH protocol, i.e sshfs, that way you can edit it locally, and you open another shell to execute make.


1

You can try various free Unix shell providers. SDF, Blinkenshell or Anapnea come to mind. They do offer build tools, and vim.


1

With a lot of help from @Deer Hunter, I got it up and running pretty quickly. $ sudo apt-get install npm $ sudo npm install --global less $ sudo ln -s /usr/local/lib/node_modules/less/bin/lessc /usr/local/bin


1

This side of the screen: $ node --version v.0.8.16 $ npm --version 1.1.69 $ npm install less npm http GET https://registry.npmjs.org/less npm http 200 https://registry.npmjs.org/less npm http GET https://registry.npmjs.org/less/-/less-1.3.3.tgz npm http 200 https://registry.npmjs.org/less/-/less-1.3.3.tgz npm http GET ...


1

Going back from machine code to the source language is called decompilation. Disassembly (going from machine code to assembly language) can be done with objdump -d; objdump is part of the standard binutils suite of development tools. While a decompiler can be a useful tool in the process, decompiling the code with the intent of modifying it and recompiling ...


1

Wow, some project! But OK, some toys to play with: (Use all with a binary file as first argument.) bits: xxd -b # xxd for hexdump (?): `-b` is `-bits` octal: od # octal dump hexadecimal: hexdump # these two share the hexdump(1) man page hd # symbolic link to hexdump od -t x1 # `-t` for type, `x1` for ...


1

I don't think Debian has anything exactly comparable to this. Here is Chapter 10 of Debian Policy: Files, which has some information about compile time flags. Note the sentence It is up to the package maintainer to decide what compilation options are best for the package. In short, Debian doesn't tell its developers what flags to use.


1

There are two methods . Both will give the same result objdump -s --section .comment path/to/binary Using readelf command, readelf -S binary will display the 40 section headers in the binary . Note the serial number of .comment section header. In my system , it showed as 27 (may be different for your case) readelf -x 30 path/to/binary -> which ...



Only top voted, non community-wiki answers of a minimum length are eligible