Subject: Re: [alpine-user] missing header sys/queue.h

From: Riccardo Mottola <[email-masked]>
Date: Thu, 28 Feb 2019 20:02:59 +0100

Hi Adam!

Adam Růžička wrote:
> Hi,
> bsd-compat-headers package seems to provide that header.

yes, you are right, I installed it and got further in compilation, now I 
get

  3:13.58 ../../dist/system_wrappers/sys/sysctl.h:4:15: fatal error: 
sys/sysctl.h: No such file or directory
  3:13.58  #include_next <sys/sysctl.h>
  3:13.59                ^~~~~~~~~~~~~~

is this a separate dev package too perhaps?

Riccardo

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: Chloe Kudryavtsev <[email-masked]>
Date: Thu, 28 Feb 2019 23:20:45 -0500

On 2/28/2019 2:02 PM, Riccardo Mottola wrote:
Hi Riccardo,

> how to detect AlpineLinux sources compared to standard Linux

I'm afraid that's not quite the issue you're running into.
Alpine includes all of the standard *linux* headers under the 
linux-headers package.
The problem you are running into is that glibc is not linux, and not 
necessarily standard.

> fatal error: sys/queue.h: No such file or directory 

Alpine uses the musl libc.
musl does not include sys/queue.h[1].
As mentioned, you can find it in bsd-compat-headers (as per the 
recommendation of the musl author).

> sys/sysctl.h: No such file or directory

sysctl(2) is deprecated in linux[2], and should not be used.
As such, musl removed it (5 years ago)[3].

Any application using it should be modified to not use it.

> how did you get FireFox running?

I'm not sure on that one, I can't find the mention of sysctl under 
testing/firefox, so I assume upsteam has added the ability to detect 
this header's presence.

[1]: 
https://wiki.musl-libc.org/faq.html#Q:-Why-is-%3Ccode%3Esys/queue.h%3C/code%3E-not-included?
[2]: man 2 sysctl
[3]: musl commit 2c5e7560251b25b36ae3785211962e9597dc7e7d

---

---

From: PICCORO McKAY Lenz <[email-masked]>
Date: Fri, 1 Mar 2019 08:16:00 -0400

> I'm not sure on that one, I can't find the mention of sysctl under

it's not that you think! currently firefox in alpine has many issues,
by example does not run in classmate intel minilatops if are 32bit flavor
(window opened and the content inside are empty or transparent)
and i only can run susessfully in 64bit but of course very slowly

The real problem: too much glibc not standard things included.

---

From: Riccardo Mottola <[email-masked]>
Date: Tue, 5 Mar 2019 22:45:12 +0100

Hi Chloe,

> testing/firefox, so I assume upsteam has added the ability to detect 

I checked the code and found out that the include is conditional:

#ifdef _EVENT_HAVE_SYS_SYSCTL_H
#include <sys/sysctl.h>
#endif

so if everything is working as expected it should be included only when 
appropriate.

I see:

ipc/chromium/src/third_party/libevent/linux/event2/event-config.h:#define 
_EVENT_HAVE_SYS_SYSCTL_H 1

I do not fully understand if the configure is actually called or not my 
the mozilla build system!

As a test, I tried just to remove that headers, we can understand what 
to patch later. However, compilation just delays failure:

  2:17.29 In file included from 
/home/multix/code/Arctic-Fox/ipc/chromium/src/base/file_util.h:19,
  2:17.30                  from 
/home/multix/code/Arctic-Fox/ipc/chromium/src/base/file_util_posix.cc:5:
  2:17.30 ../../dist/system_wrappers/fts.h:4:15: fatal error: fts.h: No 
such file or directory
  2:17.31  #include_next <fts.h>

Riccardo

---

---

From: Chloe Kudryavtsev <[email-masked]>
Date: Tue, 5 Mar 2019 21:26:22 -0500

Hi again Riccardo,

>   2:17.31  #include_next <fts.h>

