Author Topic: Still about FEAP on a new Mac  (Read 10324 times)

Giorgio Zavarise

  • New Member
  • *
  • Posts: 4
Still about FEAP on a new Mac
« on: September 07, 2022, 03:09:13 PM »
Hi,
 I have seen some questions about compiling FEAP on the new Macs, and I am also experiencing big problems:
When I moved from my old to the new Mac I have updated both gfortran and Xquartz, and I used 'brew install jpeg' to update my jpeg libraries.
I would like to specify that I am using the last version of Mac OS (Monterey 12.5).

Ok, now the problem: I am able to compile the files and to get the FEAP archive, but when the link phase come it complains about some x86_64 and some arm64 libraries. Moreover the compiler complains also about a regularly compiled "sld2d1u.o" file.
Here are my link options:
"
LDOPTIONS = -L/usr/X11/lib -L/usr/local/opt/jpeg/lib -lX11 -lm -ljpeg -lblas -llapack
"
and here is the result, typing "make install". As you see the archive seems ok
"
--> Feap Archive updated <--
(cd main; make feap)
ranlib /Users/work/Desktop/FEAP-8.6.1n/Feap8_6n.a
gfortran -o feap feap86.o  \
   /Users/work/Desktop/FEAP-8.6.1n/Feap8_6n.a -L/usr/X11/lib -L/usr/local/opt/jpeg/lib -lX11 -lm -ljpeg -lblas -llapack
ld: warning: ignoring file /usr/local/opt/jpeg/lib/libjpeg.dylib, building for macOS-arm64 but attempting to link with file built for macOS-x86_64
ld: in /Users/work/Desktop/FEAP-8.6.1n/Feap8_6n.a(sld2d1u.o), in section __TEXT,__text reloc 566: symbol index out of range for architecture arm64
collect2: error: ld returned 1 exit status
make[1]: *** [feap] Error 1
make: *** [feap] Error 2
"
I spent a lot of time trying to solve the problem, without any result. I hope to get a hint here.
Best regards
Giorgio Zavarise


Prof. S. Govindjee

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 1160
Re: Still about FEAP on a new Mac
« Reply #1 on: September 07, 2022, 08:37:39 PM »
Here is my basic set up on my ARM (M1 chip) Mac, which works fine.

Mac OS 12.4 (Monterey)

Code: [Select]
gfortran -v
Using built-in specs.
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/opt/homebrew/Cellar/gcc/11.3.0_2/bin/../libexec/gcc/aarch64-apple-darwin21/11/lto-wrapper
Target: aarch64-apple-darwin21
Configured with: ../configure --prefix=/opt/homebrew/opt/gcc --libdir=/opt/homebrew/opt/gcc/lib/gcc/11 --disable-nls --enable-checking=release --with-gcc-major-version-only --enable-languages=c,c++,objc,obj-c++,fortran --program-suffix=-11 --with-gmp=/opt/homebrew/opt/gmp --with-mpfr=/opt/homebrew/opt/mpfr --with-mpc=/opt/homebrew/opt/libmpc --with-isl=/opt/homebrew/opt/isl --with-zstd=/opt/homebrew/opt/zstd --with-pkgversion='Homebrew GCC 11.3.0_2' --with-bugurl=https://github.com/Homebrew/homebrew-core/issues --build=aarch64-apple-darwin21 --with-system-zlib --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 11.3.0 (Homebrew GCC 11.3.0_2)

In my makefile.in

Code: [Select]
  CINCLUDE = /opt/X11/include -I/opt/homebrew/include

  FF = gfortran-11
  CC = gcc-11

#------------------------------------------------------------------------
# What optimization level to use

  FFOPTFLAG = -g -O2 -Wall -ffpe-trap=invalid,zero
  CCOPTFLAG = -g -O2 -Wall

  LDOPTIONS = -L/opt/X11/lib -L/opt/homebrew/lib -lX11 -lm -ljpeg -lblas -llapack

The libraries that my main executable are linking too are

