Skip to content
This repository has been archived by the owner on Mar 8, 2020. It is now read-only.

Troubles to build the most recent version #10

Closed
vmarkovtsev opened this issue Sep 8, 2017 · 1 comment
Closed

Troubles to build the most recent version #10

vmarkovtsev opened this issue Sep 8, 2017 · 1 comment
Assignees

Comments

@vmarkovtsev
Copy link
Contributor

sourced@sourced-MacBookPro:~/Projects$ git clone https://github.com/bblfsh/libuast
Cloning into 'libuast'...
remote: Counting objects: 564, done.
remote: Compressing objects: 100% (77/77), done.
remote: Total 564 (delta 66), reused 101 (delta 49), pack-reused 438
Receiving objects: 100% (564/564), 634.95 KiB | 318.00 KiB/s, done.
Resolving deltas: 100% (234/234), done.
Checking connectivity... done.
sourced@sourced-MacBookPro:~/Projects$ cd libuast/
sourced@sourced-MacBookPro:~/Projects/libuast$ cmake -DCMAKE_BUILD_TYPE=Release .
-- The C compiler identification is GNU 5.4.0
-- 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
-- Detecting C compile features
-- Detecting C compile features - done
-- Found CUnit: /usr/lib/x86_64-linux-gnu/libcunit.so (found version "2.1-3") 
-- Found LibXml2: /usr/lib/x86_64-linux-gnu/libxml2.so (found version "2.9.3") 
-- The CXX compiler identification is GNU 5.4.0
-- Check for working CXX compiler: /usr/bin/c++
-- Check for working CXX compiler: /usr/bin/c++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring done
-- Generating done
-- Build files have been written to: /home/sourced/Projects/libuast
sourced@sourced-MacBookPro:~/Projects/libuast$ make 
Scanning dependencies of target objlib
[  9%] Building C object CMakeFiles/objlib.dir/src/uast.c.o
[ 18%] Building C object CMakeFiles/objlib.dir/src/roles.c.o
[ 18%] Built target objlib
Scanning dependencies of target uast-static
[ 27%] Linking C static library lib/libuast.a
[ 27%] Built target uast-static
Scanning dependencies of target uast-shared
[ 36%] Linking C shared library lib/libuast.so
[ 36%] Built target uast-shared
Scanning dependencies of target example
[ 45%] Building CXX object examples/CMakeFiles/example.dir/example.cc.o
[ 54%] Linking CXX executable example
[ 54%] Built target example
Scanning dependencies of target testsuite
[ 63%] Building CXX object tests/CMakeFiles/testsuite.dir/main.cc.o
[ 72%] Building C object tests/CMakeFiles/testsuite.dir/__/src/testing_tools.c.o
[ 81%] Building C object tests/CMakeFiles/testsuite.dir/__/src/uast.c.o
[ 90%] Building C object tests/CMakeFiles/testsuite.dir/__/src/roles.c.o
[100%] Linking CXX executable testsuite
[100%] Built target testsuite
sourced@sourced-MacBookPro:~/Projects/libuast$ sudo make install
[sudo] password for sourced: 
[ 18%] Built target objlib
[ 27%] Built target uast-static
[ 36%] Built target uast-shared
[ 54%] Built target example
[100%] Built target testsuite
Install the project...
-- Install configuration: "Release"
-- Installing: /usr/local/lib/libuast.a
-- Installing: /usr/local/include/libuast/uast.h
-- Installing: /usr/local/include/libuast/roles.h
-- Installing: /usr/local/include/libuast/node_iface.h
-- Installing: /usr/local/include/libuast/nodes.h
-- Installing: /usr/local/lib/libuast.so.0.0.0
-- Installing: /usr/local/lib/libuast.so.0
-- Installing: /usr/local/lib/libuast.so
-- Set runtime path of "/usr/local/lib/libuast.so.0.0.0" to ""
sourced@sourced-MacBookPro:~/Projects/libuast$ cd ../hercules/
sourced@sourced-MacBookPro:~/Projects/hercules$ go get gopkg.in/bblfsh/client-go.v0
# gopkg.in/bblfsh/client-go.v0
In file included from src/gopkg.in/bblfsh/client-go.v0/libuast.go:14:0:
./bindings.h:7:18: fatal error: uast.h: No such file or directory
compilation terminated.
sourced@sourced-MacBookPro:~/Projects/hercules$ CGO_CFLAGS="-I/usr/local/include/libuast" go get gopkg.in/bblfsh/client-go.v0
# gopkg.in/bblfsh/client-go.v0
/tmp/go-build738276561/gopkg.in/bblfsh/client-go.v0/_obj/_cgo_export.o: In function `CreateUast':
_cgo_export.c:(.text+0x123): undefined reference to `UastNew'
/tmp/go-build738276561/gopkg.in/bblfsh/client-go.v0/_obj/_cgo_export.o: In function `Filter':
_cgo_export.c:(.text+0x15b): undefined reference to `UastFilter'
/tmp/go-build738276561/gopkg.in/bblfsh/client-go.v0/_obj/_cgo_export.o: In function `Size':
_cgo_export.c:(.text+0x187): undefined reference to `NodesSize'
/tmp/go-build738276561/gopkg.in/bblfsh/client-go.v0/_obj/_cgo_export.o: In function `At':
_cgo_export.c:(.text+0x1a8): undefined reference to `NodeAt'
/tmp/go-build738276561/gopkg.in/bblfsh/client-go.v0/_obj/libuast.cgo2.o: In function `CreateUast':
libuast.cgo2.c:(.text+0x123): undefined reference to `UastNew'
/tmp/go-build738276561/gopkg.in/bblfsh/client-go.v0/_obj/libuast.cgo2.o: In function `Filter':
libuast.cgo2.c:(.text+0x15b): undefined reference to `UastFilter'
/tmp/go-build738276561/gopkg.in/bblfsh/client-go.v0/_obj/libuast.cgo2.o: In function `Size':
libuast.cgo2.c:(.text+0x187): undefined reference to `NodesSize'
/tmp/go-build738276561/gopkg.in/bblfsh/client-go.v0/_obj/libuast.cgo2.o: In function `At':
libuast.cgo2.c:(.text+0x1a8): undefined reference to `NodeAt'
collect2: error: ld returned 1 exit status
sourced@sourced-MacBookPro:~/Projects/hercules$ CGO_CFLAGS="-I/usr/local/include/libuast" CGO_LDFLAGS="-luast" go get gopkg.in/bblfsh/client-go.v0
sourced@sourced-MacBookPro:~/Projects/hercules$ (success)

I propose to add the most common include paths and -luast to CGO definitions in Go code.

@abeaumont
Copy link
Contributor

As indicated in the README.md, the way to get it working is not with go get but with make. Having libuast installed is not needed.
We may add support for already installed versions of libuast in the future, but not before having stable releases with proper versioning.

@abeaumont abeaumont self-assigned this Sep 12, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants