You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
On OSX openblas has the same problem GOTOblas used to have regarding the generation of .dylib files: the install name is not set correctly and the subsequent dylib is not valid:
$ otool -L libopenblas_core2p-r0.1alpha2.3.dylib
libopenblas_core2p-r0.1alpha2.3.dylib:
../libopenblas_core2p-r0.1alpha2.3.dylib (compatibility version 0.0.0, current version 0.0.0)
/usr/local/gcc/lib/libgfortran.3.dylib (compatibility version 4.0.0, current version 4.0.0)
/usr/local/gcc/lib/libgomp.1.dylib (compatibility version 2.0.0, current version 2.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 125.2.11)
/usr/local/gcc/lib/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/local/gcc/lib/libgcc_s.1.dylib (compatibility version 1.0.0, current version 1.0.0)
The "../libopenblas_core2p-r0.1alpha2.3.dylib (compatibility version 0.0.0, current version 0.0.0)" line is the problem: dylibs on OSX must know where they are absolutely (yes, it is silly). The dylib is generated by the Makefile in the exports directory, line 88:
Why is the command $(PREFIX)gcc when everything else has the generic and portable $(CC) which, for example, takes into account the CC variable set in Makefile.rule? $PREFIX is supposed to be the installation directory. I think this is an error and no one has picked it up simply because no one bothers to set $PREFIX in Makefile.rule on OSX.
The option -install_name has to be used here, but I'm not sure how to specify this in a portable way if this is even possible. I modify line 88 to look like the following as a workaround:
where $PREFIX is set in Makefile.rule, but this will fail if $PREFIX is blank (ie, commented out). Further, if the dylib is subsequently moved to anywhere except $PREFIX, it cannot be loaded by any apps that link against it.
To be honest I'm not an expert on the Right Way of constructing dylibs for portability so I don't know a good way to fix this generically. Any good ideas?
On OSX openblas has the same problem GOTOblas used to have regarding the
generation of .dylib files: the install name is not set correctly and the
subsequent dylib is not valid:
$ otool -L libopenblas_core2p-r0.1alpha2.3.dylib
libopenblas_core2p-r0.1alpha2.3.dylib:
../libopenblas_core2p-r0.1alpha2.3.dylib (compatibility version
0.0.0, current version 0.0.0)
/usr/local/gcc/lib/libgfortran.3.dylib (compatibility version
4.0.0, current version 4.0.0)
/usr/local/gcc/lib/libgomp.1.dylib (compatibility version 2.0.0,
current version 2.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current
version 125.2.11)
/usr/local/gcc/lib/libquadmath.0.dylib (compatibility version
1.0.0, current version 1.0.0)
/usr/local/gcc/lib/libgcc_s.1.dylib (compatibility version 1.0.0,
current version 1.0.0)
The "../libopenblas_core2p-r0.1alpha2.3.dylib (compatibility version
0.0.0, current version 0.0.0)" line is the problem: dylibs on OSX must know
where they are absolutely (yes, it is silly). The dylib is generated by the
Makefile in the exports directory, line 88:
Why is the command $(PREFIX)gcc when everything else has the generic
and portable $(CC) which, for example, takes into account the CC variable
set in Makefile.rule? $PREFIX is supposed to be the installation directory.
I think this is an error and no one has picked it up simply because no one
bothers to set $PREFIX in Makefile.rule on OSX.
Yes, it looks like a bug. I'm on holiday. I will check it in next week.
The option -install_name has to be used here, but I'm not sure how to
specify this in a portable way if this is even possible. I modify line 88 to
look like the following as a workaround:
where $PREFIX is set in Makefile.rule, but this will fail if $PREFIX is
blank (ie, commented out). Further, if the dylib is subsequently moved to
anywhere except $PREFIX, it cannot be loaded by any apps that link against
it.
To be honest I'm not an expert on the Right Way of constructing dylibs for
portability so I don't know a good way to fix this generically. Any good
ideas?
Thank you
Kane
Reply to this email directly or view it on GitHub: #57
Ok. Maybe one option is to set -headerpad_max_install_names on the initial build of the dylib and then if the user actually runs "make install", install_name_tool can be used to set the dylib path for the specified prefix, the syntax would be:
assuming the initial name is set to ../libopenblas_core2p-r0.1alpha2.3.dylib, which it currently is. Setting -headerpad_max_install_names also allows a user who doesn't use make install to change the name themselves later - perhaps if the target is Darwin a message needs to be printed out along with the build information at the end of the compile saying the dylib won't work as-is.
My pleasure. I believe there are some latent problems with the construction of the dylib in any case - it may be worth putting a warning in the README of the next release saying the dylib is unusable on OSX at present as there are symbols missing (at least dlamch and ilaenv). The static library works perfectly fine. Let me know if you need me to check whether the patch works.
No, the patch doesn't work. You need absolute paths in the install name, so pwd/../$(DYLIBNAME) is not valid. I have attached a patch that has the correct behaviour. I've also updated the warning in Makefile to give the user more options and fixed the English slightly.
CURDIR is a standard make variable, which contains the absolute path of current working directory. I think you could use this shared library in OpenBLAS top directory.
Thanks
Xianyi
Kane O'Donnell write:Sent: 2011/9/17 1:06
Hi Xianyi,
No, the patch doesn't work. You need absolute paths in the install name, so pwd/../$(DYLIBNAME) is not valid. I have attached a patch that has the correct behaviour. I've also updated the warning in Makefile to give the user more options and fixed the English slightly.
Apart from the fact that you need a space between the -install_name switch and the $(CURDIR) variable, the line you substituted works fine.
One other thing: there is an inconsistency between the install behaviour of OpenBLAS and other GNU-make style software. Normally when building a library on Linux/Unix/OSX, if user supplies PREFIX, the libraries go to $PREFIX/lib and the headers to $PREFIX/include. OpenBLAS is instead sending everything to $PREFIX. Since the configuration scripts of the codes using OpenBLAS can be quite subtle it would be best if the OpenBLAS install is changed to put things in their correct location relative to $PREFIX.
Kane
On 17/09/2011, at 10:45 AM, Xianyi Zhang wrote:
Hi Kane,
I just applied your patch. However, I used this in generating shared
library.
CURDIR is a standard make variable, which contains the absolute path of current working directory. I think you could use this shared library in OpenBLAS top directory.
Thanks
Xianyi
Kane O'Donnell write:Sent: 2011/9/17 1:06
Hi Xianyi,
No, the patch doesn't work. You need absolute paths in the install name, so pwd/../$(DYLIBNAME) is not valid. I have attached a patch that has the correct behaviour. I've also updated the warning in Makefile to give the user more options and fixed the English slightly.
Kane
Reply to this email directly or view it on GitHub: #57 (comment)
Activity
xianyi commentedon Sep 11, 2011
2011 9 11 05:23"Kane O'Donnell" <
reply@reply.github.com
Yes, it looks like a bug. I'm on holiday. I will check it in next week.
Thank you
kaneod commentedon Sep 11, 2011
Ok. Maybe one option is to set -headerpad_max_install_names on the initial build of the dylib and then if the user actually runs "make install", install_name_tool can be used to set the dylib path for the specified prefix, the syntax would be:
install_name_tool -change ../libopenblas_core2p-r0.1alpha2.3.dylib $(PREFIX)/libopenblas_core2p-r0.1alpha2.3.dylib libopenblas_core2p-r0.1alpha2.3.dylib
assuming the initial name is set to ../libopenblas_core2p-r0.1alpha2.3.dylib, which it currently is. Setting -headerpad_max_install_names also allows a user who doesn't use make install to change the name themselves later - perhaps if the target is Darwin a message needs to be printed out along with the build information at the end of the compile saying the dylib won't work as-is.
xianyi commentedon Sep 12, 2011
Hi Kane,
Thank you for the patch and suggestions.
I'm not a Mac or OSX user. Thus, I can't address this issue. :(
I will apply your patch in future release.
Thanks
Xianyi
kaneod commentedon Sep 12, 2011
Hi Xianyi,
My pleasure. I believe there are some latent problems with the construction of the dylib in any case - it may be worth putting a warning in the README of the next release saying the dylib is unusable on OSX at present as there are symbols missing (at least dlamch and ilaenv). The static library works perfectly fine. Let me know if you need me to check whether the patch works.
Kane
Refs #57. The bug about absolute path of shared library on Mac OSX.
xianyi commentedon Sep 16, 2011
Hi Kane,
I just added your patch into this branch ( https://github.com/xianyi/OpenBLAS/tree/hotfix-0.1alpha2.4 ).
Please help me test it on Mac.
Thank you
Xianyi
kaneod commentedon Sep 16, 2011
Hi Xianyi,
No, the patch doesn't work. You need absolute paths in the install name, so
pwd/../$(DYLIBNAME) is not valid. I have attached a patch that has the correct behaviour. I've also updated the warning in Makefile to give the user more options and fixed the English slightly.Kane
On 16/09/2011, at 12:08 PM, Xianyi Zhang wrote:
Refs #57. Continue to fix absolute path issue about shared library on…
xianyi commentedon Sep 17, 2011
Hi Kane,
I just applied your patch. However, I used this in generating shared
library.
CURDIR is a standard make variable, which contains the absolute path of current working directory. I think you could use this shared library in OpenBLAS top directory.
Thanks
Xianyi
Kane O'Donnell write:Sent: 2011/9/17 1:06
kaneod commentedon Sep 17, 2011
Hi Xianyi,
Apart from the fact that you need a space between the -install_name switch and the $(CURDIR) variable, the line you substituted works fine.
One other thing: there is an inconsistency between the install behaviour of OpenBLAS and other GNU-make style software. Normally when building a library on Linux/Unix/OSX, if user supplies PREFIX, the libraries go to $PREFIX/lib and the headers to $PREFIX/include. OpenBLAS is instead sending everything to $PREFIX. Since the configuration scripts of the codes using OpenBLAS can be quite subtle it would be best if the OpenBLAS install is changed to put things in their correct location relative to $PREFIX.
Kane
On 17/09/2011, at 10:45 AM, Xianyi Zhang wrote:
Merge pull request #57 from xianyi/develop