gnu

How to delete element from hsearch

爷,独闯天下 提交于 2019-12-04 02:00:19
问题 I am using hsearch_r function provided by GNU C library. I see that while i can add elements into the HASH table using hsearch_r and passing the action as ENTER, i see no way to remove an element or an entry from the HASH table. Does anybody know a reason why this is so? Can i do the following to implement my delete function. I first search for it using hsearch_r with the action as FIND. Then once i get a pointer to the hash_element then i free it. Will that work? What good is a hash library

Hiding symbols in a shared library on Mac OS X

半腔热情 提交于 2019-12-04 00:48:19
问题 We've been building a large open source software on a variety of platforms (Linux, Windows, Mac OS X, 32-bit and 64-bit) for several years without troubles. Lately however, the Mac OS X build (64-bit) stopped working correctly and started to crash randomly. It more or less coincided with an update of Mac OS X on our build machine from 10.7 to 10.8.2 (but the compiler toolchain didn't change, it's still llvm-gcc 4.2.1). Our application is made of a couple of dynamic (shared) libraries and many

What does -D_DEFAULT_SOURCE do?

会有一股神秘感。 提交于 2019-12-03 22:26:56
Previously I was receiving warnings from gcc -std=c99 that usleep() was implicitly declared. Then I stumbled across this stackoverflow post , which led me to use -D_BSD_SOURCE . However, now gcc tells me that -D_BSD_SOURCE has been deprecated and I should use -D_DEFAULT_SOURCE instead. #warning "_BSD_SOURCE and _SVID_SOURCE are deprecated, use _DEFAULT_SOURCE" Why is -D_BSD_SOURCE deprecated? Why is -D_DEFAULT_SOURCE used instead? And what does it do? I did some googling , and the results are just filled with people using it to shut gcc up. I couldn't find out why -D_BSD_SOURCE has been

Testing if a file exists in makefile target, and quitting if not present

不问归期 提交于 2019-12-03 22:12:15
Is there a way to exit with an error condition if a file does not exist? I am currently doing something like this: all: foo foo: test -s /opt/local/bin/gsort || echo "GNU sort does not exist! Exiting..." && exit Running make runs the all target, which runs foo . The expectation is that if the test -s conditional fails, then the echo/exit statements are executed. However, even if /usr/bin/gsort exists, I get the result of the echo statement but the exit command does not run. This is the opposite of what I am hoping to accomplish. What is the correct way to do something like the above? exit

How to add a path to LDFLAGS

霸气de小男生 提交于 2019-12-03 19:04:59
问题 I'm trying to set up a library called PBC (Pairing-based cryptography). And this library requires another library called GMP -(GNU Multiple-Precision Library). My problem is after installing GMP correctly, PBC gives an error of: gmp library not found add its path to LDFLAGS I have no idea what LDFLAGS is and how to add it to the path. PS: I'm using MinGW. 回答1: The question is not really descriptive enough for anyone to answer well, but.... On a Unix-based system you would likely do something

LD_LIBRARY_PATH doesn't seem to work

不羁的心 提交于 2019-12-03 17:17:39
问题 I'm trying to compile a test file: gcc -o test test.c -lg2c but I get the error: /usr/bin/ld: cannot find -lg2c If I use: gcc -o test test.c -L/usr/lib/gcc/x86_64-redhat-linux/3.4.6 -lg2c then it works fine. So I added the path like so: LD_LIBRARY_PATH=/usr/lib/gcc/x86_64-redhat-linux/3.4.6:$LD_LIBRARY_PATH and when I use $LD_LIBRARY_PATH it's listed there, but: gcc -o test test.c -lg2c still doesn't work, it gives the same error, I can't figure out why. I'm using CentOS (2.6.32-279.9.1.el6

Bash arrays and negative subscripts, yes or no?

北城余情 提交于 2019-12-03 16:41:11
问题 The GNU bash manual tells me An indexed array is created automatically if any variable is assigned to using the syntax name[subscript]=value The subscript is treated as an arithmetic expression that must evaluate to a number. If subscript evaluates to a number less than zero, it is used as an offset from one greater than the array’s maximum index (so a subcript of -1 refers to the last element of the array). So I figure I will give it a try and get the following result: $ muh=(1 4 'a' 'bleh'

Gnu Makefile - Handling dependencies

倾然丶 夕夏残阳落幕 提交于 2019-12-03 16:38:50
问题 What approach do C++ programmers on Unix platform use to create and manage Makefiles? I was using hand made Makefiles for my projects but they don't handle header file changes and other dependencies. I googled around and found a good solution here. But I ran into a problem here in the sed command - sed -e 's/#.*//' -e 's/^[^:]*: *//' -e 's/ *\\$$//' \ -e '/^$$/ d' -e 's/$$/ :/' < $*.d >> $*.P; \ The problem is with the 3rd expression "-e 's/ *\$$//'. It doesn't work. Its supposed to remove

[转帖]GNU, Free Software and Open Source 自由软件与开源软件

我的梦境 提交于 2019-12-03 16:28:12
GNU, Free Software and Open Source 自由软件与开源软件 https://blog.csdn.net/icycolawater/article/details/77921998 什么是自由软件 Free software https://www.gnu.org/philosophy/free-sw.html 此处给出自由软件的定义,用以衡量一款软件是否为自由软件。一直以来,我们不断改进这个定义,以此澄清并解决我们遇到的各种问题。参考下方的 修改历史 ,我们详细列出了全部的影响自由软件定义的修改记录。 “自由软件” 尊重用户的自由,并且尊重整个社区。粗略来讲,一个软件如果是自由软件,这意味着用户可以自由地运行,拷贝,分发,学习,修改并改进该软件。因此,“ 自由软件 ” 是关乎自由的问题,与价格无关,软件如何定价并不影响它是否被归类为自由软件。英文中,我们使用Free Software。由于Free一词既有自由,也有免费的意思。而Free Software中的Free是指 “ 自由言论 ” 中的自由,而非 “ 免费 ” 这一意项。为避免歧义,在使用英文时,我们也会借用法语或西班牙语的“Libre Software” 来指自由软件。 我们支持软件用户的自由,因为我们坚信这是每个用户应得的。有了这些自由,软件用户,无论是个人还是集体,都可以掌控所运行的软件

ImageMagick convert and GNU parallel together

回眸只為那壹抹淺笑 提交于 2019-12-03 16:14:40
I would like to speed up the following command: convert -limit memory 64 -limit map 128 -antialias -delay 1x2 final/*.png movie.mp4 I have seen other blog posts where parallel and convert were used together so I am wondering how to make it work with the command above. If downsizing is an option, yes, you can readily do that with GNU Parallel parallel -j 8 convert {} -resize ... {} ::: *.png where {} stands for the filename, and the files to be processed are listed after the ::: . -j gives the number of jobs to run in parallel. I just created 100 PNG s of 10,000 x 8,000 and resized them to 2