{
    "content": [
        {
            "type": "text",
            "text": "# dpkg-architecture (man)\n\n## NAME\n\ndpkg-architecture - set and determine the architecture for package building\n\n## SYNOPSIS\n\ndpkg-architecture [option...] [command]\n\n## DESCRIPTION\n\ndpkg-architecture provides a facility to determine and set the build and host architecture\nfor package building.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n- **COMMANDS** (9 subsections)\n- **OPTIONS** (9 subsections)\n- **TERMS**\n- **VARIABLES**\n- **FILES** (2 subsections)\n- **EXAMPLES** (1 subsections)\n- **ENVIRONMENT**\n- **NOTES**\n- **SEE ALSO**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "dpkg-architecture",
        "section": "",
        "mode": "man",
        "summary": "dpkg-architecture - set and determine the architecture for package building",
        "synopsis": "dpkg-architecture [option...] [command]",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [
            {
                "flag": "-a",
                "long": "--host-arch",
                "arg": null,
                "description": "Set the host Debian architecture."
            },
            {
                "flag": "-t",
                "long": "--host-type",
                "arg": null,
                "description": "Set the host GNU system type."
            },
            {
                "flag": "-A",
                "long": "--target-arch",
                "arg": null,
                "description": "Set the target Debian architecture (since dpkg 1.17.14)."
            },
            {
                "flag": "-T",
                "long": "--target-type",
                "arg": null,
                "description": "Set the target GNU system type (since dpkg 1.17.14)."
            },
            {
                "flag": "-W",
                "long": "--match-wildcard",
                "arg": null,
                "description": "Restrict the architectures listed by --list-known to ones matching the specified architecture wildcard (since dpkg 1.17.14)."
            },
            {
                "flag": "-B",
                "long": "--match-bits",
                "arg": null,
                "description": "Restrict the architectures listed by --list-known to ones with the specified CPU bits (since dpkg 1.17.14). Either 32 or 64."
            },
            {
                "flag": "-E",
                "long": "--match-endian",
                "arg": null,
                "description": "Restrict the architectures listed by --list-known to ones with the specified endianness (since dpkg 1.17.14). Either little or big. --print-format format Sets the output format for --print-set and --print-unset (since dpkg 1.20.6), to either"
            },
            {
                "flag": "-f",
                "long": "--force",
                "arg": null,
                "description": "Values set by existing environment variables with the same name as used by the scripts are honored (i.e. used by dpkg-architecture), except if this force flag is present. This allows the user to override a value even when the call to dpkg-architecture is buried in some other script (for example dpkg-buildpackage(1))."
            }
        ],
        "examples": [
            "dpkg-buildpackage accepts the -a option and passes it to dpkg-architecture. Other examples:",
            "CC=i386-gnu-gcc dpkg-architecture -c debian/rules build",
            "eval $(dpkg-architecture -u)",
            "Check if the current or specified host architecture is equal to an architecture:",
            "dpkg-architecture -elinux-alpha",
            "dpkg-architecture -amips -elinux-mips",
            "Check if the current or specified host architecture is a Linux system:",
            "dpkg-architecture -ilinux-any",
            "dpkg-architecture -ai386 -ilinux-any",
            "The environment variables set by dpkg-architecture are passed to debian/rules as make",
            "variables (see make documentation). However, you should not rely on them, as this breaks",
            "manual invocation of the script. Instead, you should always initialize them using dpkg-",
            "architecture with the -q option. Here are some examples, which also show how you can improve",
            "the cross compilation support in your package:",
            "Retrieving the GNU system type and forwarding it to ./configure:",
            "DEBBUILDGNUTYPE ?= $(shell dpkg-architecture -qDEBBUILDGNUTYPE)",
            "DEBHOSTGNUTYPE ?= $(shell dpkg-architecture -qDEBHOSTGNUTYPE)",
            "[...]",
            "ifeq ($(DEBBUILDGNUTYPE), $(DEBHOSTGNUTYPE))",
            "confflags += --build=$(DEBHOSTGNUTYPE)",
            "else",
            "confflags += --build=$(DEBBUILDGNUTYPE) \\",
            "--host=$(DEBHOSTGNUTYPE)",
            "endif",
            "[...]",
            "./configure $(confflags)",
            "Doing something only for a specific architecture:",
            "DEBHOSTARCH ?= $(shell dpkg-architecture -qDEBHOSTARCH)",
            "ifeq ($(DEBHOSTARCH),alpha)",
            "[...]",
            "endif",
            "or if you only need to check the CPU or OS type, use the DEBHOSTARCHCPU or",
            "DEBHOSTARCHOS variables.",
            "Note that you can also rely on an external Makefile snippet to properly set all the variables",
            "that dpkg-architecture can provide:",
            "include /usr/share/dpkg/architecture.mk",
            "ifeq ($(DEBHOSTARCH),alpha)",
            "[...]",
            "endif",
            "In any case, you should never use dpkg --print-architecture to get architecture information",
            "during a package build."
        ],
        "see_also": [
            {
                "name": "dpkg-buildpackage",
                "section": "1",
                "url": "https://www.chedong.com/phpMan.php/man/dpkg-buildpackage/1/json"
            }
        ],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 15,
                "subsections": []
            },
            {
                "name": "COMMANDS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-l --list",
                        "lines": 3,
                        "flag": "-l",
                        "long": "--list"
                    },
                    {
                        "name": "-e --equal",
                        "lines": 5,
                        "flag": "-e",
                        "long": "--equal"
                    },
                    {
                        "name": "-i --is",
                        "lines": 5,
                        "flag": "-i",
                        "long": "--is"
                    },
                    {
                        "name": "-q --query",
                        "lines": 2,
                        "flag": "-q",
                        "long": "--query"
                    },
                    {
                        "name": "-s --print-set",
                        "lines": 3,
                        "flag": "-s",
                        "long": "--print-set"
                    },
                    {
                        "name": "-u --print-unset",
                        "lines": 2,
                        "flag": "-u",
                        "long": "--print-unset"
                    },
                    {
                        "name": "-c --command",
                        "lines": 3,
                        "flag": "-c",
                        "long": "--command"
                    },
                    {
                        "name": "-L --list-known",
                        "lines": 6,
                        "flag": "-L",
                        "long": "--list-known"
                    },
                    {
                        "name": "--version",
                        "lines": 2,
                        "long": "--version"
                    }
                ]
            },
            {
                "name": "OPTIONS",
                "lines": 1,
                "subsections": [
                    {
                        "name": "-a --host-arch",
                        "lines": 2,
                        "flag": "-a",
                        "long": "--host-arch"
                    },
                    {
                        "name": "-t --host-type",
                        "lines": 2,
                        "flag": "-t",
                        "long": "--host-type"
                    },
                    {
                        "name": "-A --target-arch",
                        "lines": 2,
                        "flag": "-A",
                        "long": "--target-arch"
                    },
                    {
                        "name": "-T --target-type",
                        "lines": 2,
                        "flag": "-T",
                        "long": "--target-type"
                    },
                    {
                        "name": "-W --match-wildcard",
                        "lines": 3,
                        "flag": "-W",
                        "long": "--match-wildcard"
                    },
                    {
                        "name": "-B --match-bits",
                        "lines": 3,
                        "flag": "-B",
                        "long": "--match-bits"
                    },
                    {
                        "name": "-E --match-endian",
                        "lines": 5,
                        "flag": "-E",
                        "long": "--match-endian"
                    },
                    {
                        "name": "shell (default)",
                        "lines": 1
                    },
                    {
                        "name": "-f --force",
                        "lines": 5,
                        "flag": "-f",
                        "long": "--force"
                    }
                ]
            },
            {
                "name": "TERMS",
                "lines": 45,
                "subsections": []
            },
            {
                "name": "VARIABLES",
                "lines": 105,
                "subsections": []
            },
            {
                "name": "FILES",
                "lines": 1,
                "subsections": [
                    {
                        "name": "Architecture tables",
                        "lines": 21
                    },
                    {
                        "name": "Packaging support",
                        "lines": 4
                    }
                ]
            },
            {
                "name": "EXAMPLES",
                "lines": 18,
                "subsections": [
                    {
                        "name": "Usage in debian/rules",
                        "lines": 43
                    }
                ]
            },
            {
                "name": "ENVIRONMENT",
                "lines": 13,
                "subsections": []
            },
            {
                "name": "NOTES",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SEE ALSO",
                "lines": 5,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "dpkg-architecture - set and determine the architecture for package building\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "dpkg-architecture [option...] [command]\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "dpkg-architecture provides a facility to determine and set the build and host architecture\nfor package building.\n\nThe build architecture is always determined by either the DEBBUILDARCH variable if set (and\n--force not being specified) or by an external call to dpkg(1), and cannot be set at the\ncommand line.\n\nYou can specify the host architecture by providing one or both of the options --host-arch and\n--host-type, otherwise the DEBHOSTARCH variable is used if set (and --force not being\nspecified). The default is determined by an external call to gcc(1), or the same as the build\narchitecture if CC or gcc are both not available. One out of --host-arch and --host-type is\nsufficient, the value of the other will be set to a usable default. Indeed, it is often\nbetter to only specify one, because dpkg-architecture will warn you if your choice does not\nmatch the default.\n",
                "subsections": []
            },
            "COMMANDS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-l --list",
                        "content": "Print the environment variables, one each line, in the format VARIABLE=value. This is the\ndefault action.\n",
                        "flag": "-l",
                        "long": "--list"
                    },
                    {
                        "name": "-e --equal",
                        "content": "Check for equality of architecture (since dpkg 1.13.13).  It compares the current or\nspecified Debian host architecture against architecture, to check if they are equal.\nThis action will not expand the architecture wildcards.  Command finishes with an exit\nstatus of 0 if matched, 1 if not matched.\n",
                        "flag": "-e",
                        "long": "--equal"
                    },
                    {
                        "name": "-i --is",
                        "content": "Check for identity of architecture (since dpkg 1.13.13).  It compares the current or\nspecified Debian host architecture against architecture-wildcard after having expanded it\nas an architecture wildcard, to check if they match.  Command finishes with an exit\nstatus of 0 if matched, 1 if not matched.\n",
                        "flag": "-i",
                        "long": "--is"
                    },
                    {
                        "name": "-q --query",
                        "content": "Print the value of a single variable.\n",
                        "flag": "-q",
                        "long": "--query"
                    },
                    {
                        "name": "-s --print-set",
                        "content": "Print an export command. This can be used to set the environment variables using the\nPOSIX shell or make eval, depending on the output format.\n",
                        "flag": "-s",
                        "long": "--print-set"
                    },
                    {
                        "name": "-u --print-unset",
                        "content": "Print a similar command to --print-set but to unset all variables.\n",
                        "flag": "-u",
                        "long": "--print-unset"
                    },
                    {
                        "name": "-c --command",
                        "content": "Execute a command-string in an environment which has all variables set to the determined\nvalue.\n",
                        "flag": "-c",
                        "long": "--command"
                    },
                    {
                        "name": "-L --list-known",
                        "content": "Print a list of valid architecture names.  Possibly restricted by one or more of the\nmatching options --match-wildcard, --match-bits or --match-endian (since dpkg 1.17.14).\n\n-?, --help\nShow the usage message and exit.\n",
                        "flag": "-L",
                        "long": "--list-known"
                    },
                    {
                        "name": "--version",
                        "content": "Show the version and exit.\n",
                        "long": "--version"
                    }
                ]
            },
            "OPTIONS": {
                "content": "",
                "subsections": [
                    {
                        "name": "-a --host-arch",
                        "content": "Set the host Debian architecture.\n",
                        "flag": "-a",
                        "long": "--host-arch"
                    },
                    {
                        "name": "-t --host-type",
                        "content": "Set the host GNU system type.\n",
                        "flag": "-t",
                        "long": "--host-type"
                    },
                    {
                        "name": "-A --target-arch",
                        "content": "Set the target Debian architecture (since dpkg 1.17.14).\n",
                        "flag": "-A",
                        "long": "--target-arch"
                    },
                    {
                        "name": "-T --target-type",
                        "content": "Set the target GNU system type (since dpkg 1.17.14).\n",
                        "flag": "-T",
                        "long": "--target-type"
                    },
                    {
                        "name": "-W --match-wildcard",
                        "content": "Restrict the architectures listed by --list-known to ones matching the specified\narchitecture wildcard (since dpkg 1.17.14).\n",
                        "flag": "-W",
                        "long": "--match-wildcard"
                    },
                    {
                        "name": "-B --match-bits",
                        "content": "Restrict the architectures listed by --list-known to ones with the specified CPU bits\n(since dpkg 1.17.14). Either 32 or 64.\n",
                        "flag": "-B",
                        "long": "--match-bits"
                    },
                    {
                        "name": "-E --match-endian",
                        "content": "Restrict the architectures listed by --list-known to ones with the specified endianness\n(since dpkg 1.17.14). Either little or big.\n\n--print-format format\nSets the output format for --print-set and --print-unset (since dpkg 1.20.6), to either",
                        "flag": "-E",
                        "long": "--match-endian"
                    },
                    {
                        "name": "shell (default)",
                        "content": ""
                    },
                    {
                        "name": "-f --force",
                        "content": "Values set by existing environment variables with the same name as used by the scripts\nare honored (i.e. used by dpkg-architecture), except if this force flag is present. This\nallows the user to override a value even when the call to dpkg-architecture is buried in\nsome other script (for example dpkg-buildpackage(1)).\n",
                        "flag": "-f",
                        "long": "--force"
                    }
                ]
            },
            "TERMS": {
                "content": "build machine\nThe machine the package is built on.\n\nhost machine\nThe machine the package is built for.\n\ntarget machine\nThe machine the compiler is building for, or the emulator will run code for.  This is\nonly needed when building a cross-toolchain (or emulator), one that will be built on the\nbuild architecture, to be run on the host architecture, and to build (or run emulated)\ncode for the target architecture.\n\nDebian architecture\nThe Debian architecture string, which specifies the binary tree in the FTP archive.\nExamples: i386, sparc, hurd-i386.\n\nDebian architecture tuple\nA Debian architecture tuple is the fully qualified architecture with all its components\nspelled out.  This differs with Debian architectures in that at least the cpu component\ndoes not embed the abi.  The current tuple has the form abi-libc-os-cpu.  Examples:\nbase-gnu-linux-amd64, eabihf-musl-linux-arm.\n\nDebian architecture wildcard\nA Debian architecture wildcard is a special architecture string that will match any real\narchitecture being part of it.  The general form is a Debian architecture tuple with four\nor less elements, and with at least one of them being any.  Missing elements of the tuple\nare prefixed implicitly as any, and thus the following pairs are equivalent:\n\nany-any-any-any = any\nany-any-os-any = os-any\nany-libc-any-any = libc-any-any\n\nExamples: linux-any, any-i386, hurd-any, eabi-any-any-arm, musl-any-any.\n\nGNU system type\nAn architecture specification string consisting of two parts separated by a hyphen: cpu\nand system.  Examples: i586-linux-gnu, sparc-linux-gnu, i686-gnu, x8664-netbsd.\n\nmultiarch triplet\nThe clarified GNU system type, used for filesystem paths.  This triplet does not change\neven when the baseline ISA gets bumped, so that the resulting paths are stable over time.\nThe only current difference with the GNU system type is that the CPU part for i386 based\nsystems is always i386.  Examples: i386-linux-gnu, x8664-linux-gnu.  Example paths:\n/lib/powerpc64le-linux-gnu/, /usr/lib/i386-kfreebsd-gnu/.\n",
                "subsections": []
            },
            "VARIABLES": {
                "content": "The following variables are read from the environment (unless --force has been specified) and\nset by dpkg-architecture (see the TERMS section for a description of the naming scheme):\n\nDEBBUILDARCH\nThe Debian architecture of the build machine.\n\nDEBBUILDARCHABI\nThe Debian ABI name of the build machine (since dpkg 1.18.11).\n\nDEBBUILDARCHLIBC\nThe Debian libc name of the build machine (since dpkg 1.18.11).\n\nDEBBUILDARCHOS\nThe Debian system name of the build machine (since dpkg 1.13.2).\n\nDEBBUILDARCHCPU\nThe Debian CPU name of the build machine (since dpkg 1.13.2).\n\nDEBBUILDARCHBITS\nThe pointer size of the build machine (in bits; since dpkg 1.15.4).\n\nDEBBUILDARCHENDIAN\nThe endianness of the build machine (little / big; since dpkg 1.15.4).\n\nDEBBUILDGNUCPU\nThe GNU CPU part of DEBBUILDGNUTYPE.\n\nDEBBUILDGNUSYSTEM\nThe GNU system part of DEBBUILDGNUTYPE.\n\nDEBBUILDGNUTYPE\nThe GNU system type of the build machine.\n\nDEBBUILDMULTIARCH\nThe clarified GNU system type of the build machine, used for filesystem paths (since dpkg\n1.16.0).\n\nDEBHOSTARCH\nThe Debian architecture of the host machine.\n\nDEBHOSTARCHABI\nThe Debian ABI name of the host machine (since dpkg 1.18.11).\n\nDEBHOSTARCHLIBC\nThe Debian libc name of the host machine (since dpkg 1.18.11).\n\nDEBHOSTARCHOS\nThe Debian system name of the host machine (since dpkg 1.13.2).\n\nDEBHOSTARCHCPU\nThe Debian CPU name of the host machine (since dpkg 1.13.2).\n\nDEBHOSTARCHBITS\nThe pointer size of the host machine (in bits; since dpkg 1.15.4).\n\nDEBHOSTARCHENDIAN\nThe endianness of the host machine (little / big; since dpkg 1.15.4).\n\nDEBHOSTGNUCPU\nThe GNU CPU part of DEBHOSTGNUTYPE.\n\nDEBHOSTGNUSYSTEM\nThe GNU system part of DEBHOSTGNUTYPE.\n\nDEBHOSTGNUTYPE\nThe GNU system type of the host machine.\n\nDEBHOSTMULTIARCH\nThe clarified GNU system type of the host machine, used for filesystem paths (since dpkg\n1.16.0).\n\nDEBTARGETARCH\nThe Debian architecture of the target machine (since dpkg 1.17.14).\n\nDEBTARGETARCHABI\nThe Debian ABI name of the target machine (since dpkg 1.18.11).\n\nDEBTARGETARCHLIBC\nThe Debian libc name of the target machine (since dpkg 1.18.11).\n\nDEBTARGETARCHOS\nThe Debian system name of the target machine (since dpkg 1.17.14).\n\nDEBTARGETARCHCPU\nThe Debian CPU name of the target machine (since dpkg 1.17.14).\n\nDEBTARGETARCHBITS\nThe pointer size of the target machine (in bits; since dpkg 1.17.14).\n\nDEBTARGETARCHENDIAN\nThe endianness of the target machine (little / big; since dpkg 1.17.14).\n\nDEBTARGETGNUCPU\nThe GNU CPU part of DEBTARGETGNUTYPE (since dpkg 1.17.14).\n\nDEBTARGETGNUSYSTEM\nThe GNU system part of DEBTARGETGNUTYPE (since dpkg 1.17.14).\n\nDEBTARGETGNUTYPE\nThe GNU system type of the target machine (since dpkg 1.17.14).\n\nDEBTARGETMULTIARCH\nThe clarified GNU system type of the target machine, used for filesystem paths (since\ndpkg 1.17.14).\n",
                "subsections": []
            },
            "FILES": {
                "content": "",
                "subsections": [
                    {
                        "name": "Architecture tables",
                        "content": "All these files have to be present for dpkg-architecture to work. Their location can be\noverridden at runtime with the environment variable DPKGDATADIR.  These tables contain a\nformat Version pseudo-field on their first line to mark their format, so that parsers can\ncheck if they understand it, such as \"# Version=1.0\".\n\n/usr/share/dpkg/cputable\nTable of known CPU names and mapping to their GNU name.  Format version 1.0 (since dpkg\n1.13.2).\n\n/usr/share/dpkg/ostable\nTable of known operating system names and mapping to their GNU name.  Format version 2.0\n(since dpkg 1.18.11).\n\n/usr/share/dpkg/tupletable\nMapping between Debian architecture tuples and Debian architecture names.  Format version\n1.0 (since dpkg 1.18.11).\n\n/usr/share/dpkg/abitable\nTable of Debian architecture ABI attribute overrides.  Format version 2.0 (since dpkg\n1.18.11).\n"
                    },
                    {
                        "name": "Packaging support",
                        "content": "/usr/share/dpkg/architecture.mk\nMakefile snippet that properly sets and exports all the variables that dpkg-architecture\noutputs (since dpkg 1.16.1).\n"
                    }
                ]
            },
            "EXAMPLES": {
                "content": "dpkg-buildpackage accepts the -a option and passes it to dpkg-architecture. Other examples:\n\nCC=i386-gnu-gcc dpkg-architecture -c debian/rules build\n\neval $(dpkg-architecture -u)\n\nCheck if the current or specified host architecture is equal to an architecture:\n\ndpkg-architecture -elinux-alpha\n\ndpkg-architecture -amips -elinux-mips\n\nCheck if the current or specified host architecture is a Linux system:\n\ndpkg-architecture -ilinux-any\n\ndpkg-architecture -ai386 -ilinux-any\n",
                "subsections": [
                    {
                        "name": "Usage in debian/rules",
                        "content": "The environment variables set by dpkg-architecture are passed to debian/rules as make\nvariables (see make documentation). However, you should not rely on them, as this breaks\nmanual invocation of the script. Instead, you should always initialize them using dpkg-\narchitecture with the -q option. Here are some examples, which also show how you can improve\nthe cross compilation support in your package:\n\nRetrieving the GNU system type and forwarding it to ./configure:\n\nDEBBUILDGNUTYPE ?= $(shell dpkg-architecture -qDEBBUILDGNUTYPE)\nDEBHOSTGNUTYPE ?= $(shell dpkg-architecture -qDEBHOSTGNUTYPE)\n[...]\nifeq ($(DEBBUILDGNUTYPE), $(DEBHOSTGNUTYPE))\nconfflags += --build=$(DEBHOSTGNUTYPE)\nelse\nconfflags += --build=$(DEBBUILDGNUTYPE) \\\n--host=$(DEBHOSTGNUTYPE)\nendif\n[...]\n./configure $(confflags)\n\nDoing something only for a specific architecture:\n\nDEBHOSTARCH ?= $(shell dpkg-architecture -qDEBHOSTARCH)\n\nifeq ($(DEBHOSTARCH),alpha)\n[...]\nendif\n\nor if you only need to check the CPU or OS type, use the DEBHOSTARCHCPU or\nDEBHOSTARCHOS variables.\n\nNote that you can also rely on an external Makefile snippet to properly set all the variables\nthat dpkg-architecture can provide:\n\ninclude /usr/share/dpkg/architecture.mk\n\nifeq ($(DEBHOSTARCH),alpha)\n[...]\nendif\n\nIn any case, you should never use dpkg --print-architecture to get architecture information\nduring a package build.\n"
                    }
                ]
            },
            "ENVIRONMENT": {
                "content": "DPKGDATADIR\nIf set, it will be used as the dpkg data directory, where the architecture tables are\nlocated (since dpkg 1.14.17).  Defaults to «/usr/share/dpkg».\n\nDPKGCOLORS\nSets the color mode (since dpkg 1.18.5).  The currently accepted values are: auto\n(default), always and never.\n\nDPKGNLS\nIf set, it will be used to decide whether to activate Native Language Support, also known\nas internationalization (or i18n) support (since dpkg 1.19.0).  The accepted values are:\n0 and 1 (default).\n",
                "subsections": []
            },
            "NOTES": {
                "content": "All long command and option names available only since dpkg 1.17.17.\n",
                "subsections": []
            },
            "SEE ALSO": {
                "content": "dpkg-buildpackage(1).\n\n\n\n1.21.1                                       2025-09-09                         dpkg-architecture(1)",
                "subsections": []
            }
        }
    }
}