| Summary: | Host python3 fails to run after relocate-sdk.sh | ||
|---|---|---|---|
| Product: | buildroot | Reporter: | Dennis Peeten <dennis.peeten> |
| Component: | Other | Assignee: | unassigned |
| Status: | RESOLVED MOVED | ||
| Severity: | normal | CC: | buildroot, yann.morin.1998 |
| Priority: | P5 | ||
| Version: | 2021.02.3 | ||
| Target Milestone: | --- | ||
| Hardware: | All | ||
| OS: | Linux | ||
| Host: | Target: | ||
| Build: | |||
Thank you for your report.
The issue tracker for the Buildroot project has been moved to
the Gitlab.com issue tracker:
https://gitlab.com/buildroot.org/buildroot/-/issues
We are taking this opportunity to close old issues in this old
tracker. If you believe your issue is still relevant, please
open one in the new issue tracker.
Thank you!
|
The host python3 fails to start after relocating an SDK. Reproduce: Build an sdk with BR2_PACKAGE_HOST_PYTHON3=y Untar the sdk to some location ${RELOCATED_SDK}. Relocate the sdk by running ${RELOCATED_SDK}/relocate-sdk.sh Run ${RELOCATED_SDK}/bin/python3 Result: python fails to start, spewing confusing error messages. Expected: python starts with an interactive prompt. Note: running python3 from the build dir and running python3 from the relocated sdk dir WITHOUT running the relocate-sdk.sh script does result in the expected behaviour. The problem is that the relocate-sdk.sh script also substitutes paths in the .pyc byte code files, after which they become corrupted. The relocate-sdk.sh script converts files who's MIME type starts with 'text/'. The `file` utility on my machine (Debian 11) reports the MIME type of .pyc files to be 'text/x-bytecode.python'. I'm not sure what the best solution is. But for now I've just changed the relocate script on my end: diff --git a/support/misc/relocate-sdk.sh b/support/misc/relocate-sdk.sh index caabeaa6f6..8d381c41c3 100755 --- a/support/misc/relocate-sdk.sh +++ b/support/misc/relocate-sdk.sh @@ -36,7 +36,9 @@ echo "Relocating the buildroot SDK from ${OLDPATH} to ${NEWPATH} ..." export LC_ALL=C # Replace the old path with the new one in all text files grep -lr "${OLDPATH}" . | while read -r FILE ; do - if file -b --mime-type "${FILE}" | grep -q '^text/' && [ "${FILE}" != "${LOCFILE}" ] + MIME="$(file -b --mime-type "${FILE}")" + if echo ${MIME} | grep -q '^text/' && [ "${FILE}" != "${LOCFILE}" ] && + ! ( echo ${MIME} | grep -q '^text/x-bytecode' ) then sed -i "s|${OLDPATH}|${NEWPATH}|g" "${FILE}" fi Kind regards, Dennis Peeten.