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

quazar
How to set Jason to encode all fields in ecto schema, I don’t care about security and implementing only is taking long list of attributes...
New
sacepums
Hey guys. I'm new to elixir and im really stocked about it. But I ran into a bit of problem - I need to convert a date sting, for examp...
New
chensan
I have a User schema with a :from_id field set to type :string: defmodule TweetBot.Repo.Migrations.CreateUsers do use Ecto.Migration ...
New
rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list....
New
gonzofish
I’m currently trying to understand how to join three tables using Ecto. All the examples I’ve seen use 2, so maybe I’m just missing somet...
New
vonH
When I run the Plug and I recompile I wind up having to use Ctrl C to quit iex and start again. Witht the help of rlwrap I can use the cu...
New
electic
Hi, I am new to Elixir. I am trying to use the DateTime component to insert a date into MySQL however the there seems to be no way to fo...
New
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
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New
joeerl
Hello again - after a longish gap I’ve decided I really must dig into Elixir and see what’s been happening here - so I have a few questio...
New

Other popular topics Top

bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
albydarned
Hello all! I am typing this post from my new MacBook Pro with the M1 chip. I’m loving it so far, and will probably use it as my daily dr...
New
aalberti333
As the title describes, I’m trying to run Enum.map() over a list of key/value pairs, where the value is a map. My data looks like this: ...
New
sergio
I couldn’t find any guides that worked well with Phoenix 1.6.0 and esbuild. I hope this helps people test the waters and eases you into t...
New
chrismccord
This release brings a number of exciting features, including integration with the new Phoenix LiveDashboard and Phoenix LiveView. There h...
New
freewebwithme
Using vs code and installed ElixirLS: support and debugger. And I got an error popped up on start up says Failed to run ‘elixir’ comma...
New
ovidiubadita
Hey all, I discovered Elixir and I love it. I always wanted to learn a functional programming and I intended to go for Haskell, but afte...
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
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> someth...
New
9mm
I am constructing a JSON object (map) and I need to conditionally set a field. I’m trying to write proper elixir-way code… and I’m at a l...
New

We're in Beta

About us Mission Statement