Skip to content

Instantly share code, notes, and snippets.

@kat-co

kat-co/c2ffi.scm Secret

Created September 6, 2019 15:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kat-co/a8c85b6d7c1cbb84f19e7f3516bebb73 to your computer and use it in GitHub Desktop.
Save kat-co/a8c85b6d7c1cbb84f19e7f3516bebb73 to your computer and use it in GitHub Desktop.
(define-module (upstream packages cpp)
#:use-module ((guix licenses) #:prefix license:)
#:use-module (guix packages)
#:use-module (guix download)
#:use-module (guix git-download)
#:use-module (guix build-system cmake)
#:use-module (guix build-system gnu)
#:use-module (gnu packages llvm)
#:use-module (gnu packages gcc)
#:use-module (gnu packages libffi))
(define-public c2ffi
(let ((branch "llvm-8.0.0") ; Update as LLVM version increases
(commit "9e49eb86c65729d811117b6c75d9253f6bbc9881")
(revision "1"))
(package
(name "c2ffi")
(version (git-version "0.0.0" revision commit))
(source
(origin
(method git-fetch)
(uri (git-reference
(url "https://github.com/rpav/c2ffi")
(commit commit)))
(sha256
(base32
"1ia2ag917zsnrjxmj89dlc1f6cbbx1r4yxp7bgfq9j73fva0r88h"))))
(build-system cmake-build-system)
(arguments
`(#:build-type "Release"))
(inputs
`(("llvm" ,llvm-8)
("clang" ,clang)))
(home-page "https://github.com/rpav/c2ffi")
(synopsis "A clang based FFI wrapper generator")
(description
"")
(license license:lgpl2.1))))
@kat-co
Copy link
Author

kat-co commented Sep 6, 2019

And here's the error I get:

/gnu/store/n2p1zs14y89lwkg9da68y12pc10c6sw9-gcc-5.5.0/bin/c++  -O3 -DNDEBUG   CMakeFiles/c2ffi.dir/src/
AST.cpp.o CMakeFiles/c2ffi.dir/src/Decl.cpp.o CMakeFiles/c2ffi.dir/src/Expr.cpp.o CMakeFiles/c2ffi.dir/
src/OutputDriver.cpp.o CMakeFiles/c2ffi.dir/src/Template.cpp.o CMakeFiles/c2ffi.dir/src/Type.cpp.o CMak
eFiles/c2ffi.dir/src/c2ffi.cpp.o CMakeFiles/c2ffi.dir/src/drivers/JSON.cpp.o CMakeFiles/c2ffi.dir/src/d
rivers/Null.cpp.o CMakeFiles/c2ffi.dir/src/drivers/Sexp.cpp.o CMakeFiles/c2ffi.dir/src/init.cpp.o CMake
Files/c2ffi.dir/src/options.cpp.o  -o bin/c2ffi  -L/gnu/store/fflrjl3zgym8d5wpy33hlprr0ndzhcwb-llvm-8.0
.0/lib64 -Wl,-rpath,/gnu/store/fflrjl3zgym8d5wpy33hlprr0ndzhcwb-llvm-8.0.0/lib64:::::::::::::::::::::::
::::::::::::::::::::::::::::::::::::::::::::::: -lclangFrontendTool -lclangFrontend -lclangDriver -lcla
ngSerialization -lclangCodeGen -lclangParse -lclangSema -lclangStaticAnalyzerFrontend -lclangStaticAnal
yzerCheckers -lclangStaticAnalyzerCore -lclangAnalysis -lclangARCMigrate -lclangRewriteFrontend -lclang
Rewrite -lclangEdit -lclangDynamicASTMatchers -lclangASTMatchers -lclangAST -lclangLex -lclangBasic -lc
langFormat -lclangIndex -lclangToolingCore -lclangTooling /gnu/store/fflrjl3zgym8d5wpy33hlprr0ndzhcwb-l
lvm-8.0.0/lib/libLLVMCore.so.8 /gnu/store/fflrjl3zgym8d5wpy33hlprr0ndzhcwb-llvm-8.0.0/lib/libLLVMSuppor
t.so.8 /gnu/store/fflrjl3zgym8d5wpy33hlprr0ndzhcwb-llvm-8.0.0/lib/libLLVMMCParser.so.8 /gnu/store/fflrj
l3zgym8d5wpy33hlprr0ndzhcwb-llvm-8.0.0/lib/libLLVMOption.so.8 /gnu/store/fflrjl3zgym8d5wpy33hlprr0ndzhc
wb-llvm-8.0.0/lib/libLLVMBitReader.so.8 /gnu/store/fflrjl3zgym8d5wpy33hlprr0ndzhcwb-llvm-8.0.0/lib/libL
LVMProfileData.so.8                                                                                   
ld: /gnu/store/8fmqjg2flrx4wafpxacw8fmia84amg33-clang-8.0.0/lib/libclangBasic.a(Targets.cpp.o): undefin
ed reference to symbol '_ZN4llvm14MCSectionMachO21ParseSectionSpecifierB5cxx11ENS_9StringRefERS1_S2_RjR
bS3_'                                                                                                 
ld: /gnu/store/fflrjl3zgym8d5wpy33hlprr0ndzhcwb-llvm-8.0.0/lib/libLLVMMC.so.8: error adding symbols: DS
O missing from command line                                                                           
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/c2ffi.dir/build.make:258: bin/c2ffi] Error 1
make[2]: Leaving directory '/tmp/guix-build-c2ffi-0.0.0-1.9e49eb8.drv-0/build'
make[1]: *** [CMakeFiles/Makefile2:108: CMakeFiles/c2ffi.dir/all] Error 2
make[1]: Leaving directory '/tmp/guix-build-c2ffi-0.0.0-1.9e49eb8.drv-0/build'
make: *** [Makefile:133: all] Error 2
Backtrace:
           4 (primitive-load "/gnu/store/52pbgy5mnl7raa2wxsx450ahzw2…")
