array type has incomplete element type ‘struct iovec’ - libssh2

I am trying to build libssh2 using cmake. I have downloaded current master commit cfe0bf64985fd6a5db3b45ffc31a2fe3b8fd9948. When I run the build command, I get this compile error:
extern/libssh2/src/libssh2_priv.h:907:38: error: array type has incomplete element type ‘struct iovec’
const struct iovec datavec[], void **abstract);
^~~~~~~
I am using a debian 10.6 machine and my gcc version is 8.3.0.

There was a colon in the path and removing it solved the problem.
Next question: Why it didn't make any problem to build C++ apps?

Related

How to fix "error: no member named 'fancy_abort' in namespace 'std::__1'; did you mean simply 'fancy_abort'? _VSTD::abort();"

Platform: Macos Catalina 10.15.2
Xcode version: Xcode 11
I have tried many times to make-all gcc to build my source code. However, I have encountered a problem:
In file included from ../.././gcc/c/c-objc-common.c:33:
In file included from /Applications/Xcode11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/new:85:
/Applications/Xcode11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/exception:181:5: error:
no member named 'fancy_abort' in namespace 'std::__1'; did you mean simply 'fancy_abort'?
_VSTD::abort();
^~~~~~~ /Applications/Xcode11.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1/__config:873:15: note:
expanded from macro '_VSTD' # _VSTD std::_LIBCPP_ABI_NAMESPACE
^ ../.././gcc/system.h:685:13: note: 'fancy_abort' declared here extern void fancy_abort (const char *, int, const char
*) ATTRIBUTE_NORETURN;
^
1 error generated.
make[1]: *** [c/c-objc-common.o] Error 1
make: *** [all-gcc] Error 2
I have tried to install another version of Xcode. I have installed Xcode6 but it still did not work, and I found a solution of this issue. But when I download Xcode8.3.3, it is not compatible with Catalina 10.15.2.
I ran in to this issue while using crosstools-ng on mac (mojave 10.14) to compile cross-platform toolchain with gcc 4.9.
Solution: Edit .build/src/gcc-4.9.4/gcc/system.h to add #include <map> in #ifdef __cplusplus block where other include statements are.
The problem is that is included (via ) after abort has been
defined as a macro to fancy_abort. And thus when the C++ standard headers try
to call std::abort, they end up calling std::fancy_abort, which of course
doesn't exist.
Source: https://gcc.gnu.org/legacy-ml/gcc-bugs/2017-09/msg00154.html

macOS command line tools and gcc suddenly failing on Catalina (worked on Mojave)

