“未定义引用`aligned_alloc'”使用CLion构建GLFW测试'vulkan'时出错

时间:2017-09-16 10:52:57

标签: c opengl cmake glfw clion

我想从CLion的源代码构建GLFW。它成功构建了GLFW库,但总是无法使用下面的错误日志构建目标'vulkan'。

"E:\ide\CLion 2017.2.1\bin\cmake\bin\cmake.exe" --build E:\tool\glfw-3.2.1 --target vulkan -- -j 2
[ 92%] Built target glfw
Scanning dependencies of target vulkan
[ 92%] Building C object tests/CMakeFiles/vulkan.dir/vulkan.c.obj
E:\tool\glfw-3.2.1\tests\vulkan.c: In function 'myalloc':
E:\tool\glfw-3.2.1\tests\vulkan.c:1671:5: warning: implicit declaration of function 'aligned_alloc' [-Wimplicit-function-declaration]
     return aligned_alloc(alignment, size);
     ^
E:\tool\glfw-3.2.1\tests\vulkan.c:1671:5: warning: return makes pointer from integer without a cast
[100%] Linking C executable vulkan.exe
Warning: resolving _vkEndCommandBuffer@4 by linking to _vkEndCommandBuffer
Use --enable-stdcall-fixup to disable these warnings
Use --disable-stdcall-fixup to disable these fixups
Warning: resolving _vkQueueSubmit@20 by linking to _vkQueueSubmit
Warning: resolving _vkQueueWaitIdle@4 by linking to _vkQueueWaitIdle
Warning: resolving _vkFreeCommandBuffers@20 by linking to _vkFreeCommandBuffers
Warning: resolving _vkAllocateCommandBuffers@12 by linking to _vkAllocateCommandBuffers
Warning: resolving _vkBeginCommandBuffer@8 by linking to _vkBeginCommandBuffer
Warning: resolving _vkCmdPipelineBarrier@40 by linking to _vkCmdPipelineBarrier
Warning: resolving _vkCmdBeginRenderPass@12 by linking to _vkCmdBeginRenderPass
Warning: resolving _vkCmdBindPipeline@16 by linking to _vkCmdBindPipeline
Warning: resolving _vkCmdBindDescriptorSets@36 by linking to _vkCmdBindDescriptorSets
Warning: resolving _vkCmdSetViewport@16 by linking to _vkCmdSetViewport
Warning: resolving _vkCmdSetScissor@16 by linking to _vkCmdSetScissor
Warning: resolving _vkCmdBindVertexBuffers@20 by linking to _vkCmdBindVertexBuffers
Warning: resolving _vkCmdDraw@20 by linking to _vkCmdDraw
Warning: resolving _vkCmdEndRenderPass@4 by linking to _vkCmdEndRenderPass
Warning: resolving _vkCreateSemaphore@16 by linking to _vkCreateSemaphore
Warning: resolving _vkDestroySemaphore@16 by linking to _vkDestroySemaphore
Warning: resolving _vkCreateImageView@16 by linking to _vkCreateImageView
Warning: resolving _vkCreateImage@16 by linking to _vkCreateImage
Warning: resolving _vkGetImageMemoryRequirements@16 by linking to _vkGetImageMemoryRequirements
Warning: resolving _vkAllocateMemory@16 by linking to _vkAllocateMemory
Warning: resolving _vkBindImageMemory@28 by linking to _vkBindImageMemory
Warning: resolving _vkGetImageSubresourceLayout@20 by linking to _vkGetImageSubresourceLayout
Warning: resolving _vkMapMemory@36 by linking to _vkMapMemory
Warning: resolving _vkUnmapMemory@12 by linking to _vkUnmapMemory
Warning: resolving _vkDestroyImage@16 by linking to _vkDestroyImage
Warning: resolving _vkFreeMemory@16 by linking to _vkFreeMemory
Warning: resolving _vkGetPhysicalDeviceFormatProperties@12 by linking to _vkGetPhysicalDeviceFormatProperties
Warning: resolving _vkCmdCopyImage@36 by linking to _vkCmdCopyImage
Warning: resolving _vkCreateSampler@16 by linking to _vkCreateSampler
Warning: resolving _vkCreateBuffer@16 by linking to _vkCreateBuffer
Warning: resolving _vkGetBufferMemoryRequirements@16 by linking to _vkGetBufferMemoryRequirements
Warning: resolving _vkBindBufferMemory@28 by linking to _vkBindBufferMemory
Warning: resolving _vkCreateDescriptorSetLayout@16 by linking to _vkCreateDescriptorSetLayout
Warning: resolving _vkCreatePipelineLayout@16 by linking to _vkCreatePipelineLayout
Warning: resolving _vkCreateRenderPass@16 by linking to _vkCreateRenderPass
Warning: resolving _vkCreateShaderModule@16 by linking to _vkCreateShaderModule
Warning: resolving _vkCreatePipelineCache@16 by linking to _vkCreatePipelineCache
Warning: resolving _vkCreateGraphicsPipelines@28 by linking to _vkCreateGraphicsPipelines
Warning: resolving _vkDestroyPipelineCache@16 by linking to _vkDestroyPipelineCache
Warning: resolving _vkDestroyShaderModule@16 by linking to _vkDestroyShaderModule
Warning: resolving _vkCreateDescriptorPool@16 by linking to _vkCreateDescriptorPool
Warning: resolving _vkAllocateDescriptorSets@12 by linking to _vkAllocateDescriptorSets
Warning: resolving _vkUpdateDescriptorSets@20 by linking to _vkUpdateDescriptorSets
Warning: resolving _vkCreateFramebuffer@16 by linking to _vkCreateFramebuffer
Warning: resolving _vkCreateCommandPool@16 by linking to _vkCreateCommandPool
Warning: resolving _vkDeviceWaitIdle@4 by linking to _vkDeviceWaitIdle
Warning: resolving _vkEnumerateInstanceLayerProperties@8 by linking to _vkEnumerateInstanceLayerProperties
Warning: resolving _vkEnumerateInstanceExtensionProperties@12 by linking to _vkEnumerateInstanceExtensionProperties
Warning: resolving _vkCreateInstance@12 by linking to _vkCreateInstance
Warning: resolving _vkEnumeratePhysicalDevices@12 by linking to _vkEnumeratePhysicalDevices
Warning: resolving _vkEnumerateDeviceLayerProperties@12 by linking to _vkEnumerateDeviceLayerProperties
Warning: resolving _vkEnumerateDeviceExtensionProperties@16 by linking to _vkEnumerateDeviceExtensionProperties
Warning: resolving _vkGetInstanceProcAddr@8 by linking to _vkGetInstanceProcAddr
Warning: resolving _vkGetPhysicalDeviceProperties@8 by linking to _vkGetPhysicalDeviceProperties
Warning: resolving _vkGetPhysicalDeviceQueueFamilyProperties@12 by linking to _vkGetPhysicalDeviceQueueFamilyProperties
Warning: resolving _vkCreateDevice@16 by linking to _vkCreateDevice
Warning: resolving _vkGetDeviceProcAddr@8 by linking to _vkGetDeviceProcAddr
Warning: resolving _vkGetDeviceQueue@16 by linking to _vkGetDeviceQueue
Warning: resolving _vkGetPhysicalDeviceMemoryProperties@8 by linking to _vkGetPhysicalDeviceMemoryProperties
Warning: resolving _vkDestroyFramebuffer@16 by linking to _vkDestroyFramebuffer
Warning: resolving _vkDestroyDescriptorPool@16 by linking to _vkDestroyDescriptorPool
Warning: resolving _vkDestroyCommandPool@16 by linking to _vkDestroyCommandPool
Warning: resolving _vkDestroyPipeline@16 by linking to _vkDestroyPipeline
Warning: resolving _vkDestroyRenderPass@16 by linking to _vkDestroyRenderPass
Warning: resolving _vkDestroyPipelineLayout@16 by linking to _vkDestroyPipelineLayout
Warning: resolving _vkDestroyDescriptorSetLayout@16 by linking to _vkDestroyDescriptorSetLayout
Warning: resolving _vkDestroyBuffer@16 by linking to _vkDestroyBuffer
Warning: resolving _vkDestroyImageView@16 by linking to _vkDestroyImageView
Warning: resolving _vkDestroySampler@16 by linking to _vkDestroySampler
Warning: resolving _vkDestroyDevice@8 by linking to _vkDestroyDevice
Warning: resolving _vkDestroySurfaceKHR@16 by linking to _vkDestroySurfaceKHR
Warning: resolving _vkDestroyInstance@8 by linking to _vkDestroyInstance
CMakeFiles\vulkan.dir/objects.a(vulkan.c.obj):vulkan.c:(.text+0x37a3): undefined reference to `aligned_alloc'
collect2.exe: error: ld returned 1 exit status
tests\CMakeFiles\vulkan.dir\build.make:98: recipe for target 'tests/vulkan.exe' failed
mingw32-make.exe[3]: *** [tests/vulkan.exe] Error 1
CMakeFiles\Makefile2:1162: recipe for target 'tests/CMakeFiles/vulkan.dir/all' failed
mingw32-make.exe[2]: *** [tests/CMakeFiles/vulkan.dir/all] Error 2
CMakeFiles\Makefile2:1174: recipe for target 'tests/CMakeFiles/vulkan.dir/rule' failed
mingw32-make.exe[1]: *** [tests/CMakeFiles/vulkan.dir/rule] Error 2
Makefile:514: recipe for target 'vulkan' failed
mingw32-make.exe: *** [vulkan] Error 2

起初我认为它不会在构建中使用C11,但在我将set(CMAKE_C_STANDARD 11)添加到CMakeLists.txt后它也无效。

环境:GLFW-3.2.1,CLion 2017.2.2,CMake 3.8.2和MinGW 3.20。

0 个答案:

没有答案