Revery: undefined reference to `FT_Init_FreeType' on Mac

Created on 18 Jan 2019  路  13Comments  路  Source: revery-ui/revery

Run esy build on my Mac and I get the following error:

    # esy-build-package: running: './esy/test.sh'
    /Users/yanxichen/.esy/3_______________________________________________________________/b/esy_freetype2-2.9.1001-713c4fa9
    /usr/local/bin/x86_64-w64-mingw32-gcc
    Using compiler: x86_64-w64-mingw32-gcc
    include...
    .
    ..
    freetype
    ft2build.h
    lib..
    .
    ..
    cmake
    libfreetype.a
    pkgconfig
    /tmp/ccZKzoej.o:test.c:(.text+0x15): undefined reference to `FT_Init_FreeType'
    collect2: error: ld returned 1 exit status
    ./esy/test.sh: line 21: ./test: No such file or directory
    error: command failed: './esy/test.sh' (exited with 127)
    esy-build-package: exiting with errors above...

  building [email protected]
esy: exiting due to errors above

FreeType 2.9.1 is already installed by brew install freetype.

My Mac version: 10.14.2

bug

Most helpful comment

Great the latest master works! Thank you so much for the help!

All 13 comments

Any help?

Hmm. did you esy install already? Looks like there's some esy packages missing.

@OhadRau Yeah esy install is fine but but esy build.

Is it normal that it uses the mingw32 compiler?
The problem may come from there.

/usr/local/bin/x86_64-w64-mingw32-gcc
Using compiler: x86_64-w64-mingw32-gcc

@Musikid That could be.. How do I configure the compiler when using esy build?

Ok so @MusiKid you are right that x86_64-w64-mingw32-gcc is the issue with esy-freetype. In esy-freetype package ./esy/test.sh I see the following:

  1 if which x86_64-w64-mingw32-gcc; then
  2    娄CC=x86_64-w64-mingw32-gcc
  3    娄CCLIB=
  4 else
  5    娄CC=gcc
  6    娄CCLIB="-lbz2 -lpng -lz"
  7 fi

Somehow my Mac does have x86_64-w64-mingw32-gcc installed so it uses that which it shouldn't be. So I think this is a bug in esy-freetype, whose maintainer is also @bryphe is that correct?

And unfortunately after bypassing the esy-freetype issue by temporally removing my x86_64-w64-mingw32-gcc, I got another error saying:


      "_glfwTerminate", referenced from:
          _caml_glfwTerminate in libreglfw_stubs.a(glfw_wrapper.o)
         (maybe you meant: _caml_glfwTerminate)
      "_glfwWindowHint", referenced from:
          _caml_glfwWindowHint in libreglfw_stubs.a(glfw_wrapper.o)
         (maybe you meant: _caml_glfwWindowHint)
      "_glfwWindowShouldClose", referenced from:
          _caml_glfwWindowShouldClose in libreglfw_stubs.a(glfw_wrapper.o)
         (maybe you meant: _caml_glfwWindowShouldClose)
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    File "caml_startup", line 1:
    Error: Error during linking
    error: command failed: 'dune' 'build' '--root' '.' (exited with 1)
    esy-build-package: exiting with errors above...

  building [email protected]
esy: exiting due to errors above

The error is too long to paste here. reason-glfw is also a package of @bryphe . Could you provide some more information as the main package maintainer whether I did something wrong or this is indeed an issue with your package(s)? Thanks!

Thanks for all the help troubleshooting! @jaredly helped me on the Discord too (had the same issue).

Indeed, @MusiKid and @SeraphRoy those checks are wrong - nice find - they're assuming only Windows has the x86_64-w64-mingw32-gcc, but turns out its pretty common to have that cross-compiler on OSX too.

I fixed those issues in freetype2 and harfbuzz, and pulled those fixes in Revery w/ #266 , which is in the latest master.

Could you please try pulling the latest and letting me know how it goes? Curious to see if those GLFW errors still reproduce.

