-
Notifications
You must be signed in to change notification settings - Fork 16
MRG: Refactor build_openblas script #82
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
Conversation
Just to say, that I can run the 64-bit build in the following way. I have a script export LDFLAGS="-lucrt -static -static-libgcc"
export OPENBLAS_COMMIT="bfd9c1b58cd3"
bash tools/build_openblas.sh "c:\\opt" 64 32 I can then run the whole build with: cd openblas-libs
c:\rtools40\ucrt64.exe c:\tmp\do_build.sh
EDIT - fixed - see below. |
Ah - I think the right incantation is (for example): $env:LDFLAGS = "-lucrt -static -static-libgcc"
$env:OPENBLAS_COMMIT = "bfd9c1b58cd3"
$env:CHERE_INVOKING = 'yes' # Preserve the current working directory
$env:MSYSTEM = 'UCRT64' # Start a 64 bit UCRT environment
$env:OPENBLAS_ROOT = 'c:\opt'
$env:BUILD_BITS = "64"
& C:\rtools40\usr\bin\bash -lc tools/build_openblas.sh |
I'm curious as to why the staging repo says the the labels are non-standard and doesn't show the openblas libs along with the other projects. |
@charris - is the stuff from the staging repo to do with this PR? I haven't changed the non-Windows build, and CI is failing as yet on Windows - I'm working on that. |
No, I just wanted you to be aware. It seems recent, there didn't used to be that warning. |
0a12ad2
to
eab821d
Compare
@mattip @carlkl - I've refactored now so the builds work, but the dynamic library test is now failing. You can't see the failure in the Github Actions logs, but I believe the failure is due to the following error that I do see on my local newly installed Windows 10 machine: $ C:\rtools40\usr\bin\bash -lc ./test_dyn.exe
C:/repos/openblas-libs/test_dyn.exe: error while loading shared libraries: api-ms-win-crt-filesystem-l1-1-0.dll: cannot open shared object file: No such file or directory Do you have any insight as to why the dynamic build would fail in this way? Anything I can do to debug? |
similar to: facebook/watchman#627 |
@carlkl - I can't find I also searched in a previous recent updated Windows install, and didn't find that DLL. @mstorsjo - sorry to ping you here - but does MingW-w64 UCRT64 expect this file to be on all Windows systems? Or have we made some error in compilation, to trigger this requirement? |
If you're running on Windows Vista/7/8 and haven't installed the UCRT redistributable package, you won't have this DLL and applications built with UCRT won't run. If you're running on Vista/7/8 and have got the UCRT redistributable package installed, then you should have this DLL, and applications should run successfully. If you're running on Windows 10/11, then this DLL actually is a system-built in API set DLL, and I think you might not actually find a physical DLL on disk with this file name, but executables that link against it still should run successfully. In the case of this DLL, it should redirect to ucrtbase.dll (which should exist on disk). Windows has got a bunch of such API set DLLs, see e.g. https://docs.microsoft.com/en-us/windows/win32/apiindex/api-set-loader-operation for more information on them. |
Ok, so this was the actual culprit here that I was supposed to comment on... The issue actually is that |
I tested the artifacts locally without error. (Windows 10). |
artfacts: https://my.hidrive.com/share/5fn9a7aevd (send from @matthew-brett) |
@mstorso - thanks - that's very helpful. @carlkl - when I test locally I get a silent error from
I believe we should be getting the same output from both |
Which in turn is probably due to:
I wonder whether this was always happening in our CI, it's just that we had not previously detected the error. |
7cba3d5
to
7568081
Compare
Thanks everyone - this is now ready for review. See edited introductory comment for a summary. |
For unrelated test failure - see OpenMathLib/OpenBLAS#3659 |
This looks like very nice progress, thanks @matthew-brett & all. A short summary to make sure I understand the impact:
|
Unless I got very confused, we were always building with mingw - the difference in this PR was only to drop the stray use of the
Yes.
I think that's right - but it will depend if
It may improve performance, if the UCRT builds pick up the MS standard library math routines - but no - I haven't tested.
Yes - I can't see why not - though I don't think this PR will affect that. |
I have a little patch laying around for OpenBLAS to allow for debug;unstripped / non-debug;stripped linkage and to suppress the unnecessary linkage to one single symbol from libquadmath: diff -rupN OpenBLAS/exports/Makefile OpenBLAS_tmp/exports/Makefile
--- OpenBLAS/exports/Makefile 2018-05-19 21:22:05.606912400 +0200
+++ OpenBLAS_tmp/exports/Makefile 2018-05-19 22:43:16.556514800 +0200
@@ -93,11 +93,21 @@ dll : ../$(LIBDLLNAME)
# in their import table. By instead using a stable name it is possible to
# upgrade between library versions, without needing to re-link an application.
# For more details see: https://github.com/xianyi/OpenBLAS/issues/127.
+ifeq ($(DEBUG), 1)
../$(LIBDLLNAME) : ../$(LIBNAME) $(LIBPREFIX).def dllinit.$(SUFFIX)
$(RANLIB) ../$(LIBNAME)
$(CC) $(CFLAGS) $(LDFLAGS) $(LIBPREFIX).def dllinit.$(SUFFIX) \
- -shared -o ../$(LIBDLLNAME) -Wl,--out-implib,../$(IMPLIBNAME) \
+ -shared -o ../$(LIBDLLNAME) -Wl,--defsym,quadmath_snprintf=snprintf \
-Wl,--whole-archive ../$(LIBNAME) -Wl,--no-whole-archive $(FEXTRALIB) $(EXTRALIB)
+ dlltool -D $(LIBDLLNAME) -d $(LIBPREFIX).def -l ../$(LIBDLLNAME).a
+else
+../$(LIBDLLNAME) : ../$(LIBNAME) $(LIBPREFIX).def dllinit.$(SUFFIX)
+ $(RANLIB) ../$(LIBNAME)
+ $(CC) $(CFLAGS) $(LDFLAGS) $(LIBPREFIX).def dllinit.$(SUFFIX) \
+ -shared -o ../$(LIBDLLNAME) -Wl,--defsym,quadmath_snprintf=snprintf -Wl,-gc-sections -Wl,-s \
+ -Wl,--whole-archive ../$(LIBNAME) -Wl,--no-whole-archive $(FEXTRALIB) $(EXTRALIB)
+ dlltool -D $(LIBDLLNAME) -d $(LIBPREFIX).def -l ../$(LIBDLLNAME).a
+endif
$(LIBPREFIX).def : gensymbol
perl ./gensymbol win2k $(ARCH) dummy $(EXPRECISION) $(NO_CBLAS) $(NO_LAPACK) $(NO_LAPACKE) $(NEED2UNDERSCORES) $(ONLY_CBLAS) "$(SYMBOLPREFIX)" "$(SYMBOLSUFFIX)" $(BUILD_LAPACK_DEPRECATED) > $(@F) |
Carl - do you think it's safe to apply your patch to our builds? |
Hm, the patch is not fresh, so I would not bet on this. |
I can build OpenBLAS locally for test, but not today. |
@carlkl - can we apply this in post-processing, without patching OpenBLAS? |
@carlkl - sorry to keep on with the questions - but your patch only applies to the Windows build. What benefit do we get from avoiding the |
@matthew-brett, If libquadmath is linked However, |
Found my comment from 2019 again numpy/numpy#15049 (comment)
but no one was interested in this... |
OK - I've put your patch into this PR. Would you mind reviewing? I agree it's a good idea in general to avoid the libquadmath dependency. I guess we need similar patches for the Unix builds? |
Aha - @carlkl - your patch gives an error on the 32-bit build only:
|
057f0e1
to
3bf6d94
Compare
Apply Carl's patch to OpenBLAS export build of library, to remove libquatmath symbol. See: MacPython#82 (comment)
3bf6d94
to
7568081
Compare
I don't think we need that quadmath patch for Unix builds. I'm not a lawyer, but I think it's about what are you going to deploy with the OpenBLAS binary For Linux you only link against existing libraries. But this argument could be wrong. To be sure one could ask FSF i.e. |
I will test it locally and the push the quadmath patch to the OpenBLAS repo. If they accept it you can remove it later on in this repo. |
What can I do to make this one suitable for merge? I think it's ready from my side. |
# OPENBLAS_ROOT (default directory root for binaries, unspecified -> c:\opt). | ||
# BUILD_BITS (default binary architecture, 32 or 64, unspec -> 64). | ||
# INTERFACE64 (1 for 64-bit interface, anything else or undefined for 32, | ||
# This gives the default value if if_bits not specified above). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be nice to make the connection between the command line if_bits
and the INTERFACE64
environment variable more explicit. What happens if I specify if_bits==32
like in the example above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment above was meant to cover that, unless I misunderstood:
# Uses the optional environment variables. We always prefer command line argument
Any idea what is up with the macOS builds? Edit: macOS arm64 builds |
Allow use of some command line arguments. Make defaults for everything. Pass LDFLAGS
Refactor build_gfortran to run builds in own directory.
7568081
to
df2b693
Compare
I think that's just because the fix to add back the cross-compile flags is not in this branch. I've rebased. |
I think I need this one for #89 since windows no longer builds the current master. |
Thanks @matthew-brett Unfortunately something else changed and the upload failed for win32.
|
I see I can use the conda in the image via the conda github action. I will try that on v0.3.21 |
Apply Carl's patch to OpenBLAS export build of library, to remove libquatmath symbol. See: MacPython#82 (comment)
This now ready for review.
Changes: