JohnnyCurran

JohnnyCurran

Cannot Build `scenic_driver_local`

Hi,

I am trying to build a new nerves / scenic project but I cannot get scenic_driver_local to compile.

It appears to be some sort of architecture mis-match and I can’t pin down a solution.

Terminal is not running rosetta:

johnny@omega:$ arch
arm64

Elixir / Erlang versions:

elixir 1.17.1-otp-27
erlang 27.0

scenic_driver_local version: 0.11.0 (from mix.lock)

Here’s the full debug output:

johnny@omega:$ mix deps.compile scenic_driver_local
==> scenic_driver_local
Compiling 8 files (.ex)
    warning: single-quoted strings represent charlists. Use ~c"" if you indeed want a charlist or use "" instead
    │
 70 │   @port '/scenic_driver_local'
    │         ~
    │
    └─ lib/driver.ex:70:9

    warning: use Bitwise is deprecated. import Bitwise instead
    │
  9 │   use Bitwise
    │   ~~~~~~~~~~~
    │
    └─ lib/to_port.ex:9: Scenic.Driver.Local.ToPort (module)

     warning: Logger.warn/1 is deprecated. Use Logger.warning/2 instead
     │
 145 │     Logger.warn("scenic_driver_local: #{inspect(msg)}")
     │            ~
     │
     └─ lib/from_port.ex:145:12: Scenic.Driver.Local.FromPort.handle_port_message/2

