The arrival of Apple’s latest ARM-based M1 chip has been a remarkable leap forward not only for Apple but for developers, designers, and other professionals around the world using Apple hardware, promising with adverse effects when running applications. Despite its outperforming capacity, it seems to experience some incompatible issues with various programming environments, which most users are worried about and trying to figure out alternative ways to crack them to keep working with their new Macs.

 

As an M1 user, I have also faced some coding problems caused by its architecture, where I had to spend hours of my time to find working solutions to progress with my tasks, where I was lucky sometimes and wasn’t.

 

I attempted to set up Circle CI locally in my Mac and run Cypress tests to ensure their perfect execution before pushing to Circle CI cloud. I did this to measure cost reduction and efficiency since Circle CI cloud runs all the available tests to ensure such code addition would not fail in the program flow. But of course, we will incur a considerable cost as it runs continuously at each push with changes. (For more information on Circle CI, pls visit https://circleci.com/).

 

During an attempt to build a cypress image using docker for the above purpose, an error stated a failure to read “npx cypress run” in the following docker file. However, this attempt successfully worked on a Mac with an intel chip for the record.

 

Config.yml file 

Docker file 

version: 2.1 

orbs: 

cypress: cypress-io/cypress@1 

executors: 

latest-chrome: 

docker: 

– image: “cypress-test-image:1.0.0” 

workflows: 

build: 

jobs: 

– cypress/run: 

executor: latest-chrome 

browser: chrome 

spec: 

“cypress/integration/test.spec.js” 

 

FROM cypress/included:9.0.0 

WORKDIR /app 

COPY ./cypress ./cypress 

COPY ./cypress.json ./cypress.json 

RUN npx cypress run 

 

Attempts tried with to solve the problem 

1. docker build -t cypress-test-image:1.0.0 .  

2. docker build -t cypress-test-image:1.0.0 –platform linux/arm64/v8 . 

3. docker build -t cypress-test-image:1.0.0 –platform linux/arm64/v8 –no-cache . 

4. Trying with Docker Desktop for Apple Silicon  

(For more information – https://docs.docker.com/desktop/mac/apple-silicon/

Each attempt was conducted replacing RUN npx cypress run by CMD [“npx”, “cypress”, “open”] as well, but not worked. 

 

Running Cypress using Intel emulation with Rosetta 2 seemed a promising solution for the problem. Still, I didn’t implement it since downgrading the existing OS version from Monetary to Rosetta 2 and running it via a virtual machine might potentially fail other set dependencies of the program, hence generating more complex issues.  

(For more information – https://www.cypress.io/blog/2021/01/20/running-cypress-on-the-apple-m1-silicon-arm-architecture-using-rosetta-2/

 

In conclusion, working on this problem for hours convinced me that, despite many users having already raised it in various Q&A platforms, it didn’t provide a solid answer yet. So ultimately, the particular task had to be implemented using a Mac with an Intel processor, giving it up on M1 Mac having the problem remained unsolved. 

— Dushan Anuradha, QA Automation Engineer, NIMI

 


 

Who will say no to upgrades in today’s world? Especially the people who are constantly engaging with technology. Yes, Software engineers and people working in IT sectors always love to keep themselves and their working devices up to date. So with the release of Apple-branded M1 devices, it’s a piece of great news for tech geeks to try out somehow. I’m happy to say that I’m one of the luckiest to use the M1 device for my work. But when improvements happen in the technology, we can expect some constraints too. 

 

I faced such a problem when I set up multiple projects on my MacBook. Which became a big headache and took some days to find a proper solution. The project that I work on requires multiple libraries and dependencies. One of the essential libraries used in the project is psycopg2. Psycopg2 is an adapter to create and maintain the database connection between Python and PostgreSQL. The team used a stable version of psycopg2 in the projects, which is unsupported for M1 devices for some reason. When we try installing required dependencies in the machine, it always gives this error message:

ld: library not found for -lssl  

 

A few engineers faced this issue since most of the engineers are using intel chip-based processors. So, I tried these steps initially to overcome the problem, 

  • Tried to link ssl brew link openssl (this solution given in the workstation setup) 
  • And tried to clean install python and psycopg2  

But unfortunately, those steps didn’t work out to fix the problem. I did Surf the internet to find a solution, but a few references are available on the internet for this issue. In the meantime, one of my teammates also faced the same problem on his M1 Device. So decided to find a proper solution to fix this permanently after hours of research on the internet and guidelines provided by the company. So finally, we came to a solution to fix this psycopg2 issue.

 

Steps followed to fix the issue and install the library are, 

  • brew install openssl 
  • brew link openssl 
  • Add to ~.zprofile 
  • export LDFLAGS=”-L/usr/local/opt/openssl/lib” 
  • export CPPFLAGS=”-I/usr/local/opt/openssl/include” 
  • poetry update / poetry install 

 

— Krishanth Shanthikumar, Senior Software Engineer, NIMI