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

Link error when building with GFortran and OpenMP #381

Closed
skn123 opened this issue Jun 6, 2014 · 0 comments
Closed

Link error when building with GFortran and OpenMP #381

skn123 opened this issue Jun 6, 2014 · 0 comments

Comments

@skn123
Copy link

skn123 commented Jun 6, 2014

If I use the stock OpenBlas libraries provided in the download page, or build them as it, I get some link errors. This is because GFortran (and if used, OpenIMP) imports are not passed on to the linker. Thus, when I want to use OpenBlas with other libraries, I have to pass the import libraries for GFortran and OpenMP. I tracked the problem and this happens in the "dllimport" line in the Exports folder. I replaced that with my own line using gcc. This removed the problem. I think this should be incorporated into OpenBlas.

gcc.exe -shared -o libopenblas.dll -Wl,--out-implib,libopenblas.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -Wl,--whole-archive ./libopenblas_piledriverp-r0.2.9.rc2.a -Wl,--no-whole-archive -Wl,--allow-multiple-definition -lgfortran -lgomp -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32

In this case, I had built the library with TARGET=PILEDRIVER
I also had to pass -Wl,--allow-multiple-definition as it was complaining of multiple definitions in various .o files. Finally, I also forced the linker to select the static builds of libgfortran.a and libgomp.a instead of their respective imports (i.e., libgfortran.dll.a and libgomp.dll.a) by physically deleting the non-essential files. Is there a cleaner way to do this?

The library now built links with other libraries without any problem (i.e., link errors).

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

2 participants