Forum

Search
Close
AI Search
Classic Search
 Search Phrase:
 Search Type:
Advanced search options
 Search in Forums:
 Search in date period:

 Sort Search Results by:

AI Assistant

SAD on Apple Silicon

5 Posts
3 Users
0 Reactions
8,760 Views
Member
Joined: 5 years ago
Posts: 1
Topic starter
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
  [#48]

M1 Macbook Proを入手しましたので、SADをコンパイルしてみました。何とか動くところまで来ましたので、簡単に報告します。

1)MacPortsのインストール

今のところApple Siliconへの対応が一番良いのでMacPortsを使って必要なソフトをインストールします。MacPorts自体のインストールに関しては以下を参照してください。

https://www.macports.org/install.php

2)必要なパッケージのインストール

以下のパッケージをインストールします。Apple Siliconに対応しているgccはgcc11しかないのでこれを入れます。

% sudo port -v install xorg-server
% sudo port -v install xorg
% sudo port -v install gcc-devel
% sudo port -v install subversion
% sudo port -v install wget

3)sad.confの編集

SADのソースを入手し、sad.conf.sampleをコピーして以下の設定を追加します。

CC=/opt/local/bin/gcc-mp-devel
FC=/opt/local/bin/gfortran-mp-devel
COPT+=-fcommon

# -- for gfortran 10 workaround --

FOPT+=-fallow-argument-mismatch

FOPT+=-fallow-invalid-boz

X11_PREFIX=/opt/local

4)make install

% make exe

% make install-exe install-pkg

5)問題点

無事コンパイルも終わり、インストールできますが、bench2.sadを走らせると

dynl_link: dlopen($(SAD_ROOT)/share/Extension/SAD/unknown-Darwin20/Tkinter.so, 1): Library not loaded: $(SAD_ROOT)/arch/unknown-Darwin20/lib:/opt/local/lib/libtk8.6.dylib

  Referenced from: $(SAD_ROOT)/share/Extension/SAD/unknown-Darwin20/Tkinter.so

  Reason: image not found

Loading library[SAD/Tkinter] from $(SAD_ROOT)/share/Extension/SAD/unknown-Darwin20/Tkinter.so is failed.

というエラーが出てTkinter.soがロードできません。これは

% otool -L  $(SAD_ROOT)/share/Extension/SAD/unknown-Darwin20/Tkinter.so

$(SAD_ROOT)share/Extension/SAD/unknown-Darwin20/Tkinter.so:

Tkinter.so (compatibility version 0.0.0, current version 0.0.0)

$(SAD_ROOT)/arch/unknown-Darwin20/lib:/opt/local/lib/libtk8.6.dylib (compatibility version 8.6.0, current version 8.6.10)

$(SAD_ROOT)/arch/unknown-Darwin20/lib/libtcl8.6.dylib (compatibility version 8.6.0, current version 8.6.10)

/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.0.0)

となりlibtk8.6.dylib のパスがおかしくなってます。(何故こうなるのか?)

仕方ないので、install_name_toolを使ってパスを直します。

% install_name_tool -change $(SAD_ROOT)/arch/unknown-Darwin20/lib:/opt/local/lib/libtk8.6.dylib $(SAD_ROOT)/arch/unknown-Darwin20/lib/libtk8.6.dylib $(SAD_ROOT)/share/Extension/SAD/unknown-Darwin20/Tkinter.so

これで動くようになりbench2.sadの結果は以下のようになりました。

 *********** summary of the bench mark 

Function Test .6057850196957588

Optics Test .45907795429229736

Tracking Test .3977919816970825

Matching Test .03075695037841797

Overall Score (smaller is faster): .02366956624956358

 Abort

Note: The following floating-point exceptions are signalling: IEEE_OVERFLOW_FLAG

 



   
ReplyQuote
Joined: 5 years ago
Posts: 2
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

Thank you for sharing your experience! 

I succeeded to build sad k64 with Apple M1 chip (macOS 11.0.1) following your steps. However different problems are observed when test the installation.

