未定义的引用`cygwin_crt0'

时间:2017-02-20 02:14:53

标签: c++ gcc cygwin clang linker-errors

我正在llvm (clang) 3.9下建立cygwin x86_64。我尝试了编译器clang 3.8gcc 5.4。两种情况均导致以下错误。

[skipped]
-- Performing Test LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG
-- Performing Test LIBCXX_SUPPORTS_NODEFAULTLIBS_FLAG - Success
-- Performing Test LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB
-- Performing Test LIBCXX_HAVE_CXX_ATOMICS_WITHOUT_LIB - Failed
-- Looking for __atomic_fetch_add_8 in atomic
-- Looking for __atomic_fetch_add_8 in atomic - not found
CMake Warning at projects/libcxx/cmake/Modules/CheckLibcxxAtomic.cmake:45 (message):
  Host compiler appears to require libatomic, but cannot find it.
Call Stack (most recent call first):
  projects/libcxx/cmake/config-ix.cmake:47 (include)
  projects/libcxx/CMakeLists.txt:365 (include)

 [skipped] 
-- Performing Test LIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG
-- Performing Test LIBCXX_SUPPORTS_STD_EQ_CXX11_FLAG - Failed
CMake Error at projects/libcxx/CMakeLists.txt:418 (message):
  C++11 or greater is required but the compiler does not support c++11

-- Configuring incomplete, errors occurred!
See also "/home/Oleg/opt/llvm/build/CMakeFiles/CMakeOutput.log".
See also "/home/Oleg/opt/llvm/build/CMakeFiles/CMakeError.log".

CMakeError.log包含此错误的类似链接问题。记录第一个错误(atomic

Determining if the function __atomic_fetch_add_8 exists in the atomic failed with the following output:
Change Dir: /home/loom/opt/llvm/build/CMakeFiles/CMakeTmp

Run Build Command:"make" "cmTC_f11c3/fast"
make -f CMakeFiles/cmTC_f11c3.dir/build.make CMakeFiles/cmTC_f11c3.dir/build
make[1]: Entering directory '/home/loom/opt/llvm/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_f11c3.dir/CheckFunctionExists.c.o
/usr/bin/clang    -Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wdelete-non-virtual-dtor -Wstring-conversion -Werror=date-time -DCHECK_FUNCTION_EXISTS=__atomic_fetch_add_8  -nodefaultlibs   -o CMakeFiles/cmTC_f11c3.dir/CheckFunctionExists.c.o   -c /usr/share/cmake-3.6.2/Modules/CheckFunctionExists.c
Linking C executable cmTC_f11c3.exe
/usr/bin/cmake.exe -E cmake_link_script CMakeFiles/cmTC_f11c3.dir/link.txt --verbose=1

/usr/bin/clang   -Wall -W -Wno-unused-parameter -Wwrite-strings -Wmissing-field-initializers -pedantic -Wno-long-long -Wcovered-switch-default -Wdelete-non-virtual-dtor -Wstring-conversion -Werror=date-time -DCHECK_FUNCTION_EXISTS=__atomic_fetch_add_8  -nodefaultlibs  -Wl,--enable-auto-import -Wl,-allow-shlib-undefined  CMakeFiles/cmTC_f11c3.dir/CheckFunctionExists.c.o  -o cmTC_f11c3.exe -Wl,--out-implib,libcmTC_f11c3.dll.a -Wl,--major-image-version,0,--minor-image-version,0 -latomic -lm -lc 
/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../lib/crt0.o: In function `mainCRTStartup':
/usr/src/debug/cygwin-2.6.1-1/winsup/cygwin/crt0.c:27: undefined reference to `cygwin_crt0'
/usr/src/debug/cygwin-2.6.1-1/winsup/cygwin/crt0.c:27:(.text+0xc): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `cygwin_crt0'

[skipped]

/usr/lib/gcc/x86_64-pc-cygwin/5.4.0/../../../../lib/libc.a(t-d000044.o):fake:(.text+0x2): relocation truncated to fit: R_X86_64_PC32 against undefined symbol `__imp___main'
collect2: error: ld returned 1 exit status
clang-3.8: error: linker (via gcc) command failed with exit code 1 (use -v to see invocation)
make[1]: *** [CMakeFiles/cmTC_f11c3.dir/build.make:98: cmTC_f11c3.exe] Error 1
make[1]: Leaving directory '/home/loom/opt/llvm/build/CMakeFiles/CMakeTmp'
make: *** [Makefile:126: cmTC_f11c3/fast] Error 2

0 个答案:

没有答案