Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake build err in Mac OS Catalina 10.15.6 #207

Closed
hu5980 opened this issue Oct 17, 2020 · 9 comments
Closed

cmake build err in Mac OS Catalina 10.15.6 #207

hu5980 opened this issue Oct 17, 2020 · 9 comments

Comments

@hu5980
Copy link

hu5980 commented Oct 17, 2020

Undefined symbols for architecture x86_64:
"_FT_Done_Face", referenced from:
_main in text_rendering.cpp.o
"_FT_Done_FreeType", referenced from:
_main in text_rendering.cpp.o
"_FT_Init_FreeType", referenced from:
_main in text_rendering.cpp.o
"_FT_Load_Char", referenced from:
_main in text_rendering.cpp.o
"_FT_New_Face", referenced from:
_main in text_rendering.cpp.o
"_FT_Set_Pixel_Sizes", referenced from:
_main in text_rendering.cpp.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[2]: *** [../bin/7.in_practice/7.in_practice__2.text_rendering] Error 1
make[1]: *** [CMakeFiles/7.in_practice__2.text_rendering.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

@hu5980
Copy link
Author

hu5980 commented Oct 17, 2020

change cmakelists.txt

SET(APPLE_LIBS ${APPLE_LIBS} ${GLFW3_LIBRARY} ${ASSIMP_LIBRARY} ${FREETYPE_LIBRARIES})

@hu5980 hu5980 closed this as completed Oct 17, 2020
rbarkmore added a commit to rbarkmore/LearnOpenGL that referenced this issue Nov 28, 2020
@rbarkmore
Copy link
Contributor

@hu5980 if you have a chance, please try compiling the branch of PR #215 and please report the results, good or bad. Since I don't have access to Mac OS, I can't test the effect of this PR. Thank you in advance.

@tainzhi
Copy link

tainzhi commented Dec 8, 2020

I have tested it failed. My environmment is Mac OS 10.14.6 on HacMac

After I added freetype to CMakeLists.txt and installed freetype, the same compiled error is still there.

@rbarkmore
Copy link
Contributor

@tainzhi can you please post the error messages? Thanks.

@upupming
Copy link

Also, make sure to add:

find_package(Freetype REQUIRED)

@tainzhi
Copy link

tainzhi commented Dec 18, 2020

@upupming solution works. Thanks very much.
@rbarkmore Thanks for your kind help, too

@noobxiaohai
Copy link

SET(APPLE_LIBS ${APPLE_LIBS} ${GLFW3_LIBRARY} ${ASSIMP_LIBRARY} ${FREETYPE_LIBRARIES})

my mac system version is 10.15.7, I added ${FREETYPE_LIBRARIES} this in CMakeList.txt, but the same error exists,what can I do?

@noobxiaohai
Copy link

Also, make sure to add:

find_package(Freetype REQUIRED)

@tainzhi @upupming
which line in CMakeList.txt do I need to add 'find_package(Freetype REQUIRED)'?

when I add find here

# find the required packages
find_package(GLM REQUIRED)
message(STATUS "GLM included at ${GLM_INCLUDE_DIR}")
find_package(GLFW3 REQUIRED)
message(STATUS "Found GLFW3 in ${GLFW3_INCLUDE_DIR}")
find_package(ASSIMP REQUIRED)
message(STATUS "Found ASSIMP in ${ASSIMP_INCLUDE_DIR}")
# find_package(SOIL REQUIRED)
# message(STATUS "Found SOIL in ${SOIL_INCLUDE_DIR}")
# find_package(GLEW REQUIRED)
# message(STATUS "Found GLEW in ${GLEW_INCLUDE_DIR}")
find_package(Freetype REQUIRED)

this error appeared when i do 'make ../.'

xiaohai:build xiao$ cmake ../.
-- GLM_INCLUDE_DIR = /usr/local/include
-- GLM included at /usr/local/include
-- Found GLFW3 in /usr/local/include
-- Found ASSIMP: /usr/local/lib/libassimp.dylib
-- Found ASSIMP in /usr/local/include
CMake Error at /usr/local/Cellar/cmake/3.16.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:146 (message):
Could NOT find Freetype (missing: FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS)
Call Stack (most recent call first):
/usr/local/Cellar/cmake/3.16.4/share/cmake/Modules/FindPackageHandleStandardArgs.cmake:393 (_FPHSA_FAILURE_MESSAGE)
/usr/local/Cellar/cmake/3.16.4/share/cmake/Modules/FindFreetype.cmake:157 (find_package_handle_standard_args)
CMakeLists.txt:31 (find_package)

-- Configuring incomplete, errors occurred!

@tainzhi
Copy link

tainzhi commented Feb 10, 2021

you should add find_package(Freetype REQUIRED) at the apple ifelse branch, just before the line SET(APPLE_LIBS ${APPLE_LIBS} ${GLFW3_LIBRARY} ${ASSIMP_LIBRARY} ${FREETYPE_LIBRARIES}), such as line 50.

the git diff is as below

diff --git a/CMakeLists.txt b/CMakeLists.txt
index a60f028..a5e7fc0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -46,9 +46,10 @@ elseif(APPLE)
   FIND_LIBRARY(OpenGL_LIBRARY OpenGL)
   FIND_LIBRARY(IOKit_LIBRARY IOKit)
   FIND_LIBRARY(CoreVideo_LIBRARY CoreVideo)
+  FIND_PACKAGE(Freetype REQUIRED)
   MARK_AS_ADVANCED(COCOA_LIBRARY OpenGL_LIBRARY)
   SET(APPLE_LIBS ${COCOA_LIBRARY} ${IOKit_LIBRARY} ${OpenGL_LIBRARY} ${CoreVideo_LIBRARY})
-  SET(APPLE_LIBS ${APPLE_LIBS} ${GLFW3_LIBRARY} ${ASSIMP_LIBRARY})
+  SET(APPLE_LIBS ${APPLE_LIBS} ${GLFW3_LIBRARY} ${ASSIMP_LIBRARY} ${FREETYPE_LIBRARIES})
   set(LIBS ${LIBS} ${APPLE_LIBS})
 else()
   set(LIBS )
(END)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants