Code Monkey home page Code Monkey logo

Comments (7)

lundmar avatar lundmar commented on May 30, 2024 1

If I remember correctly, the reason we also have the avahi header check, is to also work on older distros which do not include the .pc file. Though, support for old distroes is not really a priority.

from liblxi.

lundmar avatar lundmar commented on May 30, 2024 1

You are trying to build search.c manually but I assume your current mission is to try create a brew lxi-tools formula?

If so, I think it will be easier if you just go straight to try building lxi-tools creating a brew formula because I expect it will be structured in much the same way as the existing liblxi brew formula. As liblxi/lxi-tools uses meson it will take care of many of the details that you have been struggling with:

https://github.com/Homebrew/homebrew-core/blob/4b4d49d83bc0d0f5c65f36356e6084e580491db8/Formula/liblxi.rb

Notice that pkg-config is a build dependency in this brew formula and that is what makes the build find the pkg-config configuration files etc.

To begin with you could just make a lxi-tools formula that does not build the lxi-gui tool by adding the meson argument -Dgui=false. This would be a good start, then your formula only need to add the following dependencies: liblxi, readline, lua.

from liblxi.

robcarruthers avatar robcarruthers commented on May 30, 2024 1

Ok, that makes sense, I'll get onto that now.

If you're happy i'll leave this issue open for now and close once we've got a better solution documented.

from liblxi.

robcarruthers avatar robcarruthers commented on May 30, 2024 1

Ok, after some testing, the best option to get avahi running on Ubuntu 23.04 is to just install lxi-tools.

snap install lxi-tools

With regards to the brew formula, mentioned above, I hope to have this submitted soon. This will enable lxi-tools on macOS also (GUI disabled). It currently works, installing from source.

from liblxi.

lundmar avatar lundmar commented on May 30, 2024

You are missing some key options in your compile/linker line.

If you are on a very old Ubuntu system you may be missing the avahi-client.pc file which is the feature that meson is looking for when searching for libraries automatically.

In recent versions of Ubuntu, libavahi-client-dev comes with the following file:

/usr/lib/x86_64-linux-gnu/pkgconfig/avahi-client.pc

So you can ask via pkg-config for compilation and linking flags when using avahi:

$ pkg-config --cflags avahi-client 
-D_REENTRANT 

$ pkg-config --libs avahi-client 
-lavahi-common -lavahi-client

from liblxi.

lundmar avatar lundmar commented on May 30, 2024

I just noticed you are running on Ubuntu 23.04 but I suspect you are running it in the brew environment so maybe it does not find the pkg-config configuration unless you specify pkg-config as a required build time dependency.

I'm also running Ubuntu 23.04 and in a native Ubuntu environment it finds the pkg-config avahi configuration just fine:

lundmar@wopr:~/projects/lxi-tools/liblxi$ meson setup build --prefix=$HOME/opt/liblxi --wipe
The Meson build system
Version: 1.0.1
Source dir: /home/lundmar/projects/lxi-tools/liblxi
Build dir: /home/lundmar/projects/lxi-tools/liblxi/build
Build type: native build
Project name: liblxi
Project version: 1.21
C compiler for the host machine: ccache cc (gcc 12.2.0 "cc (Ubuntu 12.2.0-17ubuntu1) 12.2.0")
C linker for the host machine: cc ld.bfd 2.40
Host machine cpu family: x86_64
Host machine cpu: x86_64
Found pkg-config: /usr/bin/pkg-config (1.8.1)
Run-time dependency avahi-client found: YES 0.8
Run-time dependency libxml-2.0 found: YES 2.9.14
Run-time dependency threads found: YES
Has header "avahi-client/client.h" : YES 
Run-time dependency libtirpc found: YES 1.3.2
Configuring lxi_connect.3 using configuration
Configuring lxi_disconnect.3 using configuration
Configuring lxi_discover.3 using configuration
Configuring lxi_discover_if.3 using configuration
Configuring lxi_init.3 using configuration
Configuring lxi_receive.3 using configuration
Configuring lxi_send.3 using configuration
Build targets in project: 1

liblxi 1.21

  User defined options
    prefix: /home/lundmar/opt/liblxi

Found ninja-1.11.1 at /usr/bin/ninja

from liblxi.

robcarruthers avatar robcarruthers commented on May 30, 2024

Thanks, that helps. I suspect your right as I've been going between brew initially and then from source once I encountered issues. I did manage to get the search.c file to compile without the error and get it running with this command, late last night.

gcc $(pkg-config --cflags avahi-client) -I/home/linuxbrew/.linuxbrew/include test/search.c $(pkg-config --libs avahi-client) -llxi -ltirpc -o search
./search

But I had to env variables to get working and the linker directives seem overly complicated and likely a symptom of what I've done trying fix things.

This morning I plan to, retrace my steps, come up with a better/simpler process and document here for others.

I also have a need for mdns on an 18.04 Ubuntu server, so will double check that too. Stand by...

from liblxi.

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.