Coder Social home page Coder Social logo

Comments (6)

matthiasdiener avatar matthiasdiener commented on June 2, 2024 1

This build script for mfem works for Mac M1: https://github.com/conda-forge/mfem-feedstock/blob/main/recipe/build.sh

Have you run make config when building mfem? It looks like it is trying to compile for x86 (see e.g. the warning for __builtin_ia32_paddd)

from glvis.

TobiasDuswald avatar TobiasDuswald commented on June 2, 2024 1

Hi all,

I'm running MFEM and GLVis on my M1 for a year and I never had any issues. I've tried different commits of both software packages and it always worked fine. Both, MFEM and GLVis are in my home folder, e.g. ~/mfem and ~/glvis. I compile both packages with cmake, e.g.

cd ~/mfem
mkdir build
cd build
cmake ..
make -j8

and

cd ~/glvis
mkdir build
cd build
cmake ..
make -j8

Note that GLVis requires a few external dependencies that can be installed via brew. The following list might not be exhaustive, but I believe I had to install the following packages:

  • sdl2
  • glew
  • glm
  • libpng
  • fontconfig

But Cmake should guide you through this process of installing missing dependencies (if there are any). This works on M1 without any problems. To run GLVis, I execute

glvis/build/glvis

in my home folder. Executing an MFEM example such as ex16 should then be able to communicate with the running GLVis server. E.g. try

cd ~/mfem/build/examples
make ex16
./ex16

Hope that helps, good luck!

from glvis.

tzanio avatar tzanio commented on June 2, 2024

Hi @supriome,

Unfortunately I don't have access to an M1 mac to try to reproduce this, but looking at the error this doesn't seem to be an issue inside GLVis.

I know other folks have gotten MFEM to work on M1 macs, see mfem/mfem#2273.

Does your MFEM build works, e.g. does "make test" work there?

from glvis.

tzanio avatar tzanio commented on June 2, 2024

ping: @matthiasdiener and @samuelpmishLLNL, in case you can help.

from glvis.

congunter avatar congunter commented on June 2, 2024

@supriome
I got the same error message, where MFEM would compile but glvis would not. Tried all of the solutions posted, as well as confirming homebrew and command line tools were up to date. The MFEM build was confirmed to be compiled for arm64. It seems to be a linking issue with clang via apple command line tools. The line where compilation fails on my M1 Mac is:

> g++ -O3 -std=c++11 -I../mfem-4.4 -DGLVIS_MULTISAMPLE=4 -DGLVIS_MS_LINEWIDTH=1.0 -DGLVIS_OGL3 -DGLVIS_USE_LOGO -I/opt/X11/include/freetype2 -I/usr/local/include -I/usr/local/include -I/opt/homebrew/include -DGLVIS_USE_LIBPNG -o lib/aux_vis.o -c lib/aux_vis.cpp

It seems that when using make or gmake, there is an issue with clang trying to compile with x86 for a few of the libraries, starting with libGL. Instead of compiling via llvm installed through homebrew, it tries to install with the apple command line version of clang. Here is the filepath for the first error thrown:

In file included from lib/gl/renderer.cpp:12:
In file included from lib/gl/renderer.hpp:20:
In file included from lib/gl/platform_gl.hpp:17:
In file included from /usr/local/include/SDL2/SDL.h:38:
In file included from /usr/local/include/SDL2/SDL_cpuinfo.h:102:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/immintrin.h:13:
In file included from /Library/Developer/CommandLineTools/usr/lib/clang/13.1.6/include/x86gprintrin.h:15:

I tried using:

> echo 'export PATH="/opt/homebrew/opt/llvm/bin:$PATH"' >> ~/.zshrc

which didn't fix the issue.

To fix this, I edited the makefile search path lines for glew, SDL2, gym, and OpenGL (lines 166, 172, 177, 178, and 182) to force compilation via llvm installed via homebrew:

166:      GLEW_SEARCH_PATHS =  $(BREW_PREFIX) $(abspath ../glew)

172:      SDL_SEARCH_PATHS :=  $(BREW_PREFIX) $(abspath ../SDL2)

177:      GLM_SEARCH_PATHS = \  

178:      $(if $(BREW_PREFIX), $(BREW_PREFIX)/include) $(abspath ../glm)

182:     OPENGL_SEARCH_PATHS = $(BREW_PREFIX) /usr /usr/local /opt/local

Compiled MFEM with:

> gmake serial -j 4

Compiled with GLVIS with:

> gmake MFEM_DIR=../mfem-4.4 -j 4

This is probably just a quick and dirty way to fix it, but it worked for me. I have tested and verified functionality with the MFEM examples. Also I did not try with cmake, so that might work.

from glvis.

tzanio avatar tzanio commented on June 2, 2024

Thank you @congunter

from glvis.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.