Search code examples
macosqt5omnet++configureapple-m1

Can not install Omnetpp to M1 Big Surr


I can not install OMNET++ to my m1 Mac because configure script can't install qt libraries.

I get this classic error:

configure: error: Cannot build Qt apps, probably due to missing or too old Qt packages. Make sure Qt development packages are installed and newer than Qt 5.4. You can disable Qtenv by setting the WITH_QTENV variable to "no" in configure.user. 

Normally OMNET++ comes with its own QT5 libs bundled with it but for some reason it can not detect these libraries.

So I tried:

  • Using brew install qt and adding it to path
  • Manually downloading qt5 and adding it to path
  • source setenv from zsh then ./configure
  • . setenv from bash then ./configure

These didn't work so, I inspected config.log for further details. Which showed

ld: library not found for -lQt5Gui

Then I changed the line with code in configure script, which in at line 4721

QT_LIBS=${QT_LIBS:-"-lQt5Gui -lQt5Core -lQt5Widgets -lQt5PrintSupport -lQt5OpenGL $LDFLAG_LIBPATH$QT_INSTALL_LIBS -Wl,-rpath=$QT_INSTALL_LIBS"}

To this, by only changing the first lib.

QT_LIBS=${QT_LIBS:-"-L/opt/homebrew/Cellar/qt/5.15.2/lib -lQt5Core -lQt5Widgets -lQt5PrintSupport -lQt5OpenGL $LDFLAG_LIBPATH$QT_INSTALL_LIBS -Wl,-rpath=$QT_INSTALL_LIBS"}

Then it gave similar errors for Qt5Core Qt5Widgets Qt5PrintSupport Qt5OpenGL so I removed them and added frameworks folder. Finally I achieved this:

QT_LIBS=${QT_LIBS:-"-L/opt/homebrew/Cellar/qt/5.15.2/lib -L/opt/homebrew/Cellar/qt/5.15.2/Frameworks $LDFLAG_LIBPATH$QT_INSTALL_LIBS -Wl, -rpath=$QT_INSTALL_LIBS"}

Still gives me the same error. I am stuck.


Solution

  • For the moment, you should run omnet in x86 emulation mode. Start a shell window with:

    arch -x86_64 /bin/zsh --login
    

    And then configure and build OMNeT++ from there. You must run EVERYTHING from that shell.