Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

missing iniparser include directory when compiling #96

Closed
flopraden opened this issue Mar 7, 2021 · 13 comments · Fixed by #126
Closed

missing iniparser include directory when compiling #96

flopraden opened this issue Mar 7, 2021 · 13 comments · Fixed by #126
Labels
upstream bug Something is broken in a dependency

Comments

@flopraden
Copy link

Hi,

When I compile the rev 323d89e (current master), I got the following error:

[19/20] Compiling C object xdg-desktop-portal-wlr.p/src_core_config.c.o                                                                                                                                                                                                                   
FAILED: xdg-desktop-portal-wlr.p/src_core_config.c.o                                                                                                                                                                                                                                      
ccache cc -Ixdg-desktop-portal-wlr.p -I. -I.. -I../include -Iprotocols -I/usr/local/include/pipewire-0.3 -I/usr/local/include/spa-0.2 -fdiagnostics-color=always -pipe -D_FILE_OFFSET_BITS=64 -Wall -Winvalid-pch -Wextra -Werror -std=c11 -g -Wno-missing-braces -Wno-missing-field-initi
alizers -Wno-unused-parameter -D_POSIX_C_SOURCE=200809L '-DSYSCONFDIR="/usr/local/etc"' -DHAVE_LIBSYSTEMD=1 -D_REENTRANT -MD -MQ xdg-desktop-portal-wlr.p/src_core_config.c.o -MF xdg-desktop-portal-wlr.p/src_core_config.c.o.d -o xdg-desktop-portal-wlr.p/src_core_config.c.o -c ../src
/core/config.c                                                                                                                                                                                                                                                                            
../src/core/config.c:5:10: fatal error: dictionary.h: Aucun fichier ou dossier de ce type                                                                                                                                                                                                 
    5 | #include <dictionary.h>                                                                                                                                                                                                                                                           
      |          ^~~~~~~~~~~~~~                                        

Adding the include directory for lib iniparser in build.ninja for core/config.c correct the problem.
Since I do not know how to make meson discover and add the correct path, I corrected manually the build.ninja

Best,

@emersion
Copy link
Owner

emersion commented Mar 7, 2021

iniparser doesn't have a pkg-config file, so we can't just use that.

On my system iniparser just installs /usr/include/dictionary.h :S

@SuzanneSoy
Copy link

Just installing right now, I needed to run these commands because on my ubuntu 20.04 it's in /usr/include/iniparser/dictionary.h and /usr/include/iniparser/iniparser.h

cd /tmp
git clone https://github.com/emersion/xdg-desktop-portal-wlr
wget http://fr.archive.ubuntu.com/ubuntu/pool/universe/p/pipewire/libpipewire-0.3-dev_0.3.10-4_amd64.deb
wget http://fr.archive.ubuntu.com/ubuntu/pool/universe/p/pipewire/libpipewire-0.3-0_0.3.10-4_amd64.deb
wget http://fr.archive.ubuntu.com/ubuntu/pool/universe/p/pipewire/libspa-0.2-dev_0.3.10-4_amd64.deb
sudo apt install ./libpipewire-0.3-dev_0.3.10-4_amd64.deb ./libpipewire-0.3-0_0.3.10-4_amd64.deb ./libspa-0.2-dev_0.3.10-4_amd64.deb
sudo apt install libiniparser-dev libpipewire-0.2-dev
INCLUDE="/usr/include/iniparser/:$INCLUDE"
cd xdg-desktop-portal-wlr
git grep -l '#include <dictionary.h>' | xargs sed -i -e 's|#include <dictionary.h>|#include <iniparser/dictionary.h>|' 
git grep -l '#include <iniparser.h>' | xargs sed -i -e 's|#include <iniparser.h>|#include <iniparser/iniparser.h>|' 
. ~/.profile
unset CFLAGS
meson build --prefix=/opt/wayfire
ninja -C build
ninja -C build install 

I don't know meson nor ninja, and they seem to sometimes use $CFLAGS (and maybe $INCLUDE ?), sometimes not. Is there a way to add a -I/usr/include/iniparser/ directive to the build commands instead of using sed ?

@danshick
Copy link
Collaborator

danshick commented Mar 7, 2021

Found another project that is including iniparser with a fallback...

https://github.com/nnstreamer/nntrainer/blob/main/meson.build#L138-L147

Maybe we could do something like this? I don't think the maintainer of iniparser is interested in build system related PRs.

@flopraden
Copy link
Author

the problem with this method is the hardcoded include directory. If someone have iniparser installed in /usr/local/include/... Maybe the correct way is to make a PR to iniparser to add a pkg-config file..

@emersion
Copy link
Owner

emersion commented Mar 8, 2021

A pkg-config file would be very nice indeed.

@danshick danshick added the upstream bug Something is broken in a dependency label Mar 8, 2021
@danshick
Copy link
Collaborator

danshick commented Apr 5, 2021

I know that we concluded there was no .pc file during this PR, but I think the linked issue is old. Looks like they've had one since 2018, but the Arch package still isn't shipping it.

Edit: I've requested that the Arch package issue be reopened in light of the .pc file that is now available.

Edit 2:
Alpine Linux and FreeBSD also fail to package the .pc file.

@emersion
Copy link
Owner

emersion commented Apr 6, 2021

It seems like there's no iniparser release which contains the .pc file yet.

@emersion
Copy link
Owner

As a workaround, you can export C_INCLUDE_PATH=/usr/include/iniparser before running Meson.

@emersion
Copy link
Owner

emersion commented May 1, 2021

I'm discussing with upstream iniparser by email and they indicate that iniparser was never meant to be installed system-wide, it was meant to be embedded in projects instead. That probably explains the lack of make install and the dictionary.h feeling out of place.

We may want to consider dropping the iniparser dep and include our own parser instead. rootston has a 200 line parser for instance: https://github.com/emersion/rootston/blob/master/ini.c

@emersion
Copy link
Owner

emersion commented May 1, 2021

Eh, it seems rootston is using inih, also available in Arch repos. So switching to that would be an option too (not sure it's worth it for 200 lines).

@danshick
Copy link
Collaborator

danshick commented May 1, 2021

Huh, thanks for looking into this. That does make a lot of sense.

I'm fine with either approach. The only benefit I see to depending on the system package is not having to manage updates unless they include breaking changes.

@columbarius
Copy link
Collaborator

If you want to use inih for programs which may be shipped in a distro, consider linking against the shared libraries. The pkg-config entries are inih and INIReader.

Reads like it has shipping by distros in mind and pkgs.org shows wide support. Therefore i would link against the distros package instead of including its source.

@columbarius
Copy link
Collaborator

I still prefer using a dedicated lib instead of shipping an maintaining our own iniparser, even if it is only 200 lines of sth. which probably won't change and we could use those lines when the lib includes breaking changes. But I'm not opposed to using them either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
upstream bug Something is broken in a dependency
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants