我想在Linux上構建一個共享庫的glfw庫。我已經開始克隆git repository。然後,根據this編譯指南,我在回購庫中創建了一個名爲glfw-build
的文件夾,並在其中創建了一個名爲cd
的文件夾。 Runnnig cmake ..
從那裏給人的輸出如何將glfw構建爲共享庫?
-- The C compiler identification is GNU 4.8.4
-- Check for working C compiler: /usr/bin/cc
-- Check for working C compiler: /usr/bin/cc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Looking for pthread_create in pthreads
-- Looking for pthread_create in pthreads - not found
-- Looking for pthread_create in pthread
-- Looking for pthread_create in pthread - found
-- Found Threads: TRUE
-- Could NOT find Doxygen (missing: DOXYGEN_EXECUTABLE)
-- Using X11 for window creation
-- Using GLX for context creation
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so
-- Looking for XOpenDisplay in /usr/lib/x86_64-linux-gnu/libX11.so;/usr/lib/x86_64-linux-gnu/libXext.so - found
-- Looking for gethostbyname
-- Looking for gethostbyname - found
-- Looking for connect
-- Looking for connect - found
-- Looking for remove
-- Looking for remove - found
-- Looking for shmat
-- Looking for shmat - found
-- Looking for IceConnectionNumber in ICE
-- Looking for IceConnectionNumber in ICE - found
-- Found X11: /usr/lib/x86_64-linux-gnu/libX11.so
-- Configuring done
-- Generating done
-- Build files have been written to: /home/<user>/lib-sources/glfw/glfw-build
運行make
,讓
Scanning dependencies of target glfw
[ 1%] Building C object src/CMakeFiles/glfw.dir/context.c.o
[ 2%] Building C object src/CMakeFiles/glfw.dir/init.c.o
[ 4%] Building C object src/CMakeFiles/glfw.dir/input.c.o
[ 5%] Building C object src/CMakeFiles/glfw.dir/monitor.c.o
[ 7%] Building C object src/CMakeFiles/glfw.dir/window.c.o
[ 8%] Building C object src/CMakeFiles/glfw.dir/x11_init.c.o
[ 9%] Building C object src/CMakeFiles/glfw.dir/x11_monitor.c.o
[ 11%] Building C object src/CMakeFiles/glfw.dir/x11_window.c.o
[ 12%] Building C object src/CMakeFiles/glfw.dir/xkb_unicode.c.o
[ 14%] Building C object src/CMakeFiles/glfw.dir/linux_joystick.c.o
[ 15%] Building C object src/CMakeFiles/glfw.dir/posix_time.c.o
[ 16%] Building C object src/CMakeFiles/glfw.dir/posix_tls.c.o
[ 18%] Building C object src/CMakeFiles/glfw.dir/glx_context.c.o
Linking C static library libglfw3.a
[ 18%] Built target glfw
Scanning dependencies of target boing
[ 19%] Building C object examples/CMakeFiles/boing.dir/boing.c.o
[ 21%] Building C object examples/CMakeFiles/boing.dir/__/deps/glad.c.o
Linking C executable boing
[ 21%] Built target boing
Scanning dependencies of target gears
[ 22%] Building C object examples/CMakeFiles/gears.dir/gears.c.o
[ 23%] Building C object examples/CMakeFiles/gears.dir/__/deps/glad.c.o
Linking C executable gears
[ 23%] Built target gears
Scanning dependencies of target heightmap
[ 25%] Building C object examples/CMakeFiles/heightmap.dir/heightmap.c.o
[ 26%] Building C object examples/CMakeFiles/heightmap.dir/__/deps/glad.c.o
Linking C executable heightmap
[ 26%] Built target heightmap
Scanning dependencies of target particles
[ 28%] Building C object examples/CMakeFiles/particles.dir/particles.c.o
[ 29%] Building C object examples/CMakeFiles/particles.dir/__/deps/tinycthread.c.o
[ 30%] Building C object examples/CMakeFiles/particles.dir/__/deps/getopt.c.o
[ 32%] Building C object examples/CMakeFiles/particles.dir/__/deps/glad.c.o
Linking C executable particles
[ 32%] Built target particles
Scanning dependencies of target simple
[ 33%] Building C object examples/CMakeFiles/simple.dir/simple.c.o
[ 35%] Building C object examples/CMakeFiles/simple.dir/__/deps/glad.c.o
Linking C executable simple
[ 35%] Built target simple
Scanning dependencies of target splitview
[ 36%] Building C object examples/CMakeFiles/splitview.dir/splitview.c.o
[ 38%] Building C object examples/CMakeFiles/splitview.dir/__/deps/glad.c.o
Linking C executable splitview
[ 38%] Built target splitview
Scanning dependencies of target wave
[ 39%] Building C object examples/CMakeFiles/wave.dir/wave.c.o
[ 40%] Building C object examples/CMakeFiles/wave.dir/__/deps/glad.c.o
Linking C executable wave
[ 40%] Built target wave
Scanning dependencies of target clipboard
[ 42%] Building C object tests/CMakeFiles/clipboard.dir/clipboard.c.o
[ 43%] Building C object tests/CMakeFiles/clipboard.dir/__/deps/getopt.c.o
[ 45%] Building C object tests/CMakeFiles/clipboard.dir/__/deps/glad.c.o
Linking C executable clipboard
[ 45%] Built target clipboard
Scanning dependencies of target cursor
[ 46%] Building C object tests/CMakeFiles/cursor.dir/cursor.c.o
[ 47%] Building C object tests/CMakeFiles/cursor.dir/__/deps/glad.c.o
Linking C executable cursor
[ 47%] Built target cursor
Scanning dependencies of target empty
[ 49%] Building C object tests/CMakeFiles/empty.dir/empty.c.o
[ 50%] Building C object tests/CMakeFiles/empty.dir/__/deps/tinycthread.c.o
[ 52%] Building C object tests/CMakeFiles/empty.dir/__/deps/glad.c.o
Linking C executable empty
[ 52%] Built target empty
Scanning dependencies of target events
[ 53%] Building C object tests/CMakeFiles/events.dir/events.c.o
[ 54%] Building C object tests/CMakeFiles/events.dir/__/deps/getopt.c.o
[ 56%] Building C object tests/CMakeFiles/events.dir/__/deps/glad.c.o
Linking C executable events
[ 56%] Built target events
Scanning dependencies of target gamma
[ 57%] Building C object tests/CMakeFiles/gamma.dir/gamma.c.o
[ 59%] Building C object tests/CMakeFiles/gamma.dir/__/deps/getopt.c.o
[ 60%] Building C object tests/CMakeFiles/gamma.dir/__/deps/glad.c.o
Linking C executable gamma
[ 60%] Built target gamma
Scanning dependencies of target glfwinfo
[ 61%] Building C object tests/CMakeFiles/glfwinfo.dir/glfwinfo.c.o
[ 63%] Building C object tests/CMakeFiles/glfwinfo.dir/__/deps/getopt.c.o
[ 64%] Building C object tests/CMakeFiles/glfwinfo.dir/__/deps/glad.c.o
Linking C executable glfwinfo
[ 64%] Built target glfwinfo
Scanning dependencies of target iconify
[ 66%] Building C object tests/CMakeFiles/iconify.dir/iconify.c.o
[ 67%] Building C object tests/CMakeFiles/iconify.dir/__/deps/getopt.c.o
[ 69%] Building C object tests/CMakeFiles/iconify.dir/__/deps/glad.c.o
Linking C executable iconify
[ 69%] Built target iconify
Scanning dependencies of target joysticks
[ 70%] Building C object tests/CMakeFiles/joysticks.dir/joysticks.c.o
[ 71%] Building C object tests/CMakeFiles/joysticks.dir/__/deps/glad.c.o
Linking C executable joysticks
[ 71%] Built target joysticks
Scanning dependencies of target monitors
[ 73%] Building C object tests/CMakeFiles/monitors.dir/monitors.c.o
[ 74%] Building C object tests/CMakeFiles/monitors.dir/__/deps/getopt.c.o
[ 76%] Building C object tests/CMakeFiles/monitors.dir/__/deps/glad.c.o
Linking C executable monitors
[ 76%] Built target monitors
Scanning dependencies of target msaa
[ 77%] Building C object tests/CMakeFiles/msaa.dir/msaa.c.o
[ 78%] Building C object tests/CMakeFiles/msaa.dir/__/deps/getopt.c.o
[ 80%] Building C object tests/CMakeFiles/msaa.dir/__/deps/glad.c.o
Linking C executable msaa
[ 80%] Built target msaa
Scanning dependencies of target reopen
[ 81%] Building C object tests/CMakeFiles/reopen.dir/reopen.c.o
[ 83%] Building C object tests/CMakeFiles/reopen.dir/__/deps/glad.c.o
Linking C executable reopen
[ 83%] Built target reopen
Scanning dependencies of target sharing
[ 84%] Building C object tests/CMakeFiles/sharing.dir/sharing.c.o
[ 85%] Building C object tests/CMakeFiles/sharing.dir/__/deps/glad.c.o
Linking C executable sharing
[ 85%] Built target sharing
Scanning dependencies of target tearing
[ 87%] Building C object tests/CMakeFiles/tearing.dir/tearing.c.o
[ 88%] Building C object tests/CMakeFiles/tearing.dir/__/deps/getopt.c.o
[ 90%] Building C object tests/CMakeFiles/tearing.dir/__/deps/glad.c.o
Linking C executable tearing
[ 90%] Built target tearing
Scanning dependencies of target threads
[ 91%] Building C object tests/CMakeFiles/threads.dir/threads.c.o
[ 92%] Building C object tests/CMakeFiles/threads.dir/__/deps/tinycthread.c.o
[ 94%] Building C object tests/CMakeFiles/threads.dir/__/deps/glad.c.o
Linking C executable threads
[ 94%] Built target threads
Scanning dependencies of target title
[ 95%] Building C object tests/CMakeFiles/title.dir/title.c.o
[ 97%] Building C object tests/CMakeFiles/title.dir/__/deps/glad.c.o
Linking C executable title
[ 97%] Built target title
Scanning dependencies of target windows
[ 98%] Building C object tests/CMakeFiles/windows.dir/windows.c.o
[100%] Building C object tests/CMakeFiles/windows.dir/__/deps/glad.c.o
Linking C executable windows
[100%] Built target windows
後運行sudo make install
然後直接給
[ 18%] Built target glfw
[ 21%] Built target boing
[ 23%] Built target gears
[ 26%] Built target heightmap
[ 32%] Built target particles
[ 35%] Built target simple
[ 38%] Built target splitview
[ 40%] Built target wave
[ 45%] Built target clipboard
[ 47%] Built target cursor
[ 52%] Built target empty
[ 56%] Built target events
[ 60%] Built target gamma
[ 64%] Built target glfwinfo
[ 69%] Built target iconify
[ 71%] Built target joysticks
[ 76%] Built target monitors
[ 80%] Built target msaa
[ 83%] Built target reopen
[ 85%] Built target sharing
[ 90%] Built target tearing
[ 94%] Built target threads
[ 97%] Built target title
[100%] Built target windows
Install the project...
-- Install configuration: ""
-- Installing: /usr/local/include/GLFW
-- Installing: /usr/local/include/GLFW/glfw3.h
-- Installing: /usr/local/include/GLFW/glfw3native.h
-- Installing: /usr/local/lib/cmake/glfw/glfw3Config.cmake
-- Installing: /usr/local/lib/cmake/glfw/glfw3ConfigVersion.cmake
-- Installing: /usr/local/lib/cmake/glfw/glfwTargets.cmake
-- Installing: /usr/local/lib/cmake/glfw/glfwTargets-noconfig.cmake
-- Installing: /usr/local/lib/pkgconfig/glfw3.pc
-- Installing: /usr/local/lib/libglfw3.a
我似乎得到的是一個一個文件,即靜態庫,但如前所述,我需要一個共享庫,即so-file。
爲什麼我不能得到這樣的文件;應該不是默認的?我怎麼能得到這個?
謝謝,運行參數'-DBUILD_SHARED_LIBS = ON'的cmake工作! :) – HelloGoodbye