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

Static libs on MacOS X #31

Open
luc-j-bourhis opened this issue Jun 6, 2013 · 4 comments
Open

Static libs on MacOS X #31

luc-j-bourhis opened this issue Jun 6, 2013 · 4 comments
Labels
accepted This sounds like something to look into.
Projects

Comments

@luc-j-bourhis
Copy link

Hi,

using master as of ab621e9 (Quick fix to set SMLSIZ=25 to get around Mac OS X bug.), the build fails:


~jblas (master)> ./configure --lapack=../lapack-3.4.2 --libpath=$HOME/atlas/lib --static-libs
....
looking for libraries...... {"lapack"=>"/Users/luc/atlas/lib", "f77blas"=>"/Users/luc/atlas/lib", "cblas"=>"/Users/luc/atlas/lib", "atlas"=>"/Users/luc/atlas/lib"}
x86_64
Looking for where libgfortran.a is... (/opt/local/lib/gcc47/gcc/x86_64-apple-darwin11/4.7.3/../../../libgfortran.a)
ok

Configuration succesfull, writing out results to configure.out
~jblas (master)> make
gcc -shared -o target/c/NativeBlas.jnilib target/c/NativeBlas.o /Users/luc/atlas/lib/liblapack.a /Users/luc/atlas/lib/libf77blas.a /Users/luc/atlas/lib/libcblas.a /Users/luc/atlas/lib/libatlas.a /opt/local/lib/gcc47/gcc/x86_64-apple-darwin11/4.7.3/../../../libgfortran.a
Undefined symbols for architecture x86_64:
  "_quadmath_snprintf", referenced from:
      _write_float in libgfortran.a(write.o)
  "_strtoflt128", referenced from:
      __gfortrani_convert_real in libgfortran.a(read.o)
      __gfortrani_convert_infnan in libgfortran.a(read.o)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [target/c/NativeBlas.jnilib] Error 1

Now if I apply the following patch:

diff --git a/config/config_libs.rb b/config/config_libs.rb
index 2055a49..19b9fca 100644
--- a/config/config_libs.rb
+++ b/config/config_libs.rb
@@ -157,10 +157,7 @@ because it's usually not compiled with -fPIC. This means that you need to
 have libgfortran.so installed on your target system. Sorry for the inconvenience!
 EOS
       elsif CONFIG['OS_NAME'] == 'Mac\ OS\ X'
-        print "Looking for where libgfortran.a is... "
-        libgfortran_path = %x(gfortran -print-file-name=libgfortran.a).strip
-             puts "(#{libgfortran_path})"
-             CONFIG['LOADLIBES'] += [libgfortran_path]
+             CONFIG['LOADLIBES'] += ['-lgfortran']
       else
         CONFIG['LOADLIBES'] += ['-l:libgfortran.a']
       end

It all works and the sanity check passes with flying colours. What was the reason for not using -lgfortran on MacOS X?

@mikiobraun
Copy link
Member

Hi Luc,

interesting. The reason I tried so hard to locate the statically linked
gfortran library was that I tried to include all dependencies in the jblas
shared lib. Otherwise, people would have to make sure the gfortran runtimes
are installed which might not always be the case.

It seems that libgfortran now has further dependencies which are not
included.. :(

Can you tell me which version of gfortran/gcc you're using?

-M

On Thu, Jun 6, 2013 at 12:59 PM, Luc J. Bourhis notifications@github.comwrote:

Hi,

using master as of ab621e9ab621e9c7b2(Quick fix to set SMLSIZ=25 to get around Mac OS X bug.), the build fails:

~jblas (master)> ./configure --lapack=../lapack-3.4.2 --libpath=$HOME/atlas/lib --static-libs
....
looking for libraries...... {"lapack"=>"/Users/luc/atlas/lib", "f77blas"=>"/Users/luc/atlas/lib", "cblas"=>"/Users/luc/atlas/lib", "atlas"=>"/Users/luc/atlas/lib"}
x86_64
Looking for where libgfortran.a is... (/opt/local/lib/gcc47/gcc/x86_64-apple-darwin11/4.7.3/../../../libgfortran.a)
ok

Configuration succesfull, writing out results to configure.out
~jblas (master)> make
gcc -shared -o target/c/NativeBlas.jnilib target/c/NativeBlas.o /Users/luc/atlas/lib/liblapack.a /Users/luc/atlas/lib/libf77blas.a /Users/luc/atlas/lib/libcblas.a /Users/luc/atlas/lib/libatlas.a /opt/local/lib/gcc47/gcc/x86_64-apple-darwin11/4.7.3/../../../libgfortran.a
Undefined symbols for architecture x86_64:
"_quadmath_snprintf", referenced from:
_write_float in libgfortran.a(write.o)
"_strtoflt128", referenced from:
__gfortrani_convert_real in libgfortran.a(read.o)
__gfortrani_convert_infnan in libgfortran.a(read.o)
ld: symbol(s) not found for architecture x86_64
collect2: error: ld returned 1 exit status
make: *** [target/c/NativeBlas.jnilib] Error 1

Now if I apply the following patch:

diff --git a/config/config_libs.rb b/config/config_libs.rb
index 2055a49..19b9fca 100644
--- a/config/config_libs.rb
+++ b/config/config_libs.rb
@@ -157,10 +157,7 @@ because it's usually not compiled with -fPIC. This means that you need to
have libgfortran.so installed on your target system. Sorry for the inconvenience!
EOS
elsif CONFIG['OS_NAME'] == 'Mac\ OS\ X'

  •    print "Looking for where libgfortran.a is... "
    
  •    libgfortran_path = %x(gfortran -print-file-name=libgfortran.a).strip
    
  •         puts "(#{libgfortran_path})"
    
  •         CONFIG['LOADLIBES'] += [libgfortran_path]
    
  •         CONFIG['LOADLIBES'] += ['-lgfortran']
    
    else
    CONFIG['LOADLIBES'] += ['-l:libgfortran.a']
    end

It all works and the sanity check passes with flying colours. What was the
reason for not using -lgfortran on MacOS X?


Reply to this email directly or view it on GitHubhttps://github.com//issues/31
.

Mikio Braun - http://blog.mikiobraun.de, http://twitter.com/mikiobraun

@luc-j-bourhis
Copy link
Author

I installed the MacPorts package gcc4.7.

@mikiobraun
Copy link
Member

I see, I have gcc 4.2...

On Thu, Jun 6, 2013 at 3:20 PM, Luc J. Bourhis notifications@github.comwrote:

I installed the MacPorts package gcc4.7.


Reply to this email directly or view it on GitHubhttps://github.com//issues/31#issuecomment-19044350
.

Mikio Braun - http://blog.mikiobraun.de, http://twitter.com/mikiobraun

@mikiobraun
Copy link
Member

Time to make it work under MacOS again... .

@mikiobraun mikiobraun added the accepted This sounds like something to look into. label Aug 25, 2020
@mikiobraun mikiobraun added this to Backlog in Task board Aug 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
accepted This sounds like something to look into.
Projects
Task board
Backlog
Development

No branches or pull requests

2 participants