when I include atomic.h, GCC says No such file, why? - linux

I want to use atomic API, and I include . I don't know how to use it! Thank you!
I have it in /usr/src/linux-headers-2.6.28-11/arch/x86/include/asm/atomic.h.
I also add -I/usr/src/linux-headers-2.6.28-11/arch/x86/include/ and -I/usr/src/linux-headers-2.6.28-11/include.
Some other errors is produced because of -DCONFIG_X86_32 and -D__KERNEL__ macro undefined.
Then I define the two macros,
some errors occurred:
/usr/src/linux-headers-2.6.28-11/include/linux/cpumask.h:600:37: error: "and" may not appear in macro parameter list
/usr/src/linux-headers-2.6.28-11/arch/x86/include/asm/processor.h:159:1: warning: "cache_line_size" redefined
/usr/src/linux-headers-2.6.28-11/include/linux/cache.h:64:1: warning: this is the location of the previous definition
/usr/src/linux-headers-2.6.28-11/include/linux/stddef.h:16: error: expected identifier before ‘false’
/usr/src/linux-headers-2.6.28-11/include/linux/stddef.h:16: error: expected `}' before ‘false’
/usr/src/linux-headers-2.6.28-11/include/linux/stddef.h:16: error: expected unqualified-id before ‘false’
/usr/src/linux-headers-2.6.28-11/include/linux/stddef.h:18: error: expected declaration before ‘}’ token
My system is ubuntu 9.04 running on Virtualbox3.0.

If you know where the file is on your HD, then you say gcc mySource.c -I/path/to/atomic
note that this assumes you include "atomic" directly. and not "some/path/atmomic.h"

Related

How can i make the busybox1.23.2 Compile success?

package: busybox
version: 1.23.2
when i make busybox , it produces unexpected results.
the crosschaintool i use is ARM/uClinux Toolchain arm-2010q1-189-arm- uclinuxeabi-i686-pc-linux-gnu,but i can't make the busybox,like this:
root#ubuntu:/busybox/busybox-1.23.2# make
SPLIT include/autoconf.h -> include/config/*
GEN include/bbconfigopts.h
HOSTCC applets/usage
applets/usage.c: In function ‘main’:
applets/usage.c:52:3: warning: ignoring return value of ‘write’, declared with attribute warn_unused_result [-Wunused-result]
write(STDOUT_FILENO, usage_array[i].usage, strlen(usage_array[i].usage) + 1);
^
GEN include/usage_compressed.h
HOSTCC applets/applet_tables
applets/applet_tables.c: In function ‘main’:
applets/applet_tables.c:161:4: warning: ignoring return value of ‘fgets’, declared with attribute warn_unused_result [-Wunused-result]
fgets(line_old, sizeof(line_old), fp);
^
GEN include/applet_tables.h
CC applets/applets.o
LD applets/built-in.o
HOSTCC applets/usage_pod
applets/usage_pod.c: In function ‘main’:
applets/usage_pod.c:74:3: warning: format not a string literal and no format arguments [-Wformat-security]
printf(usage_array[i].aname);
^
CC libbb/appletlib.o
CC libbb/vfork_daemon_rexec.o
AR libbb/lib.a
CC shell/hush.o
shell/hush.c: In function 'builtin_source':
shell/hush.c:8901: warning: 'sv.sv_g_malloced' may be used uninitialized in this function
shell/hush.c:8901: warning: 'sv.sv_g_argc' may be used uninitialized in this function
shell/hush.c:8901: warning: 'sv.sv_g_argv' may be used uninitialized in this function
shell/hush.c:8901: warning: 'sv.sv_argv0' may be used uninitialized in this function
AR shell/lib.a
LINK busybox_unstripped
Trying libraries: crypt m
Library crypt is not needed, excluding it
Library m is not needed, excluding it
Final link with: <none>
arm-uclinuxeabi-strip:busybox_unstripped: File format not recognized
Makefile:723: recipe for target 'busybox' failed
make: *** [busybox] Error 1
how should i do? is the busybox can't use the ARM/uClinux Toolchain? how should i do ?we'll really appreciate it if you can give us some advice and some pieces of guidance,thanks!
LINK busybox_unstripped Trying libraries: crypt m Library crypt
is not needed, excluding it Library m is not needed, excluding it
Final link with: arm-uclinuxeabi-strip:busybox_unstripped: File
format not recognized Makefile:723: recipe for target 'busybox' failed
make: *** [busybox] Error 1
As there is only a piece of the whole compiling log, some suggestions are:
1) Please check the compiling log from the beginning whether there are other important warnings or errors.
2) busybox_unstripped file is generated or not? Check the makefile dependencies to find out whether all dependencies files are successfully generated. From the log, some libraries are excluded so that you may have to check the busybox configuration file.
3) If busybox_unstripped file is generated, check the makefile about the link grammar of "Final link with:". For the cross-tool chain to link successfully, please make sure the link command is correct.
Good luck!

Install OpenCV-2.4.9 on CentOS 7 (PC)

I'm trying to install OpenCV-2.4.9 on CentOS 7 (PC) however getting error after 16% when running "make" command. I leave default configuration for OpenCV.
make
...
[ 16%] Building CXX object modules/highgui/CMakeFiles/opencv_highgui.dir/src/cap_v4l.cpp.o /opt/opencv-2.4.9/opencv/modules/highgui/src/cap_v4l.cpp:306:29: error: field ‘capability’ has incomplete type
struct video_capability capability;
^ /opt/opencv-2.4.9/opencv/modules/highgui/src/cap_v4l.cpp:307:29: error: field ‘captureWindow’ has incomplete type
struct video_window captureWindow;
....
....
/opt/opencv-2.4.9/opencv/modules/highgui/src/cap_v4l.cpp: In function ‘void icvCloseCAM_V4L(CvCaptureCAM_V4L*)’:
/opt/opencv-2.4.9/opencv/modules/highgui/src/cap_v4l.cpp:2812:46: error: ‘CvCaptureCAM_V4L’ has no member named ‘memoryBuffer’
It seems that the define HAVE_CAMV4L has the value 1, if you look in the file modules/highgui/src/cap_v4l.cpp looking for the structure definition at the row 306. If the compilation fails at that point this means that the video4linux development configuration is corrupted.
Using google I have found that the OpenCV Bug #1357 is described as follow:
CHECK_INCLUDE_FILE(linux/videodev.h HAVE_CAMV4L) succeeds even though linux/videodev.h doesn't exist on the system. (Bug #1357)
http://code.opencv.org/issues/1357
Anyway the solution is described at the same URL for "HAVE_CAMV4L gets set incorrectly": "Setting it to FALSE in CMakeLists.txt fixes the problem".

Use of static_assert forbidden in Android project

I am porting some C++ code to Android. One of the source files includes a webrtc header file that causes error during compilation. I have reduced the problem to this simple code:
template <class T, int n>
struct DefaultDeleter<T[n]> {
// Never allow someone to declare something like scoped_ptr<int[10]>.
static_assert(sizeof(T) == -1, "do not use array with size as type");
};
The error I get is:
[armeabi-v7a] Compile++ thumb: dummyclient <= dummy.cpp
dummy.cpp:7:3: warning: identifier 'static_assert' will become a keyword in C++0x [-Wc++0x-compat]
dummy.cpp:5:8: error: 'DefaultDeleter' is not a template
dummy.cpp:7:17: error: expected identifier before 'sizeof'
dummy.cpp:7:17: error: expected ',' or '...' before 'sizeof'
dummy.cpp:7:70: error: ISO C++ forbids declaration of 'static_assert' with no type [-fpermissive]
The same code compiles fine on Windows and Linux. Is there some compiler settings that are required for Android? Regards.
You need to pass the CPPFLAG -std=c++11.

compiling error core.c in mapcache with cygwin

When installing mapcache in cygwin, make produced:
/opt/mapcache/mapcache-rel-1-2-1/lib/core.c: In function ‘mapcache_prefetch_tiles’:
/opt/mapcache/mapcache-rel-1-2-1/lib/core.c:81:3: error: unknown type name ‘apr_thread_t’
apr_thread_t **threads;
^
/opt/mapcache/mapcache-rel-1-2-1/lib/core.c:82:3: error: unknown type name ‘apr_threadattr_t’
apr_threadattr_t *thread_attrs;
^
/opt/mapcache/mapcache-rel-1-2-1/lib/core.c:83:7: warning: unused variable ‘nthreads’ [-Wunused-variable]
int nthreads;
^
/opt/mapcache/mapcache-rel-1-2-1/lib/core.c:82:21: warning: unused variable ‘thread_attrs’ [-Wunused-variable]
apr_threadattr_t *thread_attrs;
^
/opt/mapcache/mapcache-rel-1-2-1/lib/core.c:81:18: warning: unused variable ‘threads’ [-Wunused-variable]
apr_thread_t **threads;
^
I searched for some hints about this error but didn't find anything. Looking for apr_thread_t and cywgin, I found some pages pointing to an error with apache, but not really sure if apache has something to do here.
Any ideas about this please? what is the mapcache forum? is there any? thanks for any hints on this,
Updating the this answer based on post from the mapserver list by the developer of mapcache:
From http://mail-archives.apache.org/mod_mbox/apr-dev/201209.mbox/%3C4994179EC7ED6843AAB0A30A1639E7F825143612EF#DGEX2V.dg.deltagroup.com%3E it would seem that threads are not supported by Apr on cygwin. Currently mapcache does not support unthreaded environments so there's nothing you can do without hacking the mapcache codebase. I believe the change would not be very extensive as the source WMS fetches only need to be sequentialized instead of parralelized in core.c

BusyBox: Error during make

I try to install BusyBox 1.20.2 on a embedded system with PowerPc. At first I want to try it with the default config.
So this are the commands
make defconfig
make
And this is the result:
ma-bash-3.2# make
CC miscutils/ubi_tools.o
miscutils/ubi_tools.c: In function 'ubi_tools_main':
miscutils/ubi_tools.c:137: error: 'UBI_DEV_NUM_AUTO' undeclared (first use in this function)
miscutils/ubi_tools.c:137: error: (Each undeclared identifier is reported only once
miscutils/ubi_tools.c:137: error: for each function it appears in.)
miscutils/ubi_tools.c:157: error: storage size of 'req' isn't known
miscutils/ubi_tools.c:165: error: 'UBI_IOCATT' undeclared (first use in this function)
miscutils/ubi_tools.c:157: warning: unused variable 'req'
miscutils/ubi_tools.c:171: error: 'UBI_IOCDET' undeclared (first use in this function)
make[1]: *** [miscutils/ubi_tools.o] Error 1
make: *** [miscutils] Error 2
How is it possible to solve that Error?
Can I disable this ubi_tool ? What effects will that have and how to do that?
Remove these lines in .config:
CONFIG_UBIATTACH=y
CONFIG_UBIDETACH=y
CONFIG_UBIMKVOL=y
CONFIG_UBIRMVOL=y
CONFIG_UBIRSVOL=y
CONFIG_UBIUPDATEVOL=y
you won't have support for ubifs.

Resources