In ice-9/eval.scm:
   191:35  3 (_ #f)
In srfi/srfi-1.scm:
   863:16  2 (every1 #<procedure 6b5300 at /gnu/store/6bwkbm3a80v0x…> …)
In /gnu/store/6bwkbm3a80v0xab5qsicij7bjvmn5yna-module-import/guix/build/gnu-build-system.scm:
   799:28  1 (_ _)
In /gnu/store/6bwkbm3a80v0xab5qsicij7bjvmn5yna-module-import/guix/build/utils.scm:
    616:6  0 (invoke _ . _)

/gnu/store/6bwkbm3a80v0xab5qsicij7bjvmn5yna-module-import/guix/build/utils.scm:616:6: In procedure invo
ke:                                                                                                   
Throw to key `srfi-34' with args `(#<condition &invoke-error [program: "make" arguments: ("-j" "8") exi
t-status: 2 term-signal: #f stop-signal: #f] 83df40>)'.                                               
builder for `/gnu/store/1dh1s5qa1ibys9hsmjaxmbjzzxivsczx-c2ffi-0.0.0-1.9e49eb8.drv' failed with exit co
de 1                                                                                                  
build of /gnu/store/1dh1s5qa1ibys9hsmjaxmbjzzxivsczx-c2ffi-0.0.0-1.9e49eb8.drv failed
View build log at '/var/log/guix/drvs/1d/h1s5qa1ibys9hsmjaxmbjzzxivsczx-c2ffi-0.0.0-1.9e49eb8.drv.bz2'.
guix build: error: build of `/gnu/store/1dh1s5qa1ibys9hsmjaxmbjzzxivsczx-c2ffi-0.0.0-1.9e49eb8.drv' fai
led                                                                      

I can see that the author is attempting to fix problems with just building this:

I have tried using other commits, and I get different errors, but errors none the less.

If I look at that library, I see the undefined symbols:

$ nm -g /gnu/store/8fmqjg2flrx4wafpxacw8fmia84amg33-clang-8.0.0/lib/libclangBasic.a |gr
ep _ZN4llvm14MCSectionMachO21ParseSectionSpecifierB5cxx11ENS_9StringRefERS1_S2_RjR                    
                 U _ZN4llvm14MCSectionMachO21ParseSectionSpecifierB5cxx11ENS_9StringRefERS1_S2_RjRbS3_
                 U _ZN4llvm14MCSectionMachO21ParseSectionSpecifierB5cxx11ENS_9StringRefERS1_S2_RjRbS3_
                 U _ZN4llvm14MCSectionMachO21ParseSectionSpecifierB5cxx11ENS_9StringRefERS1_S2_RjRbS3_

ParseSectionSpecifier is defined here: https://llvm.org/doxygen/MCSectionMachO_8cpp_source.html#l00182

StringRef is defined here: http://llvm.org/doxygen/StringRef_8h_source.html#l00048

How do I tell which symbol is missing?

The README for c2ffi has some pointers: https://github.com/rpav/c2ffi/blob/llvm-8.0.0/README.md#notes but I'm not sure what to make of this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment