交叉编译qt以获得树莓派stdlib.h错误

时间:2019-06-12 21:38:22

标签: qt raspberry-pi3 cross-compiling

我正在对树莓派进行交叉编译。它设置正确,没有问题。然后我说要写我的第一个代码。创建新项目时,我使用了空模板。然后点击运行按钮,我收到了以下错误:

/home/molinux/raspi/sysroot/usr/include/stdlib.h:471: error: expected initializer before ‘__attribute_alloc_size__’
      __THROW __attribute_malloc__ __attribute_alloc_size__ ((2)) __wur;
                                   ^~~~~~~~~~~~~~~~~~~~~~~~
/home/molinux/raspi/sysroot/usr/include/time.h:123: error: ‘__syscall_slong_t’ does not name a type
     __syscall_slong_t tv_nsec; /* Nanoseconds.  */
     ^~~~~~~~~~~~~~~~~

/home/molinux/raspi/sysroot/usr/include/pthread.h:236: error: expected initializer before ‘__THROWNL’
       void *__restrict __arg) __THROWNL __nonnull ((1, 3));
                               ^~~~~~~~~

这是stdlib.h文件的一部分:

#ifdef __USE_MISC
#include <alloca.h>
#endif /* Use misc.  */

#if (defined __USE_XOPEN_EXTENDED && !defined __USE_XOPEN2K) \
    || defined __USE_MISC
/* Allocate SIZE bytes on a page boundary.  The storage cannot be freed.  */
extern void *valloc (size_t __size) __THROW __attribute_malloc__ __wur;
#endif

#ifdef __USE_XOPEN2K
/* Allocate memory of SIZE bytes with an alignment of ALIGNMENT.  */
extern int posix_memalign (void **__memptr, size_t __alignment, size_t __size)
     __THROW __nonnull ((1)) __wur;
#endif

#ifdef __USE_ISOC11
/* ISO C variant of aligned allocation.  */
extern void *aligned_alloc (size_t __alignment, size_t __size)
     __THROW __attribute_malloc__ __attribute_alloc_size__ ((2)) __wur;
#endif

__BEGIN_NAMESPACE_STD
/* Abort execution and generate a core-dump.  */
extern void abort (void) __THROW __attribute__ ((__noreturn__));


/* Register a function to be called when `exit' is called.  */
extern int atexit (void (*__func) (void)) __THROW __nonnull ((1));

#if defined __USE_ISOC11 || defined __USE_ISOCXX11
/* Register a function to be called when `quick_exit' is called.  */
# ifdef __cplusplus
extern "C++" int at_quick_exit (void (*__func) (void))
     __THROW __asm ("at_quick_exit") __nonnull ((1));
# else
extern int at_quick_exit (void (*__func) (void)) __THROW __nonnull ((1));
# endif
#endif

这是main.qml:

import QtQuick 2.12
import QtQuick.Window 2.12

Window {
    visible: true
    width: 640
    height: 480
    title: qsTr("Hello World")
}

这是pthread.h的一部分。


/* Create a new thread, starting with execution of START-ROUTINE
   getting passed ARG.  Creation attributed come from ATTR.  The new
   handle is stored in *NEWTHREAD.  */
extern int pthread_create (pthread_t *__restrict __newthread,
               const pthread_attr_t *__restrict __attr,
               void *(*__start_routine) (void *),
               void *__restrict __arg) __THROWNL __nonnull ((1, 3));

/* Terminate calling thread.

   The registered cleanup handlers are called via exception handling
   so we cannot mark this function with __THROW.*/
extern void pthread_exit (void *__retval) __attribute__ ((__noreturn__));

/* Make calling thread wait for termination of the thread TH.  The
   exit status of the thread is stored in *THREAD_RETURN, if THREAD_RETURN
   is not NULL.

   This function is a cancellation point and therefore not marked with
   __THROW.  */
extern int pthread_join (pthread_t __th, void **__thread_return);

0 个答案:

没有答案