Generated scenic_driver_local app
SCENIC_LOCAL_TARGET: glfw
mkdir -p /Users/johnny/src/nerves/omega/_build/dev/lib/scenic_driver_local/priv
cc -O3 -std=c99 `pkg-config --static --cflags glfw3 glew` -fPIC -o /Users/johnny/src/nerves/omega/_build/dev/lib/scenic_driver_local/priv/scenic_driver_local c_src/device/glfw.c c_src/main.c c_src/nanovg/nanovg.c c_src/comms.c c_src/unix_comms.c c_src/utils.c c_src/script.c c_src/image.c c_src/font.c c_src/tommyds/src/tommyhashlin.c c_src/tommyds/src/tommyhash.c `pkg-config --static --libs glfw3 glew` -framework Cocoa -framework OpenGL -Wno-deprecated
c_src/utils.c:18:20: warning: using the result of an assignment as a condition without parentheses [-Wparentheses]
   18 |   while( p_err_str = device_gl_error() ) {
      |          ~~~~~~~~~~^~~~~~~~~~~~~~~~~~~
c_src/utils.c:18:20: note: place parentheses around the assignment to silence this warning
   18 |   while( p_err_str = device_gl_error() ) {
      |                    ^
      |          (                            )
c_src/utils.c:18:20: note: use '==' to turn this assignment into an equality comparison
   18 |   while( p_err_str = device_gl_error() ) {
      |                    ^
      |                    ==
1 warning generated.
c_src/script.c:178:14: warning: expression result unused [-Wunused-value]
  178 |     default: size;
      |              ^~~~
c_src/script.c:180:1: warning: non-void function does not return a value in all control paths [-Wreturn-type]
  180 | }
      | ^
2 warnings generated.
ld: warning: ignoring file '/opt/homebrew/Cellar/glew/2.2.0_1/lib/libGLEW.2.2.0.dylib': found architecture 'arm64', required architecture 'x86_64'
ld: warning: ignoring file '/opt/homebrew/Cellar/glfw/3.4/lib/libglfw.3.4.dylib': found architecture 'arm64', required architecture 'x86_64'
Undefined symbols for architecture x86_64:
  "___glewActiveTexture", referenced from:
      _glnvg__renderFlush in glfw-dbdf0f.o
  "___glewAttachShader", referenced from:
      _glnvg__createShader in glfw-dbdf0f.o
  "___glewBindAttribLocation", referenced from:
      _glnvg__createShader in glfw-dbdf0f.o
  "___glewBindBuffer", referenced from:
      _glnvg__renderFlush in glfw-dbdf0f.o
      _glnvg__renderFlush in glfw-dbdf0f.o
  "___glewBlendFuncSeparate", referenced from:
      _glnvg__renderFlush in glfw-dbdf0f.o
  "___glewBufferData", referenced from:
      _glnvg__renderFlush in glfw-dbdf0f.o
  "___glewCompileShader", referenced from:
      _glnvg__createShader in glfw-dbdf0f.o
  "___glewCreateProgram", referenced from:
      _glnvg__createShader in glfw-dbdf0f.o
  "___glewCreateShader", referenced from:
      _glnvg__createShader in glfw-dbdf0f.o
  "___glewDeleteBuffers", referenced from:
      _glnvg__renderDelete in glfw-dbdf0f.o
  "___glewDeleteProgram", referenced from:
      _glnvg__renderDelete in glfw-dbdf0f.o
  "___glewDeleteShader", referenced from:
      _glnvg__renderDelete in glfw-dbdf0f.o
      _glnvg__renderDelete in glfw-dbdf0f.o
  "___glewDisableVertexAttribArray", referenced from:
      _glnvg__renderFlush in glfw-dbdf0f.o
  "___glewEnableVertexAttribArray", referenced from:
      _glnvg__renderFlush in glfw-dbdf0f.o
  "___glewGenBuffers", referenced from:
      _glnvg__renderCreate in glfw-dbdf0f.o
  "___glewGetProgramInfoLog", referenced from:
      _glnvg__createShader in glfw-dbdf0f.o
  "___glewGetProgramiv", referenced from:
      _glnvg__createShader in glfw-dbdf0f.o
  "___glewGetShaderInfoLog", referenced from:
      _glnvg__createShader in glfw-dbdf0f.o
      _glnvg__createShader in glfw-dbdf0f.o
  "___glewGetShaderiv", referenced from:
      _glnvg__createShader in glfw-dbdf0f.o
  "___glewGetUniformLocation", referenced from:
      _glnvg__renderCreate in glfw-dbdf0f.o
  "___glewLinkProgram", referenced from:
      _glnvg__createShader in glfw-dbdf0f.o
  "___glewShaderSource", referenced from:
      _glnvg__createShader in glfw-dbdf0f.o
  "___glewStencilOpSeparate", referenced from:
      _glnvg__renderFlush in glfw-dbdf0f.o
  "___glewUniform1i", referenced from:
      _glnvg__renderFlush in glfw-dbdf0f.o
  "___glewUniform2fv", referenced from:
      _glnvg__renderFlush in glfw-dbdf0f.o
  "___glewUniform4fv", referenced from:
      _glnvg__renderFlush in glfw-dbdf0f.o
      _glnvg__setUniforms in glfw-dbdf0f.o
  "___glewUseProgram", referenced from:
      _glnvg__renderFlush in glfw-dbdf0f.o
      _glnvg__renderFlush in glfw-dbdf0f.o
  "___glewVertexAttribPointer", referenced from:
      _glnvg__renderFlush in glfw-dbdf0f.o
  "_glewInit", referenced from:
      _setup_window in glfw-dbdf0f.o
  "_glfwCreateWindow", referenced from:
      _device_init in glfw-dbdf0f.o
  "_glfwGetCursorPos", referenced from:
      _mouse_button_callback in glfw-dbdf0f.o
      _scroll_callback in glfw-dbdf0f.o
      _cursor_enter_callback in glfw-dbdf0f.o
  "_glfwGetFramebufferSize", referenced from:
      _reshape_window in glfw-dbdf0f.o
      _setup_window in glfw-dbdf0f.o
  "_glfwGetWindowSize", referenced from:
      _setup_window in glfw-dbdf0f.o
      _device_init in glfw-dbdf0f.o
  "_glfwInit", referenced from:
      _device_init in glfw-dbdf0f.o
  "_glfwMakeContextCurrent", referenced from:
      _setup_window in glfw-dbdf0f.o
  "_glfwPollEvents", referenced from:
      _device_init in glfw-dbdf0f.o
      _device_poll in glfw-dbdf0f.o
  "_glfwSetCharModsCallback", referenced from:
      _setup_window in glfw-dbdf0f.o
  "_glfwSetCursorEnterCallback", referenced from:
      _setup_window in glfw-dbdf0f.o
  "_glfwSetCursorPosCallback", referenced from:
      _setup_window in glfw-dbdf0f.o
  "_glfwSetErrorCallback", referenced from:
      _device_init in glfw-dbdf0f.o
  "_glfwSetFramebufferSizeCallback", referenced from:
      _setup_window in glfw-dbdf0f.o
  "_glfwSetKeyCallback", referenced from:
      _setup_window in glfw-dbdf0f.o
  "_glfwSetMouseButtonCallback", referenced from:
      _setup_window in glfw-dbdf0f.o
  "_glfwSetScrollCallback", referenced from:
      _setup_window in glfw-dbdf0f.o
  "_glfwSetWindowCloseCallback", referenced from:
      _setup_window in glfw-dbdf0f.o
  "_glfwSetWindowShouldClose", referenced from:
      _window_close_callback in glfw-dbdf0f.o
  "_glfwSetWindowSize", referenced from:
      _device_init in glfw-dbdf0f.o
      _device_init in glfw-dbdf0f.o
  "_glfwSetWindowSizeCallback", referenced from:
      _setup_window in glfw-dbdf0f.o
  "_glfwSwapBuffers", referenced from:
      _device_end_render in glfw-dbdf0f.o
  "_glfwTerminate", referenced from:
      _device_init in glfw-dbdf0f.o
  "_glfwWindowHint", referenced from:
      _set_window_hints in glfw-dbdf0f.o
      _set_window_hints in glfw-dbdf0f.o
      _set_window_hints in glfw-dbdf0f.o
      _set_window_hints in glfw-dbdf0f.o
      _device_init in glfw-dbdf0f.o
      _device_init in glfw-dbdf0f.o
      _device_init in glfw-dbdf0f.o
      _device_init in glfw-dbdf0f.o
      ...
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [/Users/johnny/src/nerves/omega/_build/dev/lib/scenic_driver_local/priv/scenic_driver_local] Error 1
could not compile dependency :scenic_driver_local, "mix compile" failed. Errors may have been logged above. You can recompile this dependency with "mix deps.compile scenic_driver_local --force", update it with "mix deps.update scenic_driver_local" or clean it with "mix deps.clean scenic_driver_local"
==> omega
** (Mix) Could not compile with "make" (exit status: 2).
You need to have gcc and make installed. Try running the
commands "gcc --version" and / or "make --version". If these programs
are not installed, you will be prompted to install them.

Yes, make and gcc are installed:

johnny@omega:$ gcc --version
Apple clang version 16.0.0 (clang-1600.0.26.4)
Target: arm64-apple-darwin24.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
johnny@omega:$ make --version
GNU Make 3.81
Copyright (C) 2006  Free Software Foundation, Inc.
This is free software; see the source for copying conditions.
There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A
PARTICULAR PURPOSE.

This program built for i386-apple-darwin11.3.0

Homebrew is not running under Rosetta 2:

johnny@omega:$ brew config
HOMEBREW_VERSION: 4.4.4
ORIGIN: https://github.com/Homebrew/brew
HEAD: 824efa8836dc226aa92dbbf7404c1b4a66707cca
Last commit: 6 days ago
Core tap JSON: 10 Nov 16:58 UTC
Core cask tap JSON: 10 Nov 16:58 UTC
HOMEBREW_PREFIX: /opt/homebrew
HOMEBREW_CASK_OPTS: []
HOMEBREW_MAKE_JOBS: 10
Homebrew Ruby: 3.3.5 => /opt/homebrew/Library/Homebrew/vendor/portable-ruby/3.3.5/bin/ruby
CPU: 10-core 64-bit dunno
Clang: 16.0.0 build 1600
Git: 2.39.5 => /Applications/Xcode.app/Contents/Developer/usr/bin/git
Curl: 8.7.1 => /usr/bin/curl
macOS: 15.1-arm64
CLT: 15.0.1.0.2.5
Xcode: 16.1
Rosetta 2: false

I uninstalled all of the dependencies and re-installed but I keep hitting this road block.

Any help is greatly appreciated, thank you

Marked As Solved

JohnnyCurran

JohnnyCurran

The problem was with one or both of the CFLAGS or LDFLAGS env vars. I explicitly set them to:

export CFLAGS="-arch arm64 `pkg-config --static --cflags glfw3 glew`"
export LDFLAGS="-arch arm64 `pkg-config --static --libs glfw3 glew`"

and now it runs!

:slight_smile:

Where Next?

Popular in Questions Top

hariharasudhan94
lets say i have a sample like a = 20; b = 10; if (a > b) do {:ok, "a"} end if (a < b) do {:ok, b} end if (a == b) do {:ok, "equa...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
lessless
I believe there are people here who are dealing with CSV files import on the daily basis, and since Excel is a really popular tool there ...
New
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
jerry
Good day to you all. I have been struggling to get a query involving like and ilike to work. Can anyone assist me on this, please? pro...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Patoshizzle
After calling mix ecto.create I get this error: 17:00:32.162 [error] GenServer #PID<0.412.0> terminating ** (Postgrex.Error) FATAL...
New

Other popular topics Top

baxterw3b
Hi guys, i’m new in the Elixir world, and i have to say, that i love it! i’m having some problem to understand anonymous functions with ...
New
dogweather
I wrote this comment on r/haskell, and it’s not popular there. :wink: But I think I’m on to something… Haskell reminds me of Java, and e...
New
AstonJ
Seen any cool LiveView demos, sample apps or examples? Please post them here! :003:
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
SoCreat
i’m a new one to elixir which editor can i use vs code? or atom? Thanks! :smiley:
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement