I am getting compilation error for posix_spawnp function on Android-ndk - android-ndk

I am using Ubuntu Linux and Android (android-ndk-r21d). When I am compiling my code with ndk-build, I am getting compilation error for posix_spawnp function call. I have included the header <spawn.h> for this function. I am unable to figure what compilation and Link flags I should use for this function in my Android.mk file. Is this function supported on Android-ndk ?
alc#alc:~/src/ForkBench(master)$ ndk-build NDK_PROJECT_PATH=./
[arm64-v8a] Compile : forkBench <= forkBench.c
jni/../forkBench.c:61:12: error: implicit declaration of function 'posix_spawnp' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
status = posix_spawnp(&pid, TRUEAPP, NULL, NULL, launch_argv, NULL);
^
jni/../forkBench.c:90:12: error: implicit declaration of function 'posix_spawnp' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
status = posix_spawnp(&pid, TRUEAPP, NULL, NULL, launch_argv, NULL);
^
2 errors generated.
make: *** [/home/alc/android-ndk-r21d-linux-x86_64/android-ndk-r21d/build/core/build-binary.mk:476: obj/local/arm64-v8a/objs/forkBench/__/forkBench.o] Error 1

Related

Cross-compile of CPython 3.8 fails at _socket module

I am trying to cross-compile CPython 3.8 using Android NDK toolchains with enabled _socket module but unfortunately compilation failes at:
../Modules/socketmodule.c:6739:5: error: invalid use of undefined type 'struct if_nameindex'
for (i = 0; ni[i].if_index != 0 && i < INT_MAX; i++) {
^
../Modules/socketmodule.c:6739:19: error: dereferencing pointer to incomplete type
for (i = 0; ni[i].if_index != 0 && i < INT_MAX; i++) {
^
../Modules/socketmodule.c:6753:17: error: invalid use of undefined type 'struct if_nameindex'
ni[i].if_index, PyUnicode_DecodeFSDefault, ni[i].if_name);
^
../Modules/socketmodule.c:6753:19: error: dereferencing pointer to incomplete type
ni[i].if_index, PyUnicode_DecodeFSDefault, ni[i].if_name);
^
../Modules/socketmodule.c:6753:17: error: invalid use of undefined type 'struct if_nameindex'
ni[i].if_index, PyUnicode_DecodeFSDefault, ni[i].if_name);
^
../Modules/socketmodule.c:6753:62: error: dereferencing pointer to incomplete type
ni[i].if_index, PyUnicode_DecodeFSDefault, ni[i].if_name);
^
Whithout _socket module the whole cross-compilation works well, there are no errors.
Problem solved using the latest r23b version of Android NDK.

Building old version of Intel i40e driver on centOS errors

