Code Monkey home page Code Monkey logo

Comments (19)

chancez avatar chancez commented on May 29, 2024 1

Thats awesome. I was thinking of packaging faq for ARM but didn't really know where I would run the builds.

from faq.

vielmetti avatar vielmetti commented on May 29, 2024

dep works without a problem installed from source.

Next, stuck on a library:

$ go install github.com/jzelinskie/faq
# pkg-config --cflags oniguruma
Package oniguruma was not found in the pkg-config search path.
Perhaps you should add the directory containing `oniguruma.pc'
to the PKG_CONFIG_PATH environment variable
No package 'oniguruma' found
pkg-config: exit status 1

Debian has three (count them) plausible alternatives.

libonig2/oldstable 5.9.5-3.2+deb8u1 armhf
  Oniguruma regular expressions library

libonig4/unstable 6.7.0-1 armhf
  regular expressions library

libonig5/unstable,now 6.8.2-1 armhf [installed]
  regular expressions library

from faq.

jzelinskie avatar jzelinskie commented on May 29, 2024

Using pkg-config to find oniguruma was a lazy hack by me, maybe debian doesn't bring in the .pc file with that package. I'll see if I can remove pkg-config as a requirement.

You should try changing the #cgo instructions at the top of jq/jq.go:

-#cgo pkg-config: --static oniguruma
+#cgo linux LDFLAGS: -lonig

edit: I just pushed a change for this.

from faq.

vielmetti avatar vielmetti commented on May 29, 2024

I was able to build jq from source (master) fine, resulting in

$ jq --version
jq-1.4-1-e73951f

from faq.

vielmetti avatar vielmetti commented on May 29, 2024

After a git pull to pick up changes, I was able to build, but got stopped at

$ go install github.com/jzelinskie/faq
# github.com/jzelinskie/faq/jq
jq/jv.go:385:33: could not determine kind of name for C.JV_PRINT_COLOUR

I'm suspicious because

go version go1.9.2 linux/arm

so the next thing to do is to upgrade to go1.10.x.

from faq.

jzelinskie avatar jzelinskie commented on May 29, 2024

What commit are you using? I just pushed a few fixes to the jq library.

from faq.

vielmetti avatar vielmetti commented on May 29, 2024
emv@parviflorus:~/faq/src/github.com/jzelinskie/faq$ go install github.com/jzelinskie/faq
# github.com/jzelinskie/faq/jq
jq/jv.go:411:31: could not determine kind of name for C.JV_PRINT_COLOUR
emv@parviflorus:~/faq/src/github.com/jzelinskie/faq$ git log -1
commit 7b4ed8bce69b89f45c14c4288ded1e98200b715a
Author: Jimmy Zelinskie <[email protected]>
Date:   Thu May 17 20:15:25 2018 -0400

    jq: fix imports in tests
emv@parviflorus:~/faq/src/github.com/jzelinskie/faq$ go version
go version go1.10.2 linux/arm

from faq.

jzelinskie avatar jzelinskie commented on May 29, 2024

I think CGO might be disabled. Are you building this on ARM or trying to cross compile from x64?

from faq.

vielmetti avatar vielmetti commented on May 29, 2024

I think the problem is in C.JV_PRINT_COLOUR - see

ed@ed-2a-bcc-llvm:~/faq/src/github.com/jzelinskie/faq$ grep COLOR /usr/local/include/jv.h
  JV_PRINT_COLOR    = 4,

(doing this on an arm64 system too while I'm at it).

diff --git a/jq/jv.go b/jq/jv.go
index 48af9a6..87b4c02 100644
--- a/jq/jv.go
+++ b/jq/jv.go
@@ -408,7 +408,7 @@ const (
        JvPrintASCII JvPrintFlags = C.JV_PRINT_ASCII
 
        // JvPrintColour includes ANSI color escapes based on data types.
-       JvPrintColour JvPrintFlags = C.JV_PRINT_COLOUR
+       JvPrintColour JvPrintFlags = C.JV_PRINT_COLOR
 
        // JvPrintSorted sorts the output keys.
        JvPrintSorted JvPrintFlags = C.JV_PRINT_SORTED

That makes the compile work, but then I run into this:

d@ed-2a-bcc-llvm:~/faq/src/github.com/jzelinskie/faq$ ~/faq/bin/faq 
/home/ed/faq/bin/faq: error while loading shared libraries: libjq.so.1: cannot open shared object file: No such file or directory

from faq.

vielmetti avatar vielmetti commented on May 29, 2024

OK working!

emv@parviflorus:~/faq/src/github.com/jzelinskie/faq$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/lib
emv@parviflorus:~/faq/src/github.com/jzelinskie/faq$ ~/faq/bin/faq
Error: not enough arguments provided
Usage:
  faq [flags] [filter string] [files...]

Flags:
  -a, --ascii-output        force output to be ascii instead of UTF-8
  -C, --color-output        colorize the output (default true)
  -c, --compact             compact instead of pretty-printed output
  -f, --format string       input format (default "auto")
  -h, --help                help for faq
  -m, --maintain-format     maintain original format (don't output JSON)
  -M, --monochrome-output   monochrome (don't colorize the output)
  -r, --raw                 output raw strings, not JSON texts
  -S, --sort-keys           sort keys of objects on output
  -t, --tab                 use tabs for indentation

from faq.

jzelinskie avatar jzelinskie commented on May 29, 2024

Interesting! I wonder if they renamed that flag in a particular version of jq. What version are you linking against?

from faq.

vielmetti avatar vielmetti commented on May 29, 2024

Looks like this is the color/colour diff:

jqlang/jq@2d05b54

from faq.

jzelinskie avatar jzelinskie commented on May 29, 2024

Yup, I'm definitely linking against jq 1.5 on macOS and 1.6-rc.1 on Linux.
I recommend just building jq from a stable release and sticking with the British spelling.

from faq.

theUncanny avatar theUncanny commented on May 29, 2024

@jzelinskie my workaround to compile and linking faq against jq lastest master branch:

git clone https://github.com/stedolan/jq.git && \
cd jq && \
git submodule update --init && \
autoreconf -fi && \
./configure \
--disable-maintainer-mode \
--with-oniguruma=builtin && \
make -j$(nproc) LDFLAGS=-all-static && \
sudo make install && \
sudo ldconfig -v && \
go get \
-v \
-u \
-t \
-f \
-d \
github.com/jzelinskie/faq && \
cd "${GOPATH}/src/github.com/jzelinskie/faq" && \
sed -i -e 's/JV_PRINT_COLOUR/JV_PRINT_COLOR/g' jq/jv.go && \
dep ensure && \
go install \
-p "$(nproc)" \
github.com/jzelinskie/faq && \
sed -i -e 's/JV_PRINT_COLOR/JV_PRINT_COLOUR/g' jq/jv.go

from faq.

chancez avatar chancez commented on May 29, 2024

After #27 be aware that faq currently expects to be built with jq 1.6.

from faq.

jzelinskie avatar jzelinskie commented on May 29, 2024

@vielmetti I'd love to be able to have dev tooling for building against ARM. If you want to contribute something that we can put in a Makefile for building in a VM, that'd be perfect.

from faq.

vielmetti avatar vielmetti commented on May 29, 2024

@jzelinskie are you familiar with Drone Cloud? It has x64, arm64, and 32-bit Arm support for CI, and it's free for open source. https://cloud.drone.io/

from faq.

vielmetti avatar vielmetti commented on May 29, 2024

Started a new Drone Cloud discussion at #38, I have a working .drone.yml at least for Alpine and x86, will iterate there.

from faq.

jzelinskie avatar jzelinskie commented on May 29, 2024

Pointing this to #83 and closing.

from faq.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.