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 about virtual memory, not physical one. Answer There

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 necessarily mean

Pyaudio installation error – ‘command ‘gcc’ failed with exit status 1′

I’m running Ubuntu 11.04, Python 2.7.1 and wanted to install Pyaudio. So I ran, $ sudo easy_install pyaudio in the terminal and the process exited with following error messages, Searching for pyaudio Reading Reading Best match: pyaudio 0.2.4 Downloading Processing pyaudio-0.2.4.tar.gz Running PyAudio-0.2.4/ -q bdist_egg –dist-dir /tmp/easy_install-0Tetss/PyAudio-0.2.4/egg-dist-tmp-PYy9T8 In file included from /usr/include/python2.7/Python.h:8:0, from src/_portaudiomodule.c:30: /usr/include/python2.7/pyconfig.h:1155:0: warning: “_POSIX_C_SOURCE”

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 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 figure out the

Why are designated initializers not implemented in g++

Is there any specific reason why has support for designated initializers not been added to g++? Is the reason that C99 standards came late and g++ was developed earlier and later people didn’t care about this issue, or there is some inherent difficulty in implementing designated initializers in the grammar of C++? Answer As I noted in a comment, G++

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 properly without shared libraries. NSS allows using different services (e.g.

appname: /lib/ version `GLIBC_2.8′ not found (required by appname)

ldd -v appname appname is compiled on Ubuntu 9.10, trying to run compiled product on Centos 5. My guess is that Centos5’s /lib/ provides up to version GLIBC_2.4, but appname calls for GLIBC_2.8. But here’s the funny thing. This problem didn’t happen until I started linking to boost’s system library. Before it was just boost’s thread library, but now I