I'm trying to build an old version of the i40e driver for the Intel X710 NIC.
I have to use an old version of the driver because they removed a functionality I need.
The version I'm trying to use is i40e-1.5.23 from 10/5/2016.
If I try to build the latest version, I don't get any errors.
I have installed "Development Tools" packages so Kernel-Devel, gcc...
My current Kernel version is 3.10.0-693.21.1.el7.x86_64
My current CentOS version is 7.4.1708
I tried with different kernel/kernel header versions but still get the same error. I also tried with various version of the i40e driver.
In the readme of the driver it's written that the kernel and kernel header files must be the same version and I'm quite sure they are in my situation.
Here is the output when I try to make in the src folder of the driver :
make[1]: Entering directory '/usr/src/kernels/3.10.0-693.21.1.el7.x86_64'
CC [M] /home/fla/Desktop/i40e-1.5.23/src/i40e_main.o
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:51:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/home/fla/Desktop/i40e-1.5.23/src/kcompat.h:5097:20: error: redefinition of ‘csum_replace_by_diff’
static inline void csum_replace_by_diff(__sum16 *sum, __wsum diff)
^~~~~~~~~~~~~~~~~~~~
In file included from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/linux/skbuff.h:30:0,
from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/linux/tcp.h:21,
from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/tcp.h:24,
from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:27,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/checksum.h:110:20: note: previous definition of ‘csum_replace_by_diff’ was here
static inline void csum_replace_by_diff(__sum16 *sum, __wsum diff)
^~~~~~~~~~~~~~~~~~~~
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:51:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/home/fla/Desktop/i40e-1.5.23/src/kcompat.h:5131:1: error: redefinition of ‘pci_request_io_regions’
pci_request_io_regions(struct pci_dev *pdev, const char *name)
^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:32:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/linux/pci.h:1425:1: note: previous definition of ‘pci_request_io_regions’ was here
pci_request_io_regions(struct pci_dev *pdev, const char *name)
^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:51:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/home/fla/Desktop/i40e-1.5.23/src/kcompat.h:5138:1: error: redefinition of ‘pci_release_io_regions’
pci_release_io_regions(struct pci_dev *pdev)
^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:32:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/linux/pci.h:1432:1: note: previous definition of ‘pci_release_io_regions’ was here
pci_release_io_regions(struct pci_dev *pdev)
^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:51:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/home/fla/Desktop/i40e-1.5.23/src/kcompat.h:5145:1: error: redefinition of ‘pci_request_mem_regions’
pci_request_mem_regions(struct pci_dev *pdev, const char *name)
^~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:32:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/linux/pci.h:1439:1: note: previous definition of ‘pci_request_mem_regions’ was here
pci_request_mem_regions(struct pci_dev *pdev, const char *name)
^~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:51:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/home/fla/Desktop/i40e-1.5.23/src/kcompat.h:5152:1: error: redefinition of ‘pci_release_mem_regions’
pci_release_mem_regions(struct pci_dev *pdev)
^~~~~~~~~~~~~~~~~~~~~~~
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:32:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/linux/pci.h:1446:1: note: previous definition of ‘pci_release_mem_regions’ was here
pci_release_mem_regions(struct pci_dev *pdev)
^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/vxlan.h:5:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:30:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/udp_tunnel.h:103:6: error: nested redefinition of ‘enum udp_parsable_tunnel_type’
enum udp_parsable_tunnel_type {
^~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/udp_tunnel.h:103:6: error: redeclaration of ‘enum udp_parsable_tunnel_type’
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:51:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/home/fla/Desktop/i40e-1.5.23/src/kcompat.h:5120:6: note: originally defined here
enum udp_parsable_tunnel_type {
^~~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/vxlan.h:5:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:30:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/udp_tunnel.h:104:2: error: redeclaration of enumerator ‘UDP_TUNNEL_TYPE_VXLAN’
UDP_TUNNEL_TYPE_VXLAN, /* RFC 7348 */
^~~~~~~~~~~~~~~~~~~~~
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:51:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/home/fla/Desktop/i40e-1.5.23/src/kcompat.h:5121:2: note: previous definition of ‘UDP_TUNNEL_TYPE_VXLAN’ was here
UDP_TUNNEL_TYPE_VXLAN,
^~~~~~~~~~~~~~~~~~~~~
In file included from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/vxlan.h:5:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:30:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/udp_tunnel.h:105:2: error: redeclaration of enumerator ‘UDP_TUNNEL_TYPE_GENEVE’
UDP_TUNNEL_TYPE_GENEVE, /* draft-ietf-nvo3-geneve */
^~~~~~~~~~~~~~~~~~~~~~
In file included from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:51:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/home/fla/Desktop/i40e-1.5.23/src/kcompat.h:5122:2: note: previous definition of ‘UDP_TUNNEL_TYPE_GENEVE’ was here
UDP_TUNNEL_TYPE_GENEVE,
^~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/vxlan.h:5:0,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:30:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/udp_tunnel.h:109:8: error: redefinition of ‘struct udp_tunnel_info’
struct udp_tunnel_info {
^~~~~~~~~~~~~~~
In file included from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/sock.h:51:0,
from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/linux/tcp.h:23,
from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/tcp.h:24,
from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:27,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/linux/netdevice.h:67:8: note: originally defined here
struct udp_tunnel_info;
^~~~~~~~~~~~~~~
/home/fla/Desktop/i40e-1.5.23/src/i40e_main.c: In function ‘i40e_tx_timeout’:
/home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:281:42: error: ‘struct net_device’ has no member named ‘trans_start’; did you mean ‘mem_start’?
trans_start = q->trans_start ? : netdev->trans_start;
^~
/home/fla/Desktop/i40e-1.5.23/src/i40e_main.c: In function ‘i40e_ndo_bridge_getlink’:
/home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:9442:9: error: too few arguments to function ‘ndo_dflt_bridge_getlink’
return ndo_dflt_bridge_getlink(skb, pid, seq, dev, veb->bridge_mode,
^~~~~~~~~~~~~~~~~~~~~~~
In file included from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/dst.h:13:0,
from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/sock.h:72,
from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/linux/tcp.h:23,
from /usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/net/tcp.h:24,
from /home/fla/Desktop/i40e-1.5.23/src/i40e.h:27,
from /home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:25:
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/include/linux/rtnetlink.h:115:12: note: declared here
extern int ndo_dflt_bridge_getlink(struct sk_buff *skb, u32 pid, u32 seq,
^~~~~~~~~~~~~~~~~~~~~~~
/home/fla/Desktop/i40e-1.5.23/src/i40e_main.c: At top level:
/home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:9494:2: error: unknown field ‘ndo_set_vf_vlan’ specified in initializer
.ndo_set_vf_vlan = i40e_ndo_set_vf_port_vlan,
^
/home/fla/Desktop/i40e-1.5.23/src/i40e_main.c: In function ‘i40e_ndo_bridge_getlink’:
/home/fla/Desktop/i40e-1.5.23/src/i40e_main.c:9451:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/scripts/Makefile.build:341: recipe for target '/home/fla/Desktop/i40e-1.5.23/src/i40e_main.o' failed
make[3]: *** [/home/fla/Desktop/i40e-1.5.23/src/i40e_main.o] Error 1
/usr/src/kernels/3.10.0-693.21.1.el7.x86_64/Makefile:1305: recipe for target '_module_/home/fla/Desktop/i40e-1.5.23/src' failed
make[2]: *** [_module_/home/fla/Desktop/i40e-1.5.23/src] Error 2
Makefile:140: recipe for target 'sub-make' failed
make[1]: *** [sub-make] Error 2
make[1]: Leaving directory '/usr/src/kernels/3.10.0-693.21.1.el7.x86_64'
Makefile:96: recipe for target 'default' failed
make: *** [default] Error 2
It looks like the error is comming from kcompat.h.
I can't find any information on how to solve this problem elsewhere so that's why I created this post.
Any help is appreciated.

error: expected nested-name-specifier when compile breakpad android sample app

When I try to compile android sample app of breakpad, I got this error and have no idea how to resolve it. I'm using Mac OSX 10.11 and android ndk r10e. Many Thanks in advance.
jni/../../google_breakpad/../../src/client/linux/log/log.cc:47:7: error: expected nested-name-specifier before 'AndroidLogBufferWriteFunc'
using AndroidLogBufferWriteFunc = int (*)(int bufID, int prio, const char *tag,
^
jni/../../google_breakpad/../../src/client/linux/log/log.cc:53:1: error: 'AndroidLogBufferWriteFunc' does not name a type
AndroidLogBufferWriteFunc g_android_log_buf_write = nullptr;
^
jni/../../google_breakpad/../../src/client/linux/log/log.cc: In function 'void logger::initializeCrashLogWriter()':
jni/../../google_breakpad/../../src/client/linux/log/log.cc:60:3: error: 'g_android_log_buf_write' was not declared in this scope
g_android_log_buf_write = reinterpret_cast<AndroidLogBufferWriteFunc>(
^
jni/../../google_breakpad/../../src/client/linux/log/log.cc:60:46: error: 'AndroidLogBufferWriteFunc' does not name a type
g_android_log_buf_write = reinterpret_cast<AndroidLogBufferWriteFunc>(
^
jni/../../google_breakpad/../../src/client/linux/log/log.cc: In function 'int logger::writeToCrashLog(const char*)':
jni/../../google_breakpad/../../src/client/linux/log/log.cc:68:7: error: 'g_android_log_buf_write' was not declared in this scope
if (g_android_log_buf_write) {

node-gyb build error on hello world

I was trying to compile the node hello world addon and when I call
node-gyp configure build it generates several errors.
../binding.cc:6:19: error: unknown type name 'FunctionCallbackInfo'
void Method(const FunctionCallbackInfo<Value>& args) {
^
../binding.cc:6:39: error: expected ')'
void Method(const FunctionCallbackInfo<Value>& args) {
^
../binding.cc:6:12: note: to match this '('
void Method(const FunctionCallbackInfo<Value>& args) {
^
../binding.cc:8:15: error: no matching constructor for initialization of 'v8::HandleScope'
HandleScope scope(isolate);
^ ~~~~~~~
/***/***/.node-gyp/0.10.36/deps/v8/include/v8.h:473:3: note: candidate constructor not viable: no known conversion from 'v8::Isolate *' to 'const v8::HandleScope' for 1st
argument
HandleScope(const HandleScope&);
^
/****/***/.node-gyp/0.10.36/deps/v8/include/v8.h:448:3: note: candidate constructor not viable: requires 0 arguments, but 1 was provided
HandleScope();
^
../binding.cc:9:3: error: use of undeclared identifier 'args'
args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world"));
^
../binding.cc:9:37: error: no member named 'NewFromUtf8' in 'v8::String'
args.GetReturnValue().Set(String::NewFromUtf8(isolate, "world"));
What can be the problem?
The problem is that the example assumes you're running Node 0.12, but you're running Node 0.10 (0.10.36 by the looks of it). There have been big (backward-incompatible) changes in the way addons are structured in Node 0.12.
Here's the 0.10-compatible version: https://github.com/joyent/node/blob/aa35564ca1c9f3854bc5f7983f2f00cb51f67ffe/test/addons/hello-world/binding.cc
An awesome package that will take care of a lot of the differences between Node versions is nan.

errors when trying to build in cygwin

Considering none of the code is my own, I feel helpless. It's an open source tool, and I can't use it.
This is the tool : http://www.gnucap.org/devel/gnucap-2013-04-23.tar.gz
And these are the errors I get when building on Cygwin (Win 7, 64b) :
$ ./configure
Configuring gnucap using --prefix=/usr/local
include
lib
In file included from /usr/include/readline/readline.h:35:0,
from test_readline.cc:2:
/usr/include/readline/rltypedefs.h:64:28: error: typedef ‘rl_getc_func_t’ is initialized (use decltype instead)
typedef int rl_getc_func_t PARAMS((FILE *));
^
/usr/include/readline/rltypedefs.h:64:28: error: ‘FILE’ was not declared in this scope
/usr/include/readline/rltypedefs.h:64:28: error: expected primary-expression before ‘)’ token
typedef int rl_getc_func_t PARAMS((FILE *));
^
/usr/include/readline/readline.h:419:20: error: ‘FILE’ was not declared in this scope
extern int rl_getc PARAMS((FILE *));
^
/usr/include/readline/readline.h:419:20: error: expected primary-expression before ‘)’ token
extern int rl_getc PARAMS((FILE *));
^
In file included from test_readline.cc:2:0:
/usr/include/readline/readline.h:542:8: error: ‘FILE’ does not name a type
extern FILE *rl_instream;
^
/usr/include/readline/readline.h:543:8: error: ‘FILE’ does not name a type
extern FILE *rl_outstream;
^
/usr/include/readline/readline.h:565:8: error: ‘rl_getc_func_t’ does not name a type
extern rl_getc_func_t *rl_getc_function;
^
/usr/include/readline/readline.h:867:3: error: ‘FILE’ does not name a type
FILE *inf;
^
/usr/include/readline/readline.h:868:3: error: ‘FILE’ does not name a type
FILE *outf;
^
either libtermcap or libreadline is missing - not using readline
modelgen
main
apps
In file included from /usr/include/readline/readline.h:35:0,
from test_readline.cc:2:
/usr/include/readline/rltypedefs.h:64:28: error: typedef ‘rl_getc_func_t’ is initialized (use decltype instead)
typedef int rl_getc_func_t PARAMS((FILE *));
^
/usr/include/readline/rltypedefs.h:64:28: error: ‘FILE’ was not declared in this scope
/usr/include/readline/rltypedefs.h:64:28: error: expected primary-expression before ‘)’ token
typedef int rl_getc_func_t PARAMS((FILE *));
^
/usr/include/readline/readline.h:419:20: error: ‘FILE’ was not declared in this scope
extern int rl_getc PARAMS((FILE *));
^
/usr/include/readline/readline.h:419:20: error: expected primary-expression before ‘)’ token
extern int rl_getc PARAMS((FILE *));
^
In file included from test_readline.cc:2:0:
/usr/include/readline/readline.h:542:8: error: ‘FILE’ does not name a type
extern FILE *rl_instream;
^
/usr/include/readline/readline.h:543:8: error: ‘FILE’ does not name a type
extern FILE *rl_outstream;
^
/usr/include/readline/readline.h:565:8: error: ‘rl_getc_func_t’ does not name a type
extern rl_getc_func_t *rl_getc_function;
^
/usr/include/readline/readline.h:867:3: error: ‘FILE’ does not name a type
FILE *inf;
^
/usr/include/readline/readline.h:868:3: error: ‘FILE’ does not name a type
FILE *outf;
^
either libtermcap or libreadline is missing - not using readline
done
Any help will be great. I feel helpless. If you can suggest resources so I can learn to fix such errors on my own, that would be teaching me how to fish..
You have to include stdio.h in lib/test_readline.cc to define FILE.

Resources