Command Line tools are giving a multitude of errors when trying to install MuJoCo. I suspect with high confidence that this is an issue from the command line tools on my macOS Catalina since I have installed mujoco previously on Mojave and multiple ubuntu machines. The following installations had worked on Mojave.
First I perform:
xcode-select --install
Further information:
(base) ryanr#RRMBP ~ % /usr/bin/gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.8)
Target: x86_64-apple-darwin19.0.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
I install using pip3 install 'mujoco-py<2.1,>=2.0'
I am greeted with errors as the following:
> /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/resource.h:443:34:
> error: expected declaration specifiers before
> '__OSX_AVAILABLE_STARTING' int getiopolicy_np(int, int)
> __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
> ^~~~~~~~~~~~~~~~~~~~~~~~
and
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:144:1: error: expected declaration specifiers before 'div_t'
div_t div(int, int) __pure2;
^~~~~
and
In file included from /Users/ryanr/.mujoco/mujoco200/include/mujoco.h:34:0,
from /private/var/folders/q7/q_59j36d5n31209r5c01mx2w0000gp/T/pip-install-4_wykvnc/mujoco-py/mujoco_py/gl/glshim.h:4,
from /private/var/folders/q7/q_59j36d5n31209r5c01mx2w0000gp/T/pip-install-4_wykvnc/mujoco-py/mujoco_py/gl/dummyshim.c:1:
/usr/local/Cellar/gcc#6/6.5.0_2/lib/gcc/6/gcc/x86_64-apple-darwin18.5.0/6.5.0/include-fixed/math.h:59:19: error: storage class specified for parameter 'float_t'
typedef float float_t;
^~~~~~~
/usr/local/Cellar/gcc#6/6.5.0_2/lib/gcc/6/gcc/x86_64-apple-darwin18.5.0/6.5.0/include-fixed/math.h:60:20: error: storage class specified for parameter 'double_t'
typedef double double_t;
^~~~~~~~
/usr/local/Cellar/gcc#6/6.5.0_2/lib/gcc/6/gcc/x86_64-apple-darwin18.5.0/6.5.0/include-fixed/math.h:126:12: error: storage class specified for parameter '__math_errhandling'
extern int __math_errhandling(void);
^~~~~~~~~~~~~~~~~~
/usr/local/Cellar/gcc#6/6.5.0_2/lib/gcc/6/gcc/x86_64-apple-darwin18.5.0/6.5.0/include-fixed/math.h:146:12: error: storage class specified for parameter '__fpclassifyf'
extern int __fpclassifyf(float);
^~~~~~~~~~~~~
/usr/local/Cellar/gcc#6/6.5.0_2/lib/gcc/6/gcc/x86_64-apple-darwin18.5.0/6.5.0/include-fixed/math.h:147:12: error: storage class specified for parameter '__fpclassifyd'
extern int __fpclassifyd(double);
^~~~~~~~~~~~~
/usr/local/Cellar/gcc#6/6.5.0_2/lib/gcc/6/gcc/x86_64-apple-darwin18.5.0/6.5.0/include-fixed/math.h:148:12: error: storage class specified for parameter '__fpclassifyl'
extern int __fpclassifyl(long double);
^~~~~~~~~~~~~
and
^
In file included from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/wait.h:110:0,
from /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/stdlib.h:66,
from /Users/ryanr/.mujoco/mujoco200/include/mujoco.h:33,
from /private/var/folders/q7/q_59j36d5n31209r5c01mx2w0000gp/T/pip-install-jye6hn52/mujoco-py/mujoco_py/gl/glshim.h:4,
from /private/var/folders/q7/q_59j36d5n31209r5c01mx2w0000gp/T/pip-install-jye6hn52/mujoco-py/mujoco_py/gl/dummyshim.c:1:
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/resource.h:443:9: error: old-style parameter declarations in prototyped function definition
int getiopolicy_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
^~~~~~~~~~~~~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/resource.h:443:1: error: parameter name omitted
int getiopolicy_np(int, int) __OSX_AVAILABLE_STARTING(__MAC_10_5, __IPHONE_2_0);
^~~
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/sys/resource.h:443:1: error: parameter name omitted
/private/var/folders/q7/q_59j36d5n31209r5c01mx2w0000gp/T/pip-install-jye6hn52/mujoco-py/mujoco_py/gl/dummyshim.c:37:1: error: expected '{' at end of input
}
^
error: command '/usr/local/bin/gcc-6' failed with exit status 1
----------------------------------------
ERROR: Failed building wheel for mujoco-py
Any suggestions as to why my command-line tools are failing on macOS Catalina? What steps should one take to ensure that the command-line tools and gcc on Catalina are working as expected?
Pass the previous version’s OS X sdk as sysroot, instead of the unversioned sdk.
Command-line tools are failing on macOS Catalina due to incorrect SDK directory.
What steps should one take to ensure that the command-line tools and gcc on Catalina are working as expected? Reference the versioned SDK:
./configure --with-gxx-include-dir=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/4.2.1
and/or
./configure --with-sysroot=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk

"'_Nonnull' cannot be applied to non-pointer type" while building FLTK on macOS?

I tried to build FLTK 1.3.4-2 version on my mac. I followed the instruction, and successfully configure it.
But when I install it, it shows:
Compiling Fl_cocoa.mm...
In file included from Fl_cocoa.mm:55:
In file included from /System/Library/Frameworks/Cocoa.framework/Headers/Cocoa.h:12:
In file included from /System/Library/Frameworks/Foundation.framework/Headers/Foundation.h:128:
/System/Library/Frameworks/Foundation.framework/Headers/NSUUID.h:26:49: error: nullability specifier '_Nullable' cannot be applied to
non-pointer type 'uuid_t' (aka 'unsigned char [16]')
- (instancetype)initWithUUIDBytes:(const uuid_t _Nullable)bytes;
^
/System/Library/Frameworks/Foundation.framework/Headers/NSUUID.h:29:30: error: nullability specifier '_Nonnull' cannot be applied to
non-pointer type 'uuid_t' (aka 'unsigned char [16]')
- (void)getUUIDBytes:(uuid_t _Nonnull)uuid;
^
2 errors generated.
make[1]: *** [Fl_cocoa.o] Error 1
make: *** [install] Error 1
Does anyone know how to solve this problem?
It seems you build system is a bit of mix'n'match and through that you have found a compiler bug.
The error message indicates that the compiler is not recognising that an array type (uuid_t) when used as a function/method parameter type becomes a pointer type (as C-style arrays are passed by reference not by value) before it checks the validity of _Nullable/_Nonnull – so it throws the error as _Nullable/_Nonnull are not applicable to array types.
However not only isn't this your code, it is system code which is causing the error, which is surprising. Which is where the mix'n'match comes in...
Prior to the macOS10.13 SDK the two methods causing the error, initWithUUIDBytes: and getUUIDBytes:, were not annotated with nullability attributes. By default Xcode 8.1 uses the macOS10.12 SDK and your code should compile with that arrangement – the included header, NSUUID.h, will not contain the nullability attributes.
If you wrote your own code with array typed parameters and specified nullability then Xcode 8.1's compiler would produce an error – the bug is in (at least) that compiler. But this isn't your code...
Xcode 9.4.1 (lastest 9) by default uses macOS10.13SDK and again your code would compiler – the included header will contain the nullability attributes and Xcode 9.4.1's compiler will not produce an error as the bug has been fixed.
So at best guess either you are using Xcode 8.1 but with the macOS10.13+ SDK intentionally installed, or you've managed to install the macOS10.13+ SDK headers and you are using a version of gcc which has the bug, or you've got multiple versions of Xcode installed and the command line tools are not for Xcode 8.1 (How to switch between multiple Command Line Tools installations in Mac OS X (without installing XCode) may help), or some other scenario where you've got mismatched compilers and installed SDKs – nobody else but you can know what is actually installed on your system; the header file path is a system location so the header causing the issue isn't a copy in the FLTK source folder.
HTH
[BTW your gcc comes from 2007, if you are building with it you should probably update to something newer.]

