tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: cross-compiling packages




> On Nov 4, 2020, at 9:22 PM, Brook Milligan <brook%nmsu.edu@localhost> wrote:
> 
> Building other packages yields the following:
> 
> ERROR: [depends.mk] Installed package digest-20190127 has an
> ERROR:     object format ``ELF'' which differs from ``a.out''.  Please
> ERROR:     update the digest-20190127 package to a.out.
> *** Error code 1

These errors are coming from pkgsrc/mk/pkgformat/pkg/depends.mk (see below for the relevant part).  The value of ${objfmt} is "ELF", whereas the value of ${OBJECT_FMT} is "a.out".  Thus, the last case branches to *) instead of ${OBJECT_FMT).  

This raises the question, why is ${OBJECT_FMT} equal to "a.out"; both the build and target machines use ELF.

I am having a difficult time unwinding the *.mk files to determine where ${OBJECT_FMT} is even set, but it is clearly being set incorrectly.  I'm guessing it works for at least some other values of ${MACHINE_ARCH}, but not for "mips64" (for me).  Is that not the correct value?  Is there a case missing somewhere so ${OBJECT_FMT} remains in some ancient default setting of "a.out"?

I hope this will trigger some memories that will point toward solutions.

Thanks for any help.

Cheers,
Brook


pkgsrc/mk/pkgformat/pkg/depends.mk (in part):

# _DEPENDS_INSTALL_CMD checks whether the package $pattern is installed,                                                                                                                                   
#       and installs it if necessary.                                                                                                                                                                       
#                                                                                                                                                                                                           
#       @param $pattern The pattern of the package to be installed.                                                                                                                                         
#       @param $dir The pkgsrc directory from which the package can be                                                                                                                                     
#               built.                                                                                                                                                                                     
#       @param $type The dependency type. Can be one of bootstrap, tool,                                                                                                                                   
#               build, test, full.                                                                                                                                                                         
#                                                                                                                                                                                                           
_DEPENDS_INSTALL_CMD=                                                   \
        case $$type in                                                  \
        bootstrap)      Type=Bootstrap;;                                \
        tool)           Type=Tool;;                                     \
        build)          Type=Build;;                                    \
        test)           Type=Test;;                                     \
        full)           Type=Full;;                                     \
        esac;                                                           \
        case $$type in                                                  \
        bootstrap|tool)                                                 \
                if expr "${USE_CROSS_COMPILE:Uno}" : '[yY][eE][sS]' >/dev/null; then \
                        extradep="";                                    \
                else                                                    \
                        extradep=" ${PKGNAME}";                         \
                fi;                                                     \
                cross=no;                                               \
                archopt=TARGET_ARCH=${MACHINE_ARCH};                    \
                pkg=`${_HOST_PKG_BEST_EXISTS} "$$pattern" || ${TRUE}`;  \
                ;;                                                      \
        build|test|full)                                                        \
                extradep=" ${PKGNAME}";                                 \
                cross=${USE_CROSS_COMPILE:Uno};                         \
                archopt=;                                               \
                pkg=`${_PKG_BEST_EXISTS} "$$pattern" || ${TRUE}`;       \
                ;;                                                      \
        esac;                                                           \
        case "$$pkg" in                                                 \
        "")                                                             \
                ${STEP_MSG} "$$Type dependency $$pattern: NOT found";   \
                target=${DEPENDS_TARGET:Q};                             \
                ${STEP_MSG} "Verifying $$target for $$dir";             \
                [ -d "$$dir" ] || ${FAIL_MSG} "[depends.mk] The directory \`\`$$dir'' does not exist."; \
                cd $$dir;                                               \
                ${PKGSRC_SETENV} ${PKGSRC_MAKE_ENV}                     \
                        _PKGSRC_DEPS="$$extradep${_PKGSRC_DEPS}"        \
                        PKGNAME_REQD="$$pattern"                        \
                        USE_CROSS_COMPILE=$$cross                       \
                        $$archopt                                       \
                    ${MAKE} ${MAKEFLAGS} _AUTOMATIC=yes $$target;       \
                case $$type in                                          \
                bootstrap|tool)                                         \
                        pkg=`${_HOST_PKG_BEST_EXISTS} "$$pattern" || ${TRUE}`;; \
                build|test|full)                                        \
                        pkg=`${_PKG_BEST_EXISTS} "$$pattern" || ${TRUE}`;; \
                esac;                                                   \
                case "$$pkg" in                                         \
                "")     ${ERROR_MSG} "[depends.mk] A package matching \`\`$$pattern'' should"; \
                        ${ERROR_MSG} "    be installed, but one cannot be found.  Perhaps there is a"; \
                        ${ERROR_MSG} "    stale work directory for $$dir?"; \
                        exit 1;                                         \
                esac;                                                   \
                ${STEP_MSG} "Returning to build of ${PKGNAME}";         \
                ;;                                                      \
        *)                                                              \
                case $$type in                                          \
                bootstrap|tool)                                         \
                        objfmt=`${HOST_PKG_INFO} -Q OBJECT_FMT "$$pkg"`;; \
                build|test|full)                                        \
                        objfmt=`${PKG_INFO} -Q OBJECT_FMT "$$pkg"`;;    \
                esac;                                                   \
                case "$$objfmt" in                                      \
                "")     ${WARNING_MSG} "[depends.mk] Unknown object format for installed package $$pkg" ;; \
                ${OBJECT_FMT})  ;;                                      \
                *)      ${ERROR_MSG} "[depends.mk] Installed package $$pkg has an"; \
                        ${ERROR_MSG} "    object format \`\`$$objfmt'' which differs from \`\`${OBJECT_FMT}''.  Please"; \
                        ${ERROR_MSG} "    update the $$pkg package to ${OBJECT_FMT}."; \
                        exit 1;                                         \
                        ;;                                              \
                esac;                                                   \
                silent=${_BOOTSTRAP_VERBOSE:Dyes};                      \
                if ${TEST} -z "$${silent}"; then                        \
                        ${STEP_MSG} "$$Type dependency $$pattern: found $$pkg"; \
                fi;                                                     \
                ;;                                                      \
        esac





Home | Main Index | Thread Index | Old Index