Hi @bryphe thank you for your reply! After pulling the lastest master and build, the esy-freetype issue goes away but not GLFW. The error looks to me the same/similar but paste an excerpt here just in case:

      "_glfwSetWindowPos", referenced from:
          _caml_glfwSetWindowPos in libreglfw_stubs.a(glfw_wrapper.o)
         (maybe you meant: _caml_glfwSetWindowPos)
      "_glfwSetWindowSize", referenced from:
          _caml_glfwSetWindowSize in libreglfw_stubs.a(glfw_wrapper.o)
         (maybe you meant: _caml_glfwSetWindowSize, _caml_glfwSetWindowSizeCallback )
      "_glfwSetWindowSizeCallback", referenced from:
          _caml_glfwCreateWindow in libreglfw_stubs.a(glfw_wrapper.o)
         (maybe you meant: _caml_glfwSetWindowSizeCallback)
      "_glfwSetWindowTitle", referenced from:
          _caml_glfwSetWindowTitle in libreglfw_stubs.a(glfw_wrapper.o)
         (maybe you meant: _caml_glfwSetWindowTitle)
      "_glfwShowWindow", referenced from:
          _caml_glfwShowWindow in libreglfw_stubs.a(glfw_wrapper.o)
         (maybe you meant: _caml_glfwShowWindow)
      "_glfwSwapBuffers", referenced from:
          _caml_glfwSwapBuffers in libreglfw_stubs.a(glfw_wrapper.o)
         (maybe you meant: _caml_glfwSwapBuffers)
      "_glfwSwapInterval", referenced from:
          _caml_glfwSwapInterval in libreglfw_stubs.a(glfw_wrapper.o)
         (maybe you meant: _caml_glfwSwapInterval)
      "_glfwTerminate", referenced from:
          _caml_glfwTerminate in libreglfw_stubs.a(glfw_wrapper.o)
         (maybe you meant: _caml_glfwTerminate)
      "_glfwWindowHint", referenced from:
          _caml_glfwWindowHint in libreglfw_stubs.a(glfw_wrapper.o)
         (maybe you meant: _caml_glfwWindowHint)
      "_glfwWindowShouldClose", referenced from:
          _caml_glfwWindowShouldClose in libreglfw_stubs.a(glfw_wrapper.o)
         (maybe you meant: _caml_glfwWindowShouldClose)
    ld: symbol(s) not found for architecture x86_64
    clang: error: linker command failed with exit code 1 (use -v to see invocation)
    File "caml_startup", line 1:
    Error: Error during linking
        ocamlopt src/reglfw.cmxs
    ld: warning: ignoring file /Users/yanxichen/.esy/3_______________________________________________________________/i/esy_glfw-3.2.1008-c9039271/lib/libglfw3.a, file was built for archive which is not the architecture being linked (x86_64): /Users/yanxichen/.esy/3_______________________________________________________________/i/esy_glfw-3.2.1008-c9039271/lib/libglfw3.a
    error: command failed: 'dune' 'build' '--root' '.' (exited with 1)
    esy-build-package: exiting with errors above...

  building [email protected]
esy: exiting due to errors above

Also attached the .log (renamed to .txt as github doesn't allow me to upload with that suffix) and .info files in case you need them:

esy_glfw-3.2.1008-c9039271.log

esy_glfw-3.2.1008-c9039271.txt

Please ask if you need anything else. Thanks for the help!

Sorry the above means renaming .info to .txt but keeping .log the same.

Thanks @SeraphRoy for the logs, very helpful! I fixed esy-glfw to have a more robust check for Windows and am picking that up in #273 . Hopefully that's the last of these issues... 馃

Merged #273 - please try latest master and let me know how it goes.

Great the latest master works! Thank you so much for the help!

Wonderful - thanks for confirming @SeraphRoy!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

albertorestifo picture albertorestifo  路  3Comments

jericdeleon picture jericdeleon  路  3Comments

bryphe picture bryphe  路  5Comments

bryphe picture bryphe  路  5Comments

bryphe picture bryphe  路  5Comments