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

ADMB v13.0 can not be compiled on Linux arm64 #277

Closed
jonrh opened this issue Nov 30, 2022 · 1 comment
Closed

ADMB v13.0 can not be compiled on Linux arm64 #277

jonrh opened this issue Nov 30, 2022 · 1 comment
Milestone

Comments

@jonrh
Copy link
Contributor

jonrh commented Nov 30, 2022

Compiling ADMB v13.0 and the dev-13.1 branch fails on Linux (Ubuntu) running on a 64 bit ARM processor:

make contrib-libs
make[4]: Entering directory '/home/ubuntu/admb/contrib'
make --directory=ecolib CXXFLAGS= LDFLAGS= OPTION= CONTRIB_OBJS_DIR=../../build/objects-x86_64-linux-g++11
make[5]: Entering directory '/home/ubuntu/admb/contrib/ecolib'
../../admb -c  -o ../../build/objects-x86_64-linux-g++11/saflp-contrib-Gompertz.obj Gompertz.cpp
*** Compile: Gompertz.cpp
g++ -c -std=c++17 -O3 -D_USE_MATH_DEFINES -I. -I"/home/ubuntu/admb/build/admb/include" -o../../build/objects-x86_64-linux-g++11/saflp-contrib-Gompertz.obj Gompertz.cpp

Assembler messages:
Fatal error: can't create ../../build/objects-x86_64-linux-g++11/saflp-contrib-Gompertz.obj: No such file or directory
Error: Could not compile Gompertz.cpp

make[5]: *** [../admb-rules.mak:37: ../../build/objects-x86_64-linux-g++11/saflp-contrib-Gompertz.obj] Error 1
make[5]: Leaving directory '/home/ubuntu/admb/contrib/ecolib'
make[4]: *** [GNUmakefile:291: contrib-ecolib] Error 2
make[4]: Leaving directory '/home/ubuntu/admb/contrib'
make[3]: *** [GNUmakefile:162: all] Error 2
make[3]: Leaving directory '/home/ubuntu/admb/contrib'
make[2]: *** [Makefile:99: g++-contribs] Error 2
make[2]: Leaving directory '/home/ubuntu/admb'
make[1]: *** [Makefile:93: g++-dist] Error 2
make[1]: Leaving directory '/home/ubuntu/admb'
make: *** [Makefile:5: dist] Error 2

The relevant bit from that error message seems to be that ../../build/objects-x86_64-linux-g++11/saflp-contrib-Gompertz.obj does not exist. Note the incorrect architecture part of the path that reads x86_64 (64 bit Intel/AMD). In previous steps in the compilation that architecture part was correctly set to arm64. Example lines from earlier in the compilation:

g++ -c -std=c++17 -O3 -Wall -Wextra -Wconversion -Wno-unused-parameter -D_USE_MATH_DEFINES -I../build/admb/include -o ../build/objects-arm64-linux-g++11/saflp-linad99-fvar_a10.obj linad99/fvar_a10.cpp
g++ -c -std=c++17 -O3 -Wall -Wextra -Wconversion -Wno-unused-parameter -D_USE_MATH_DEFINES -I../build/admb/include -o ../build/objects-arm64-linux-g++11/saflp-linad99-fvar_a11.obj linad99/fvar_a11.cpp
g++ -c -std=c++17 -O3 -Wall -Wextra -Wconversion -Wno-unused-parameter -D_USE_MATH_DEFINES -I../build/admb/include -o ../build/objects-arm64-linux-g++11/saflp-linad99-fvar_a13.obj linad99/fvar_a13.cpp

Looks like the fault may be on lines 62-66 in the file amdb/contrib/GNUmakefile:

ifeq ($(UNAME_S),Linux)
  ifeq (i686,$(findstring i686,$(shell $(CXX) -dumpmachine)))
    OSNAME=-i686-linux
  else
    OSNAME=-x86_64-linux
  endif
endif

Here the architecture defaults to x86_64 if it is not i686 which trips up the compilation inside amdb/contrib/. ARM is not an option. For comparison in the file amdb/src/GNUmakefile the arm64 architecture is handled correctly:

ifeq ($(UNAME_S),Linux)
  ifeq (i686,$(findstring i686,$(shell $(CXX) -dumpmachine)))
    OSNAME=-i686-linux
  else
    ifeq (x86_64,$(findstring x86_64,$(shell $(CXX) -dumpmachine)))
      OSNAME=-x86_64-linux
    else
      OSNAME=-arm64-linux
    endif
  endif
endif

Tested on:

  • Ubuntu running as a Docker container on a Mac with a M2 Apple processor
  • Ubuntu 20.04 running on an t4a.xlarge EC2 AWS instance with a ARM Graviton3 processor
