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

Tee
can someone please explain to me how Enum.reduce works with maps
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
makeitrein
Hey all, just started picking up Elixir last week and am writing a scraper as a learning project. Baby step #1 is extracting the number ...
New
minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
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
hpopp
To simplify some tasks at work, I wrote and published this package yesterday. It’s a simple macro that enables Access behaviour on struct...
New
beno
I will often find my self writing things similar to: case some_value do nil -> something() "" -> something() _ -> someth...
New
Fl4m3Ph03n1x
About me? ( if you have nothing better to do than reading about some random guy in the internet :stuck_out_tongue: ) Hello all, this is ...
New
jc00ke
Expanding on this topic: https://forum.elixirforum.net/t/map-typespec-question/19217 Let’s say I have a map with required and optional k...
New
jay1
Why is it that the mnesia database isn’t the most preferred database for use in Elixir/Phoenix?
New

Other popular topics Top

yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
shahryarjb
Hello, I get Persian date from my client and convert it to normal calendar like this: def jalali_string_to_miladi_english_number(persi...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
joaquinalcerro
Hi there, I am working with Ecto-Postgresql and I need to call all of the records from a specific table but the table has 40,000 record...
New
sergio_101
I am VERY much an elixir newbie. I have taken one elixir course and one phoenix course on Udemy. During that course, I saw the instructor...
New
ycv005
I have followed this StackOverflow post to install the specific version of Erlang. And When I am running mix ecto.setup then getting fol...
New
vertexbuffer
Hello, can anybody help here..? I have a list of players and I what to delete an element, but every for loop the list is reverting to ori...
New
script
If I have a string “1000 cfu/ml” . I want to remove the characters and / and space . So the string is like this "1000" What is the ...
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
josevalim
Hi everyone, One of the features added to Elixir early on to help integration with Erlang code was the idea of overridable function defi...
New

We're in Beta

About us Mission Statement