Skip to content

fix build: avoid __ASSEMBLY__ as it's used in linux/types.h - #850

Open
ocxtal wants to merge 1 commit into
chhylp123:masterfrom
ocxtal:avoid-collision-of-ifdef-labels
Open

fix build: avoid __ASSEMBLY__ as it's used in linux/types.h#850
ocxtal wants to merge 1 commit into
chhylp123:masterfrom
ocxtal:avoid-collision-of-ifdef-labels

Conversation

@ocxtal

@ocxtal ocxtal commented Jul 1, 2025

Copy link
Copy Markdown

I'm using archlinux (x86_64) and encountered build failure.

System:

% uname -a
Linux azalea 6.12.8-arch1-1 #1 SMP PREEMPT_DYNAMIC Thu, 02 Jan 2025 22:52:26 +0000 x86_64 GNU/Linux
% gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-pc-linux-gnu/15.1.1/lto-wrapper
Target: x86_64-pc-linux-gnu
Configured with: /build/gcc/src/gcc/configure --enable-languages=ada,c,c++,d,fortran,go,lto,m2,objc,obj-c++,rust,cobol --enable-bootstrap --prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib --mandir=/usr/share/man --infodir=/usr/share/info --with-bugurl=https://gitlab.archlinux.org/archlinux/packaging/packages/gcc/-/issues --with-build-config=bootstrap-lto --with-linker-hash-style=gnu --with-system-zlib --enable-__cxa_atexit --enable-cet=auto --enable-checking=release --enable-clocale=gnu --enable-default-pie --enable-default-ssp --enable-gnu-indirect-function --enable-gnu-unique-object --enable-libstdcxx-backtrace --enable-link-serialization=1 --enable-linker-build-id --enable-lto --enable-multilib --enable-plugin --enable-shared --enable-threads=posix --disable-libssp --disable-libstdcxx-pch --disable-werror
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 15.1.1 20250425 (GCC)
% 

Build log:

% make
g++ -c -g -O3 -msse4.2 -mpopcnt -fomit-frame-pointer -Wall   Assembly.cpp -o Assembly.o
In file included from /usr/include/bits/sched.h:63,
                 from /usr/include/sched.h:43,
                 from /usr/include/pthread.h:22,
                 from CommandLines.h:5,
                 from Assembly.h:3,
                 from Assembly.cpp:5:
/usr/include/linux/sched/types.h:99:9: error: ‘__u32’ does not name a type
   99 |         __u32 size;
      |         ^~~~~
/usr/include/linux/sched/types.h:101:9: error: ‘__u32’ does not name a type
  101 |         __u32 sched_policy;
      |         ^~~~~
/usr/include/linux/sched/types.h:102:9: error: ‘__u64’ does not name a type
  102 |         __u64 sched_flags;
      |         ^~~~~
/usr/include/linux/sched/types.h:105:9: error: ‘__s32’ does not name a type
  105 |         __s32 sched_nice;
      |         ^~~~~
/usr/include/linux/sched/types.h:108:9: error: ‘__u32’ does not name a type
  108 |         __u32 sched_priority;
      |         ^~~~~
/usr/include/linux/sched/types.h:111:9: error: ‘__u64’ does not name a type
  111 |         __u64 sched_runtime;
      |         ^~~~~
/usr/include/linux/sched/types.h:112:9: error: ‘__u64’ does not name a type
  112 |         __u64 sched_deadline;
      |         ^~~~~
/usr/include/linux/sched/types.h:113:9: error: ‘__u64’ does not name a type
  113 |         __u64 sched_period;
      |         ^~~~~
/usr/include/linux/sched/types.h:116:9: error: ‘__u32’ does not name a type
  116 |         __u32 sched_util_min;
      |         ^~~~~
/usr/include/linux/sched/types.h:117:9: error: ‘__u32’ does not name a type
  117 |         __u32 sched_util_max;
      |         ^~~~~
make: *** [Makefile:23: Assembly.o] Error 1
% head /usr/include/linux/sched/types.h
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _LINUX_SCHED_TYPES_H
#define _LINUX_SCHED_TYPES_H

#include <linux/types.h>

#define SCHED_ATTR_SIZE_VER0    48      /* sizeof first published struct */
#define SCHED_ATTR_SIZE_VER1    56      /* add: util_{min,max} */

/*
% head /usr/include/linux/types.h
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
#ifndef _LINUX_TYPES_H
#define _LINUX_TYPES_H

#include <asm/types.h>

#ifndef __ASSEMBLY__

#include <linux/posix_types.h>

% 

The __ASSEMBLY__ label used for include guard in Assembly.h, is also used in a linux header /usr/include/linux/types.h, and caused this build failure.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant