IBM / itaa-docs

Documentation for IBM IT Architect Assistant (all offerings)
Eclipse Public License 1.0
33 stars 27 forks source link

Can not run the assistant on macbook pro with error "./ca-offline-macos: Bad CPU type in executable" #32

Closed abou7abiba closed 7 months ago

abou7abiba commented 9 months ago

I followed the instructions to install the assistant code. I am installing it on MacBook Pro. When I run the run.sh I get the following error: Using CATALINA_BASE: /Users/zoro/DevLab/IBM/cogarch/Community-Edition-3.17.0/CAAppOffline/tomcat Using CATALINA_HOME: /Users/zoro/DevLab/IBM/cogarch/Community-Edition-3.17.0/CAAppOffline/tomcat Using CATALINA_TMPDIR: /Users/zoro/DevLab/IBM/cogarch/Community-Edition-3.17.0/CAAppOffline/tomcat/temp Using JRE_HOME: ../jre/Contents/Home Using CLASSPATH: /Users/zoro/DevLab/IBM/cogarch/Community-Edition-3.17.0/CAAppOffline/tomcat/bin/bootstrap.jar:/Users/zoro/DevLab/IBM/cogarch/Community-Edition-3.17.0/CAAppOffline/tomcat/bin/tomcat-juli.jar Using CATALINA_OPTS: Tomcat started. ./run.sh: line 11: ./ca-offline-macos: Bad CPU type in executable

I tried to run the command xattr -cr ./ca-offline-macos

But the issue still exists and I can not start the server.

When I checked the logs folder I found the catalina.out file which includes the following line:

/Users/zoro/DevLab/IBM/cogarch/Community-Edition-3.17.0/CAAppOffline/tomcat/bin/catalina.sh: line 504: ../jre/Contents/Home/bin/java: Bad CPU type in executable

Here is the information of my system

Hardware Overview:

Model Name: MacBook Pro Model Identifier: MacBookPro17,1 Chip: Apple M1 Total Number of Cores: 8 (4 performance and 4 efficiency) Memory: 16 GB System Firmware Version: 7429.81.3 OS Loader Version: 7429.81.3

System Software Overview:

System Version: macOS 12.2.1 (21D62) Kernel Version: Darwin 21.3.0

abou7abiba commented 8 months ago

I was able to fix initial install issues which it seems related to permissions .. and although I am familiar with Ubuntu, it seems it is a bit different in macOS. However here are the details.

The packages used

The Install outcome I was able to install it only when I use sudo command

Ahmed-Ibrahim@Breadfasts-MacBook-Pro CAAppOffline % sudo ./install.sh 
Password:
Please keep this window open until the installation is completed. If any error appears, please rerun the script.
Input tomcat-8.5 folder path(e.g. ~/Desktop/apache-tomcat-8.5.45), then click Enter: /Users/Ahmed-Ibrahim/DevLab/IBM/cogarch/apache-tomcat-8.5.97
Input jre folder path(e.g. ~/Desktop/jre1.8.0_131.jre), then click Enter: /Users/Ahmed-Ibrahim/DevLab/IBM/cogarch/jre1.8.0_202.jre
Installed the application successfully. You can input "sh run.sh" to run the application.

Here is the list of the directory after the installation .. please note the permissions for tomcat folder

Ahmed-Ibrahim@Breadfasts-MacBook-Pro CAAppOffline % ls -la
total 948832
drwxrwxr-x   25 Ahmed-Ibrahim  staff        800 Dec 21 15:27 .
drwxrwxr-x    5 Ahmed-Ibrahim  staff        160 Dec 19 02:24 ..
-rw-r--r--    1 Ahmed-Ibrahim  staff       8196 Dec 21 15:22 .DS_Store
drwxrwxr-x    3 Ahmed-Ibrahim  staff         96 Nov 30 03:01 .github
-rw-rw-r--    1 Ahmed-Ibrahim  staff       1444 Oct 17 14:11 .pre-commit-config.yaml
-rw-rw-r--    1 Ahmed-Ibrahim  staff       1429 Oct 17 14:11 .secrets.baseline
-rw-rw-r--    1 Ahmed-Ibrahim  staff         77 Oct 17 14:11 .whitesource
-rw-rw-r--    1 Ahmed-Ibrahim  staff     119572 Oct 17 14:11 ArchitectureModelDocumentTemplate.docx
-rw-rw-r--    1 Ahmed-Ibrahim  staff         24 Oct 17 14:11 CODEOWNERS
-rw-rw-r--    1 Ahmed-Ibrahim  staff   52924593 Oct 17 14:10 DocGenMicroService.war
-rw-rw-r--    1 Ahmed-Ibrahim  staff          0 Oct 17 14:11 LICENSE
-rw-rw-r--    1 Ahmed-Ibrahim  staff    9927009 Oct 17 14:11 MxgraphBackend.war
-rw-rw-r--    1 Ahmed-Ibrahim  staff       7780 Oct 17 14:11 ReadMe.md
drwxrwxr-x    5 Ahmed-Ibrahim  staff        160 Nov 30 02:59 backups
-rwxrwxr-x    1 Ahmed-Ibrahim  staff  210277735 Oct 17 14:11 ca-offline-macos
-rw-rw-r--    1 Ahmed-Ibrahim  staff  212486097 Oct 17 14:11 ca-offline-win.exe
drwxrwxr-x    3 Ahmed-Ibrahim  staff         96 Nov 30 03:01 config
drwxrwxr-x    5 Ahmed-Ibrahim  staff        160 Nov 30 03:01 docs
drwxrwxr-x  102 Ahmed-Ibrahim  staff       3264 Nov 30 03:01 images
-rw-rw-r--    1 Ahmed-Ibrahim  staff       1230 Oct 17 14:11 install.ps1
-rwxr-xr-x    1 Ahmed-Ibrahim  staff       1476 Oct 17 14:11 install.sh
-rw-rw-r--    1 Ahmed-Ibrahim  staff         84 Oct 17 14:24 run.bat
-rwxr-xr-x    1 Ahmed-Ibrahim  staff        141 Dec 19 04:40 run.sh
drwxr-xr-x   18 root           staff        576 Dec 21 15:28 tomcat
drwxrwxr-x   29 Ahmed-Ibrahim  staff        928 Nov 30 02:59 workspace