In this case, musl does not include fts.h (for similar reasons).
To look for what package might contain a given file (including headers), 
you can use the repository package browser (specifically the contents 
subsection) available here[1].
In this case, it looks like the package you're missing is `fts-dev`.

[1]: https://pkgs.alpinelinux.org/contents

---

---

From: Riccardo Mottola <[email-masked]>
Date: Wed, 6 Mar 2019 20:28:15 +0100

Hi Chloe!

> [1]: https://pkgs.alpinelinux.org/contents

thank you, I was mitting that package (fts included) and together with 
my temporary sysctl patch, I can continue building, however things break 
this way:

  2:36.82 /home/multix/code/Arctic-Fox/xpcom/io/nsLocalFileUnix.cpp: In 
member function 'virtual nsresult 
nsLocalFile::GetDiskSpaceAvailable(int64_t*)':
  2:36.82 
/home/multix/code/Arctic-Fox/xpcom/io/nsLocalFileUnix.cpp:1414:10: 
error: 'BLOCK_SIZE' was not declared in this scope
  2:36.83      if ((BLOCK_SIZE * dq.dqb_bhardlimit) > dq.dqb_curspace)
  2:36.83           ^~~~~~~~~~
  2:36.86 
/home/multix/code/Arctic-Fox/xpcom/io/nsLocalFileUnix.cpp:1414:10: note: 
suggested alternative: 'BLKGETSIZE'
  2:36.86      if ((BLOCK_SIZE * dq.dqb_bhardlimit) > dq.dqb_curspace)
  2:36.87           ^~~~~~~~~~
  2:36.87           BLKGETSIZE
  2:37.25 In the directory 
/home/multix/code/Arctic-Fox/obj-i686-pc-linux-gnu/xpcom/io

is missing of BLOCK_SIZE another known alpine/musl issue?

Riccardo

---

---

From: Chloe Kudryavtsev <[email-masked]>
Date: Thu, 7 Mar 2019 21:20:59 -0500

Hey again Riccardo.

> is missing of BLOCK_SIZE another known alpine/musl issue?

BLOCK_SIZE is canonically defined in linux/fs.h as (1 << BLOCK_SIZE_BITS).

Glibc coincidentally redefines it to a hardcoded 1024 in sys/mount.h, 
but this is a glibc-specific extension.

Please make sure your project includes the correct header.

Also, do note that searching for "musl BLOCK_SIZE" (at least from where 
I'm at) gives relevant results in the top two slots (I haven't checked 
much lower).

It would be nice if for simpler issues (like finding a missing file 
using an automated tool, or where a symbol normally is), you could do 
the search yourself.

This means less effort for me, and significantly less waiting for you.
Instead of having to wait until I (or someone else) gets to helping you 
in their TODO list, you could have had your answer within a minute or 
two (rather than the > 1 day it took me to get back to you this time).

---

---

From: Riccardo Mottola <[email-masked]>
Date: Fri, 8 Mar 2019 14:27:26 +0100

Hi Natanael & Chloe,

Chloe Kudryavtsev wrote:
> Also, do note that searching for "musl BLOCK_SIZE" (at least from 
> where I'm at) gives relevant results in the top two slots (I haven't 
> checked much lower). 

thanks for the pointers, I found actually this discussion upstream

https://bugzilla.mozilla.org/show_bug.cgi?id=1152176

which shows some discussion if fs.h or mount.h is the better option.

At the end, FF opted for the solution to conditionally hard-code 1024. I 
will see if this fix solves the issue.

While ArcticFox is a fork and technically I can fix it differently, I 
prefer, when possible to have similar soruces, since it facilitates 
maintenance. I will test and let you know!

Happy hacking,
Riccardo

---

---

From: Natanael Copa <[email-masked]>
Date: Fri, 8 Mar 2019 10:47:29 +0100

On Wed, 6 Mar 2019 20:28:15 +0100

>   2:36.83      if ((BLOCK_SIZE * dq.dqb_bhardlimit) > dq.dqb_curspace)

fwiw, none of those isses are issues in alpine/musl. It is bugs in the
software you are trying to build. You should report those upstream.

-nc

---