Skip to content

Tag: gcc

Is malloc deterministic?

Is malloc deterministic? Say If I have a forked process, that is, a replica of another process, and at some point both of them call the malloc function. Would the address allocated be the same in both processes? Assuming that other parts of execution are also deterministic. Note: Here, I’m only talking …

undefined reference to sync_fetch_and_add_4

Whenever I try to use __sync_fetch_and_add with -m32 on a 64 bit machine, I get the following error, while it compiles fine with normal 64 bit. I am using gcc compiler 4.1.2. What can be the problem here and what is the solution? Answer Using -march=i486 flag did the trick for me.

Getting cannot allocate memory error

I am getting this error in my program… ulimit -a gives the output: The amount of memory I’m trying to protect is 60 MB. Can someone tell me what is the problem and how it can be solved? Answer Given the error message, you probably got an ENOMEM error, and looking at the error code, this does not n…

linux library problem

Everybody out there, I’m writing a c code which have a strange problem when I compile it . The source code is OK. I compile it with following option: But it show the out put like that: I searched for libjvm.so i found It in my system in /usr/java/lib. I made a symbolic link of it but did not work.

What are the GCC default include directories?

When I compile a very simple source file with gcc I don’t have to specify the path to standard include files such as stdio or stdlib. How does GCC know how to find these files? Does it have the /usr/include path hardwired inside, or it will get the paths from other OS components? Answer In order to figu…

Linux static linking is dead?

In fact, -static gcc flag on Linux doesn’t work now. Let me cite from the GNU libc FAQ: 2.22. Even statically linked programs need some shared libraries which is not acceptable for me. What can I do? {AJ} NSS (for details just type `info libc “Name Service Switch”‘) won’t work pr…