@johnoel johnoel added this to the ADMB-13.1 milestone Dec 2, 2022
johnoel pushed a commit that referenced this issue Dec 7, 2022
Compiling ADMB v13.0 and the dev-13.1 branch fails on Linux (Ubuntu) running on a 64 bit ARM processor:

```
make contrib-libs
make[4]: Entering directory '/home/ubuntu/admb/contrib'
make --directory=ecolib CXXFLAGS= LDFLAGS= OPTION= CONTRIB_OBJS_DIR=../../build/objects-x86_64-linux-g++11
make[5]: Entering directory '/home/ubuntu/admb/contrib/ecolib'
../../admb -c  -o ../../build/objects-x86_64-linux-g++11/saflp-contrib-Gompertz.obj Gompertz.cpp
*** Compile: Gompertz.cpp
g++ -c -std=c++17 -O3 -D_USE_MATH_DEFINES -I. -I"/home/ubuntu/admb/build/admb/include" -o../../build/objects-x86_64-linux-g++11/saflp-contrib-Gompertz.obj Gompertz.cpp

Assembler messages:
Fatal error: can't create ../../build/objects-x86_64-linux-g++11/saflp-contrib-Gompertz.obj: No such file or directory
Error: Could not compile Gompertz.cpp

make[5]: *** [../admb-rules.mak:37: ../../build/objects-x86_64-linux-g++11/saflp-contrib-Gompertz.obj] Error 1
make[5]: Leaving directory '/home/ubuntu/admb/contrib/ecolib'
make[4]: *** [GNUmakefile:291: contrib-ecolib] Error 2
make[4]: Leaving directory '/home/ubuntu/admb/contrib'
make[3]: *** [GNUmakefile:162: all] Error 2
make[3]: Leaving directory '/home/ubuntu/admb/contrib'
make[2]: *** [Makefile:99: g++-contribs] Error 2
make[2]: Leaving directory '/home/ubuntu/admb'
make[1]: *** [Makefile:93: g++-dist] Error 2
make[1]: Leaving directory '/home/ubuntu/admb'
make: *** [Makefile:5: dist] Error 2
```

The relevant bit from that error message seems to be that `../../build/objects-x86_64-linux-g++11/saflp-contrib-Gompertz.obj` does not exist. Note the incorrect architecture part of the path that reads `x86_64` (64 bit Intel/AMD). In previous steps in the compilation that architecture part was correctly set to `arm64`. Example lines from earlier in the compilation:

```
g++ -c -std=c++17 -O3 -Wall -Wextra -Wconversion -Wno-unused-parameter -D_USE_MATH_DEFINES -I../build/admb/include -o ../build/objects-arm64-linux-g++11/saflp-linad99-fvar_a10.obj linad99/fvar_a10.cpp
g++ -c -std=c++17 -O3 -Wall -Wextra -Wconversion -Wno-unused-parameter -D_USE_MATH_DEFINES -I../build/admb/include -o ../build/objects-arm64-linux-g++11/saflp-linad99-fvar_a11.obj linad99/fvar_a11.cpp
g++ -c -std=c++17 -O3 -Wall -Wextra -Wconversion -Wno-unused-parameter -D_USE_MATH_DEFINES -I../build/admb/include -o ../build/objects-arm64-linux-g++11/saflp-linad99-fvar_a13.obj linad99/fvar_a13.cpp
```

Looks like the fault may be on lines 62-66 in the file `amdb/contrib/GNUmakefile`:

```
ifeq ($(UNAME_S),Linux)
  ifeq (i686,$(findstring i686,$(shell $(CXX) -dumpmachine)))
    OSNAME=-i686-linux
  else
    OSNAME=-x86_64-linux
  endif
endif
```

Here the architecture defaults to x86_64 if it is not i686 which trips up the compilation inside `amdb/contrib/`. ARM is not an option. For comparison in the file `amdb/src/GNUmakefile` the arm64 architecture is handled correctly:

```
ifeq ($(UNAME_S),Linux)
  ifeq (i686,$(findstring i686,$(shell $(CXX) -dumpmachine)))
    OSNAME=-i686-linux
  else
    ifeq (x86_64,$(findstring x86_64,$(shell $(CXX) -dumpmachine)))
      OSNAME=-x86_64-linux
    else
      OSNAME=-arm64-linux
    endif
  endif
endif
```

 
Tested on:
+ Ubuntu running as a Docker container on a Mac with a M2 Apple processor
+ Ubuntu 20.04 running on an t4a.xlarge EC2 AWS instance with a ARM Graviton3 processor
johnoel added a commit that referenced this issue Dec 7, 2022
Fixes ADMB compiling on Linux arm64 for Issue #277
@johnoel
Copy link
Contributor

johnoel commented Dec 7, 2022

Thank @jonrh for catching that.

@johnoel johnoel closed this as completed Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants