Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

linker error #89

Closed
ye-luo opened this issue Mar 31, 2020 · 8 comments
Closed

linker error #89

ye-luo opened this issue Mar 31, 2020 · 8 comments
Assignees

Comments

@ye-luo
Copy link

ye-luo commented Mar 31, 2020

Using 0.7-7.
The AOMP linker works on more complicated miniQMC but failed in linking the following test case.
https://github.com/ye-luo/openmp-target/tree/master/hands-on/tests/link_static_fat_bin

/usr/lib/aomp/bin/clang++ -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx906 -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -c classA.cpp
rm -f mylib.a
ar qc mylib.a classA.o
ranlib mylib.a
/usr/lib/aomp/bin/clang++ -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx906 -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa -c main.cpp
/usr/lib/aomp/bin/clang++ -Xopenmp-target=amdgcn-amd-amdhsa -march=gfx906 -fopenmp -fopenmp-targets=amdgcn-amd-amdhsa main.o ./mylib.a

error

: error loading '/tmp/mylib-gfx906-fd6e48.a': The file was not recognized as a valid object file!: The file was not recognized as a valid object file.
clang-9: error: amdgcn-link command failed with exit code 1 (use -v to see invocation)
@estewart08
Copy link
Contributor

Thanks for reporting this issue. I will look into it and report back.

@gregrodgers
Copy link
Contributor

Jan, this looks like we need to run unbundle-archive utility on any .a on the command line and feed the extracted device-specific archive to the gpu link phase. I hope we can get this in the next release of AOMP 11.5-0.

@ye-luo
Copy link
Author

ye-luo commented Apr 10, 2020

Please also double check if mylib.a is presented twice on the link line, the linking can still succeed.

@gregrodgers
Copy link
Contributor

Ye-luo, this would work if you named the archive libmylib.a and you put the following on the command line -L$PWD -lmylib. aomp support heterogeneous archives using -l and -L. However, we had a small oversight and do not pick up heterogenous archives from the command line. I would rather fix the original problem than have you circumvent this.

@ye-luo
Copy link
Author

ye-luo commented Apr 10, 2020

@gregrodgers Thank you. Fixing the original problem is appreciated. Both use cases are valid.

Please also double check if mylib.a is presented twice on the link line, the linking can still succeed.

This is a actually a separate issue. In another working case, if I present the static library (.a) twice, aomp failed to link with multi definition error.

@jsjodin
Copy link
Contributor

jsjodin commented Apr 24, 2020

The reason this fails and miniQMC works is that the archive file mylib.a file name does not start with "lib", if you name the file "libmylib.a" it works. We can remove this restriction.

@ye-luo
Copy link
Author

ye-luo commented Apr 24, 2020

@jsjodin appreciated if you could remove the restriction.

@ye-luo
Copy link
Author

ye-luo commented Apr 28, 2023

Resolved long time ago.

@ye-luo ye-luo closed this as completed Apr 28, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants