<html>
    <head>
      <base href="https://bugs.llvm.org/">
    </head>
    <body><table border="1" cellspacing="0" cellpadding="8">
        <tr>
          <th>Bug ID</th>
          <td><a class="bz_bug_link 
          bz_status_NEW "
   title="NEW - cmake build with shared libs fails with undef symbols on ffi"
   href="https://bugs.llvm.org/show_bug.cgi?id=49818">49818</a>
          </td>
        </tr>

        <tr>
          <th>Summary</th>
          <td>cmake build with shared libs fails with undef symbols on ffi
          </td>
        </tr>

        <tr>
          <th>Product</th>
          <td>Build scripts
          </td>
        </tr>

        <tr>
          <th>Version</th>
          <td>trunk
          </td>
        </tr>

        <tr>
          <th>Hardware</th>
          <td>PC
          </td>
        </tr>

        <tr>
          <th>OS</th>
          <td>Linux
          </td>
        </tr>

        <tr>
          <th>Status</th>
          <td>NEW
          </td>
        </tr>

        <tr>
          <th>Severity</th>
          <td>release blocker
          </td>
        </tr>

        <tr>
          <th>Priority</th>
          <td>P
          </td>
        </tr>

        <tr>
          <th>Component</th>
          <td>cmake
          </td>
        </tr>

        <tr>
          <th>Assignee</th>
          <td>unassignedbugs@nondot.org
          </td>
        </tr>

        <tr>
          <th>Reporter</th>
          <td>sylvestre@debian.org
          </td>
        </tr>

        <tr>
          <th>CC</th>
          <td>llvm-bugs@lists.llvm.org
          </td>
        </tr></table>
      <p>
        <div>
        <pre>On Debian (stable and oldstable):


cd
"/build/llvm-toolchain-snapshot-13~++20210402115133+3b48d849d443/build-llvm/tools/llvm-shlib"
&& /tmp/cmake/bin/cmake -E cmake_link_script CMakeFiles/LLVM.dir/link.txt
--verbose=1
/usr/lib/ccache/g++-6 -fPIC -g -O2
-fdebug-prefix-map=/build/llvm-toolchain-snapshot-13~++20210402115133+3b48d849d443=.
-fstack-protector-strong -Wformat -Werror=format-security -fPIC
-fvisibility-inlines-hidden -Werror=date-time -Wall -Wextra
-Wno-unused-parameter -Wwrite-strings -Wcast-qual
-Wno-missing-field-initializers -pedantic -Wno-long-long
-Wno-maybe-uninitialized -Wdelete-non-virtual-dtor -Wno-comment
-ffunction-sections -fdata-sections -O2 -DNDEBUG -g1 
-Wl,-rpath-link,/build/llvm-toolchain-snapshot-13~++20210402115133+3b48d849d443/build-llvm/./lib
 -Wl,-O3 -Wl,--gc-sections -latomic -Wl,-z,defs -Wl,-z,nodelete -shared
-Wl,-soname,libLLVM-13.so.1 -o ../../lib/libLLVM-13.so.1
@CMakeFiles/LLVM.dir/objects1.rsp @CMakeFiles/LLVM.dir/objects2.rsp 
-Wl,-rpath,"\$ORIGIN/../lib"
-Wl,--version-script,/build/llvm-toolchain-snapshot-13~++20210402115133+3b48d849d443/build-llvm/./lib/tools/llvm-shlib/simple_version_script.map
-Wl,--whole-archive -Wl,--no-whole-archive -lrt -ldl -lm
/usr/lib/i386-linux-gnu/libz.so /usr/lib/i386-linux-gnu/libtinfo.so -lpthread
-ledit 
../../lib/LTO/CMakeFiles/obj.LLVMLTO.dir/LTOBackend.cpp.o: In function
`RegisterPassPlugins':
./build-llvm/include/llvm/Support/Extension.def:2: undefined reference to
`getPollyPluginInfo()'
../../lib/Extensions/CMakeFiles/obj.LLVMExtensions.dir/Extensions.cpp.o: In
function `llvm::details::extensions_anchor()':
./build-llvm/include/llvm/Support/Extension.def:2: undefined reference to
`getPollyPluginInfo()'
../../lib/ExecutionEngine/Interpreter/CMakeFiles/obj.LLVMInterpreter.dir/ExternalFunctions.cpp.o:
In function `ffiTypeFor':
./llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:131: undefined
reference to `ffi_type_sint64'
./llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:133: undefined
reference to `ffi_type_float'
./llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:134: undefined
reference to `ffi_type_double'
./llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:135: undefined
reference to `ffi_type_pointer'
./llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:125: undefined
reference to `ffi_type_void'
./llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:128: undefined
reference to `ffi_type_sint8'
./llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:129: undefined
reference to `ffi_type_sint16'
./llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:130: undefined
reference to `ffi_type_sint32'
../../lib/ExecutionEngine/Interpreter/CMakeFiles/obj.LLVMInterpreter.dir/ExternalFunctions.cpp.o:
In function `ffiInvoke':
./llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:230: undefined
reference to `ffi_prep_cif'
./llvm/lib/ExecutionEngine/Interpreter/ExternalFunctions.cpp:235: undefined
reference to `ffi_call'
collect2: error: ld returned 1 exit status
tools/llvm-shlib/CMakeFiles/LLVM.dir/build.make:4373: recipe for target
'lib/libLLVM-13.so.1' failed