Code: [Select]
otool -L feap
feap:
/opt/X11/lib/libX11.6.dylib (compatibility version 11.0.0, current version 11.0.0)
/opt/homebrew/opt/jpeg/lib/libjpeg.9.dylib (compatibility version 15.0.0, current version 15.0.0)
/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib (compatibility version 1.0.0, current version 1.0.0)
/System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib (compatibility version 1.0.0, current version 1.0.0)
/opt/homebrew/opt/gcc/lib/gcc/11/libgfortran.5.dylib (compatibility version 6.0.0, current version 6.0.0)
/opt/homebrew/opt/gcc/lib/gcc/11/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
/usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)

How does your setup differ from this?

Prof. S. Govindjee

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 1160
Re: Still about FEAP on a new Mac
« Reply #2 on: September 07, 2022, 08:40:00 PM »
I just noticed that you are pointing to what I think are the old brew locations.  Or did you tell brew to use non-default locations?
My experience is that brew has changed its default file system and moved to /opt as opposed to /usr/local.

Giorgio Zavarise

  • New Member
  • *
  • Posts: 4
Re: Still about FEAP on a new Mac
« Reply #3 on: September 08, 2022, 05:06:51 PM »
Hi Sanjay, many thanks for your suggestions. At the end I have been able to solve the problem.
First I got an executable without jpeg, and then with some more efforts I got the jpeg option working.
However my installation looks different from your:

1)
The command "gfortran - v" to me gives:
COLLECT_GCC=gfortran
COLLECT_LTO_WRAPPER=/usr/local/gfortran/libexec/gcc/aarch64-apple-darwin21/12.1.0/lto-wrapper
Target: aarch64-apple-darwin21
Configured with: ../gcc-12-branch/configure --prefix=/usr/local/gfortran --with-gmp=/Users/fx/devel/gcc/build_package/deps --with-zstd=/Users/fx/devel/gcc/build_package/deps --with-sysroot=/Library/Developer/CommandLineTools/SDKs/MacOSX12.sdk --build=aarch64-apple-darwin21 --enable-languages=ada,c,c++,fortran,jit,lto,objc,obj-c++ --with-system-zlib
Thread model: posix
Supported LTO compression algorithms: zlib zstd
gcc version 12.1.0 (GCC)

2)
My modifications to the makefile.in are the following:
...
##  CINCLUDE = /opt/X11/include
    CINCLUDE = /opt/X11/include -I/usr/local/Cellar/jpeg/9e/include/
...
...
  FF = gfortran-12
  CC = gcc-12
...
...
  LDOPTIONS = -L/opt/X11/lib   -L/usr/local/opt/jpeg/lib -ljpeg -lX11 -lm -lblas -llapack
...

3) The command "otool -L feap" to me gives:
feap86n-jpeg:
   /usr/local/opt/jpeg/lib/libjpeg.9.dylib (compatibility version 15.0.0, current version 15.0.0)
   /opt/X11/lib/libX11.6.dylib (compatibility version 11.0.0, current version 11.0.0)
   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib (compatibility version 1.0.0, current version 1.0.0)
   /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libLAPACK.dylib (compatibility version 1.0.0, current version 1.0.0)
   /usr/local/opt/gcc/lib/gcc/current/libgfortran.5.dylib (compatibility version 6.0.0, current version 6.0.0)
   /usr/local/opt/gcc/lib/gcc/current/libgcc_s.1.1.dylib (compatibility version 1.0.0, current version 1.1.0)
   /usr/local/opt/gcc/lib/gcc/current/libquadmath.0.dylib (compatibility version 1.0.0, current version 1.0.0)
   /usr/lib/libSystem.B.dylib (compatibility version 1.0.0, current version 1311.100.3)

Again, many thanks for your help
Giorgio
« Last Edit: September 09, 2022, 03:26:48 PM by Giorgio Zavarise »

Prof. S. Govindjee

  • Administrator
  • FEAP Guru
  • *****
  • Posts: 1160
Re: Still about FEAP on a new Mac
« Reply #4 on: September 08, 2022, 08:21:35 PM »
Good news.  Glad it is working again.  I guess this also tells me that I should update the OS and brew version on my M1 machine.