** .../oldsad/bin/gs: line 87: ulimit: stack size: cannot modify limit: Operation not permitted
solved by setting "stacksize=65408" given by executing "ulimit -a"
 
** BOZ literal constant near (1) cannot appear as an operand of a relational operator: .../oldsad/src/tfconvstr.f:843:48
solved by modifiy /src/tfconvstr.f : change Z.'000007FF" to int(Z'0000007F') 
 
** no problem to run "bench2.sad" by couldn't make plot w/ "draw" command
 
In[105]:= draw bx by
Tk_Init error:
???General::ioerr: I/O error in initializing Tk in TclCreateInterp[]
 
I enable X11/TCLTK by:

USE_X11=YES
X11_PREFIX=/opt/local/
USE_TCLTK=YES

 


   
ReplyQuote
Joined: 5 years ago
Posts: 2
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

The display issues are fixed for the sadk64 V1.1.10.5k64.

Many thanks to Oide-san's updates of the required patches for the tcl/tk 8.6 version. 



   
ReplyQuote
Joined: 4 years ago
Posts: 1
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

コンパイル後、走らせてみると

$ bin/gs

dyld: Library not loaded: @rpath/libgfortran.5.dylib
Referenced from: /Users/onishi/src/compile/trunk-r5713/obj/unknown-Darwin20/sad-last.exe
Reason: image not found
Abort

 

となる。

$ gfortran -print-file-name=libgfortran.a
/opt/local/lib/gcc10/gcc/arm64-apple-darwin20/10.2.1/../../../libgfortran.a

これは、正常そうである。

$ cd /opt/local/lib/libgcc/
 
[mar91-228:local/lib/libgcc] onishi% ls
libatomic.1.dylib* libgfortran.5.dylib* libobjc-gnu.4.dylib*
libgcc_s.1.1.dylib libgomp.1.dylib* libssp.0.dylib*
libgcc_s.2.dylib libitm.1.dylib* libstdc++.6.dylib*
 
[mar91-228:local/lib/libgcc] onishi% pwd
/opt/local/lib/libgcc
 
[mar91-228:local/lib/libgcc] onishi% otool -D libgfortran.5.dylib 
libgfortran.5.dylib:
@rpath/libgfortran.5.dylib
 
[mar91-228:local/lib/libgcc] onishi% otool -L libgfortran.5.dylib 
libgfortran.5.dylib:
@rpath/libgfortran.5.dylib (compatibility version 6.0.0, current version 6.0.0)
@rpath/libgcc_s.1.1.dylib (compatibility version 1.0.0, current version 1.1.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1292.100.5)

rpathでいいのか?gcc10はMacPortsで入れました。

obj/unknoun-Darwin20/sad-last.exeの中も、@rpath/libgfortran.5.dylibとなっている。

どうすれば良いのか、ご教授願います。

環境:

macOS Big Sur 11.6

MacBook Air (2020)

Apple M1 チップ



   
ReplyQuote
Member
Joined: 4 years ago
Posts: 1
Translate
English
Spanish
French
German
Italian
Portuguese
Russian
Chinese
Japanese
Korean
Arabic
Hindi
Dutch
Polish
Turkish
Vietnamese
Thai
Swedish
Danish
Finnish
Norwegian
Czech
Hungarian
Romanian
Greek
Hebrew
Indonesian
Malay
Ukrainian
Bulgarian
Croatian
Slovak
Slovenian
Serbian
Lithuanian
Latvian
Estonian
 

吉本 さんの助言により

% install_name_tool -change @rpath/libgfortran.5.dylib /opt/local/lib/libgcc//libgfortran.5.dylib sad-last.exe

*********** summary of the bench mark
Function Test .6169809999999998
Optics Test .9050379999999999
Tracking Test .3320259999999997
Matching Test .06080200000000002
Overall Score (smaller is faster): .0282094613095238



   
ReplyQuote

Leave a reply

Author Name

Author Email

Title *

Preview 0 Revisions Saved