Can I safely ignore these pthread warnings via glibc?

I am getting a pair of warnings with version 2.22 of glibc:
In file included from /net/module/sw/glibc/2.22/include/pthread.h:23:0,
from foo.h:48,
from foo.c:23:
/net/module/sw/glibc/2.22/include/sched.h:74:57: warning: ‘struct timespec’ declared inside parameter list
extern int sched_rr_get_interval (__pid_t __pid, struct timespec *__t) __THROW;
^
/net/module/sw/glibc/2.22/include/sched.h:74:57: warning: its scope is only this definition or declaration, which is probably not what you want
In file included from foo.h:48:0,
from foo.c:23:
/net/module/sw/glibc/2.22/include/pthread.h:1002:21: warning: ‘struct timespec’ declared inside parameter list
const struct timespec *__restrict __abstime)
^
And:
In file included from /net/module/sw/glibc/2.22/include/sys/param.h:26:0,
from foo.h:51,
from foo.c:23:
/net/module/sw/glibc/2.22/include/limits.h:123:3: warning: #include_next is a GCC extension
# include_next <limits.h>
^
I am using GCC 5.3.0 with this version of glibc.
Since these warnings are referencing an external library I do not control, can I safely ignore these warnings if my application otherwise appears to pass tests?
My concern is that these warnings (particularly those related to pthread) may indicate the introduction of subtle bugs that I do not have tests to catch.
Yes, these warnings should be harmless, but the struct timespec warning is certainly odd. Usually, they would be masked by GCC's warning suppression for system headers.

Error while building Linux Kernel 2.6.10 Error: operand type mismatch for `mov'

I am learning writing Linux Kernel Modules and following the book Linux Device Drivers. which instructs building and configure a kernel of 2.6.x . I am using kernel version 2.6.10. I followed the steps on thegeekstuff.com/compile-linux-kernel
i.e. I after untarring in the /usr/src directory, I did
$ make menuconfig #this opened up a gui
then I saved the config without making any changes, in the hope to enforce default configuration and then
$ make.
when I did make, it gave me this error and the warning’
include/asm/mpspec_def.h:78:2: warning: ‘packed’ attribute ignored for field
of type ‘unsigned char[6]’ [-Wattributes]
arch/i386/kernel/process.c: In function ‘show_regs’:
arch/i386/kernel/process.c:259:2: warning: pointer targets in passing argument 2 of ‘show_trace’ differ in signedness [-Wpointer-sign]
include/asm/processor.h:499:6: note: expected ‘long unsigned int *’ but argument is of type ‘long int *
arch/i386/kernel/process.c: Assembler messages:
arch/i386/kernel/process.c:384: Error: operand type mismatch for mov'
arch/i386/kernel/process.c:385: Error: operand type mismatch formov'
arch/i386/kernel/process.c:461: Error: operand type mismatch for `mov'
include/linux/elfcore.h:92: Error: operand type mismatch for mov'
include/linux/elfcore.h:92: Error: operand type mismatch formov'
arch/i386/kernel/process.c:583: Error: operand type mismatch for mov'
arch/i386/kernel/process.c:584: Error: operand type mismatch formov'
arch/i386/kernel/process.c:591: Error: operand type mismatch for mov'
arch/i386/kernel/process.c:592: Error: operand type mismatch formov'
make1: [arch/i386/kernel/process.o] Error 1
make: [arch/i386/kernel] Error 2
I have not written professional kernel code before so I am not sure if I should make any changes in the code. Can anybody help me with why this error occurred and how it can be removed. I used the default kernel config. prior to calling make using make menu-config.
The error in the process.c is in savesegment(fs,p->thread.fs); (all instances of the error are from the same function)
Thanks
It is not clear from your question that what are the exact steps you did.
This error may be due to some issues in configuration.
Please try the following steps and see if it solves the problem:
> make defconfig #Creates a default config based on your machine architecture
> make
I used a kernel version who version was closer to my native kernel version ~ 3.11.1. and used make oldconfig instead. This was easier than figuring out each configuration setting for my architecture.

Resources