so I had to change the permissions using the following command Ahmed-Ibrahim@Breadfasts-MacBook-Pro CAAppOffline % ls -la Then I tried to run the run.sh script and here is the outcome

Ahmed-Ibrahim@Breadfasts-MacBook-Pro CAAppOffline % sh run.sh    
Using CATALINA_BASE:   /Users/Ahmed-Ibrahim/DevLab/IBM/cogarch/Community-Edition-3.17.0/CAAppOffline/tomcat
Using CATALINA_HOME:   /Users/Ahmed-Ibrahim/DevLab/IBM/cogarch/Community-Edition-3.17.0/CAAppOffline/tomcat
Using CATALINA_TMPDIR: /Users/Ahmed-Ibrahim/DevLab/IBM/cogarch/Community-Edition-3.17.0/CAAppOffline/tomcat/temp
Using JRE_HOME:        ../jre/Contents/Home
Using CLASSPATH:       /Users/Ahmed-Ibrahim/DevLab/IBM/cogarch/Community-Edition-3.17.0/CAAppOffline/tomcat/bin/bootstrap.jar:/Users/Ahmed-Ibrahim/DevLab/IBM/cogarch/Community-Edition-3.17.0/CAAppOffline/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:   
touch: /Users/Ahmed-Ibrahim/DevLab/IBM/cogarch/Community-Edition-3.17.0/CAAppOffline/tomcat/logs/catalina.out: Permission denied
/Users/Ahmed-Ibrahim/DevLab/IBM/cogarch/Community-Edition-3.17.0/CAAppOffline/tomcat/bin/catalina.sh: line 504: /Users/Ahmed-Ibrahim/DevLab/IBM/cogarch/Community-Edition-3.17.0/CAAppOffline/tomcat/logs/catalina.out: Permission denied
run.sh: line 11: ./ca-offline-macos: Bad CPU type in executable

Then finally I tried to use sudo again .. and here is the outcome .. with no luck

Ahmed-Ibrahim@Breadfasts-MacBook-Pro CAAppOffline % sudo ./run.sh
Using CATALINA_BASE:   /Users/Ahmed-Ibrahim/DevLab/IBM/cogarch/Community-Edition-3.17.0/CAAppOffline/tomcat
Using CATALINA_HOME:   /Users/Ahmed-Ibrahim/DevLab/IBM/cogarch/Community-Edition-3.17.0/CAAppOffline/tomcat
Using CATALINA_TMPDIR: /Users/Ahmed-Ibrahim/DevLab/IBM/cogarch/Community-Edition-3.17.0/CAAppOffline/tomcat/temp
Using JRE_HOME:        ../jre/Contents/Home
Using CLASSPATH:       /Users/Ahmed-Ibrahim/DevLab/IBM/cogarch/Community-Edition-3.17.0/CAAppOffline/tomcat/bin/bootstrap.jar:/Users/Ahmed-Ibrahim/DevLab/IBM/cogarch/Community-Edition-3.17.0/CAAppOffline/tomcat/bin/tomcat-juli.jar
Using CATALINA_OPTS:   
Tomcat started.
./run.sh: line 11: ./ca-offline-macos: Bad CPU type in executable
abou7abiba commented 7 months ago

I was able to fix the problem following the instructions in the article "Fix for MacBook Air M1/M2 — ‘Bad CPU type in executable’ Error"

Please note that you need the command using double dash not as one dash as the following:

--install-rosetta --agree-to-license

so the command should be:

/usr/sbin/softwareupdate --install-rosetta --agree-to-license