{
    "mode": "info",
    "parameter": "dpkg-architecture",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/dpkg-architecture/json",
    "generated": "2026-07-07T06:30:04Z",
    "synopsis": "dpkg-architecture [option...] [command]",
    "sections": {
        "NAME": {
            "content": "dpkg-architecture - set and determine the architecture for package\nbuilding\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "dpkg-architecture [option...] [command]\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "dpkg-architecture provides a facility to determine and set the build\nand host architecture for package building.\n\nThe build architecture is always determined by either the\nDEBBUILDARCH variable if set (and --force not being specified) or by\nan external call to dpkg(1), and cannot be set at the command line.\n\nYou can specify the host architecture by providing one or both of the\noptions --host-arch and --host-type, otherwise the DEBHOSTARCH\nvariable is used if set (and --force not being specified). The default\nis 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\n--host-arch and --host-type is sufficient, the value of the other will\nbe set to a usable default. Indeed, it is often better to only specify\none, 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\nVARIABLE=value. This is the default action.\n\n-e, --equal architecture\nCheck for equality of architecture (since dpkg 1.13.13).  It\ncompares the current or specified Debian host architecture against\narchitecture, to check if they are equal.  This action will not\nexpand the architecture wildcards.  Command finishes with an exit\nstatus of 0 if matched, 1 if not matched.\n\n-i, --is architecture-wildcard\nCheck for identity of architecture (since dpkg 1.13.13).  It\ncompares the current or specified Debian host architecture against\narchitecture-wildcard after having expanded it as an architecture\nwildcard, to check if they match.  Command finishes with an exit\nstatus of 0 if matched, 1 if not matched.\n\n-q, --query variable-name\nPrint the value of a single variable.\n",
                    "flag": "-l",
                    "long": "--list"
                },
                {
                    "name": "-s, --print-set",
                    "content": "Print an export command. This can be used to set the environment\nvariables using the POSIX shell or make eval, depending on the\noutput 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\n-c, --command command-string\nExecute a command-string in an environment which has all variables\nset to the determined value.\n",
                    "flag": "-u",
                    "long": "--print-unset"
                },
                {
                    "name": "-L, --list-known",
                    "content": "Print a list of valid architecture names.  Possibly restricted by\none or more of the matching options --match-wildcard, --match-bits\nor --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": "-a, --host-arch architecture\nSet the host Debian architecture.\n\n-t, --host-type gnu-system-type\nSet the host GNU system type.\n\n-A, --target-arch architecture\nSet the target Debian architecture (since dpkg 1.17.14).\n\n-T, --target-type gnu-system-type\nSet the target GNU system type (since dpkg 1.17.14).\n\n-W, --match-wildcard architecture-wildcard\nRestrict the architectures listed by --list-known to ones matching\nthe specified architecture wildcard (since dpkg 1.17.14).\n\n-B, --match-bits architecture-bits\nRestrict the architectures listed by --list-known to ones with the\nspecified CPU bits (since dpkg 1.17.14). Either 32 or 64.\n\n-E, --match-endian architecture-endianness\nRestrict the architectures listed by --list-known to ones with the\nspecified endianness (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\ndpkg 1.20.6), to either shell (default) or make.\n",
            "subsections": [
                {
                    "name": "-f, --force",
                    "content": "Values set by existing environment variables with the same name as\nused by the scripts are honored (i.e. used by dpkg-architecture),\nexcept if this force flag is present. This allows the user to\noverride a value even when the call to dpkg-architecture is buried\nin some 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\ncode for.  This is only needed when building a cross-toolchain (or\nemulator), one that will be built on the build architecture, to be\nrun on the host architecture, and to build (or run emulated) code\nfor the target architecture.\n\nDebian architecture\nThe Debian architecture string, which specifies the binary tree in\nthe FTP archive. Examples: i386, sparc, hurd-i386.\n\nDebian architecture tuple\nA Debian architecture tuple is the fully qualified architecture\nwith all its components spelled out.  This differs with Debian\narchitectures in that at least the cpu component does not embed the\nabi.  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\nthat will match any real architecture being part of it.  The\ngeneral form is a Debian architecture tuple with four or less\nelements, and with at least one of them being any.  Missing\nelements of the tuple are prefixed implicitly as any, and thus the\nfollowing 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-\nany-any.\n\nGNU system type\nAn architecture specification string consisting of two parts\nseparated by a hyphen: cpu and system.  Examples: i586-linux-gnu,\nsparc-linux-gnu, i686-gnu, x8664-netbsd.\n\nmultiarch triplet\nThe clarified GNU system type, used for filesystem paths.  This\ntriplet does not change even when the baseline ISA gets bumped, so\nthat the resulting paths are stable over time.  The only current\ndifference with the GNU system type is that the CPU part for i386\nbased systems is always i386.  Examples: i386-linux-gnu,\nx8664-linux-gnu.  Example paths: /lib/powerpc64le-linux-gnu/,\n/usr/lib/i386-kfreebsd-gnu/.\n",
            "subsections": []
        },
        "VARIABLES": {
            "content": "The following variables are read from the environment (unless --force\nhas been specified) and set by dpkg-architecture (see the TERMS section\nfor 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\n1.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\nfilesystem paths (since dpkg 1.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\n1.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\nfilesystem paths (since dpkg 1.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\n1.17.14).\n\nDEBTARGETARCHENDIAN\nThe endianness of the target machine (little / big; since dpkg\n1.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\nfilesystem paths (since dpkg 1.17.14).\n",
            "subsections": []
        },
        "FILES": {
            "content": "Architecture tables\nAll these files have to be present for dpkg-architecture to work. Their\nlocation can be overridden at runtime with the environment variable\nDPKGDATADIR.  These tables contain a format Version pseudo-field on\ntheir first line to mark their format, so that parsers can check if\nthey 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\nversion 1.0 (since dpkg 1.13.2).\n\n/usr/share/dpkg/ostable\nTable of known operating system names and mapping to their GNU\nname.  Format version 2.0 (since dpkg 1.18.11).\n\n/usr/share/dpkg/tupletable\nMapping between Debian architecture tuples and Debian architecture\nnames.  Format version 1.0 (since dpkg 1.18.11).\n\n/usr/share/dpkg/abitable\nTable of Debian architecture ABI attribute overrides.  Format\nversion 2.0 (since dpkg 1.18.11).\n\nPackaging support\n/usr/share/dpkg/architecture.mk\nMakefile snippet that properly sets and exports all the variables\nthat dpkg-architecture outputs (since dpkg 1.16.1).\n",
            "subsections": []
        },
        "EXAMPLES": {
            "content": "dpkg-buildpackage accepts the -a option and passes it to dpkg-\narchitecture. 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\narchitecture:\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\nUsage in debian/rules\nThe environment variables set by dpkg-architecture are passed to\ndebian/rules as make variables (see make documentation). However, you\nshould not rely on them, as this breaks manual invocation of the\nscript. Instead, you should always initialize them using dpkg-\narchitecture with the -q option. Here are some examples, which also\nshow how you can improve the 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\nDEBHOSTARCHCPU or DEBHOSTARCHOS variables.\n\nNote that you can also rely on an external Makefile snippet to properly\nset all the variables that 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\narchitecture information during a package build.\n",
            "subsections": []
        },
        "ENVIRONMENT": {
            "content": "DPKGDATADIR\nIf set, it will be used as the dpkg data directory, where the\narchitecture tables are located (since dpkg 1.14.17).  Defaults to\n<</usr/share/dpkg>>.\n\nDPKGCOLORS\nSets the color mode (since dpkg 1.18.5).  The currently accepted\nvalues are: auto (default), always and never.\n\nDPKGNLS\nIf set, it will be used to decide whether to activate Native\nLanguage Support, also known as internationalization (or i18n)\nsupport (since dpkg 1.19.0).  The accepted values are: 0 and 1\n(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\n1.21.1                            2025-09-09              dpkg-architecture(1)",
            "subsections": []
        }
    },
    "summary": "dpkg-architecture - set and determine the architecture for package building",
    "flags": [
        {
            "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",
        "Usage in debian/rules",
        "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"
        }
    ]
}