Re: ERROR: could not relocate installing toolchain SDK


Randy MacLeod
 


Add Denis since he may have missed Sundeep's email.

On 2022-02-04 01:52, Sundeep KOKKONDA wrote:
Hello,

I am also facing the same issue with path size. Can you share the workaround what you are using for this issue?

In the scripts/relocate_sdk.py the file name comparison is like below:
if (len(new_dl_path) >= p_filesz):
                print("ERROR: could not relocate %s, interp size = %i and %i is needed." \
                    % (elf_file_name, p_memsz, len(new_dl_path) + 1))
                break
            dl_path = new_dl_path + b("\0") * (p_filesz - len(new_dl_path))
And, to fix the issue I made changes like below.
if (len(new_dl_path) >= 4096):
                print("ERROR: could not relocate %s, interp size = %i and %i is needed." \
                    % (elf_file_name, p_memsz, len(new_dl_path) + 1))
                break
            dl_path = new_dl_path + b("\0") * (4096 - len(new_dl_path))
and commented below code.
#if old_size != os.path.getsize(e):
        #print("New file size for %s is different. Looks like a relocation error!", e)
        #sys.exit(-1)
Do you have any clue regarding,
- Why the installation path is depending of elf headers i.e., Why installation error when the len(new_dl_path) is greater than p_filesz?
- Changing this comparison (len(new_dl_path) >= 4096) will impact the installed SDK?

The 4096 comes from PATH_MAX:

linux/limits.h.
#define PATH_MAX 4096 /* # chars in a path name including nul */

but that does seem a tad on the long side. I'd prefer a more reasonable
limit that we have actually tested, say PATH_MAX/4 (??) and a comment in the
commit log documenting the choice.

Finally, we do have a test that extracts the sdk in:

   meta/lib/oeqa/sdk/testsdk.py

Can you review that code and use a long but fixed length path by
default so that we catch regressions? The path is set in:
        sdk_dir = d.expand("${WORKDIR}/testimage-sdk/")
since len(${WORKDIR} may vary, I'd like to see code that corrects
for that and results in a fix length of PATH_MAX/4 assuming that
things work with such a long path.

Denis? Does that make sense and what is your work-around?

../Randy


 



-- 
# Randy MacLeod
# Wind River Linux

Join yocto@lists.yoctoproject.org to automatically receive all group messages.