with
cmake ../llvm/ \
-DLLVM_ENABLE_PROJECTS="clang;clang-tools-extra;libcxx;libcxxabi;compiler-rt;lld;debuginfo-tests;polly;openmp;lldb"
\
-DCMAKE_INSTALL_PREFIX=/usr/lib/llvm-13 \
-DCMAKE_VERBOSE_MAKEFILE=ON \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-O2 -DNDEBUG -g1" \
-DLLVM_LINK_LLVM_DYLIB=ON \
-DLLVM_INSTALL_UTILS=ON \
-DLLVM_VERSION_SUFFIX= \
-DLLVM_ENABLE_SPHINX=ON \
-DSPHINX_WARNINGS_AS_ERRORS=OFF \
-DLLVM_ENABLE_RTTI=ON \
-DLLVM_ENABLE_FFI=ON \
-DLLVM_ENABLE_DUMP=ON \
-DPYTHON_EXECUTABLE=/usr/bin/python3 -DLIBOMP_LIBFLAGS="-latomic"
-DCMAKE_SHARED_LINKER_FLAGS="-latomic" -DCLANG_SYSTEMZ_DEFAULT_ARCH=z196
-DLLVM_BINUTILS_INCDIR=/usr/include/ -DLLVM_USE_PERF=yes
-DLLVM_ENABLE_LIBPFM=ON \
-DLIBCLANG_LIBRARY_VERSION=1 \
-DCLANG_LINK_CLANG_DYLIB=ON \
-DENABLE_LINKER_BUILD_ID=ON \
-DPOLLY_BUNDLED_JSONCPP=OFF \
-DCOMPILER_RT_USE_LIBCXX=NO \
-DLLVM_ENABLE_Z3_SOLVER=OFF \
-DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD="AVR" \
-DLLVM_TEMPORARILY_ALLOW_OLD_TOOLCHAIN=ON \
-DCLANG_VENDOR=Debian \
-DCLANG_ENABLE_BOOTSTRAP=ON \
-DCLANG_BUILD_EXAMPLES=OFF \
-DLLVM_POLLY_LINK_INTO_TOOLS=ON \
-DBOOTSTRAP_CMAKE_CXX_FLAGS=' -fuse-ld=gold -fPIC
-Wno-unused-command-line-argument -Wno-unknown-warning-option ' \
-DBOOTSTRAP_CMAKE_C_FLAGS=' -fuse-ld=gold -fPIC
-Wno-unused-command-line-argument -Wno-unknown-warning-option ' \
-DCLANG_BOOTSTRAP_PASSTHROUGH="CMAKE_INSTALL_PREFIX;CMAKE_VERBOSE_MAKEFILE;CMAKE_BUILD_TYPE;CMAKE_CXX_FLAGS_RELWITHDEBINFO;LLVM_LINK_LLVM_DYLIB;LLVM_INSTALL_UTILS;LLVM_VERSION_SUFFIX;LLVM_ENABLE_SPHINX;SPHINX_WARNINGS_AS_ERRORS;LLVM_BUILD_LLVM_DYLIB;LLVM_ENABLE_RTTI;LLVM_ENABLE_FFI;LIBCLANG_LIBRARY_VERSION;ENABLE_LINKER_BUILD_ID;POLLY_BUNDLED_JSONCPP;LLVM_EXPERIMENTAL_TARGETS_TO_BUILD;LLVM_USE_PERF;LLVM_ENABLE_ASSERTIONS;LLVM_BINUTILS_INCDIR;LLVM_HOST_TRIPLE;LLVM_COMPILER_CHECKED;COMPILER_RT_BUILD_BUILTINS;LIBOMP_LIBFLAGS;CMAKE_SHARED_LINKER_FLAGS;PYTHON_EXECUTABLE;LLVM_ENABLE_Z3_SOLVER;LLVM_POLLY_LINK_INTO_TOOLS;CLANG_VENDOR"

Full log:
<a href="https://llvm-jenkins.debian.net/job/llvm-toolchain-stretch-binaries/architecture=i386,distribution=stretch/2182/consoleFull">https://llvm-jenkins.debian.net/job/llvm-toolchain-stretch-binaries/architecture=i386,distribution=stretch/2182/consoleFull</a></pre>
        </div>
      </p>


      <hr>
      <span>You are receiving this mail because:</span>

      <ul>
          <li>You are on the CC list for the bug.</li>
      </ul>
    </body>
</html>