Linux From ScratchThis Forum is for the discussion of LFS.
LFS is a project that provides you with the steps necessary to build your own custom Linux system.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Building M4-1.4.19 consistently fails: gl_xlist.h issues half a dozen warnings about converting integers to pointers. In gl_list.h these are explicitly declared to be pointers to structs. I don't know why g++ treats them as integers and then treats warnings as an error.
I've set CXXFLAGS to "-std=gnu++2b -Wno-error=int-conversion" and sometimes "-w" but g++ seems to ignore these flags.
Hi pan64, I've attached config.log and the environment details but LQ apparently doesn't allow .h attachments. The files in question are gl_list.h, gl_xlist.h and gl_oset.h. I could rename them but perhaps you have a tarball for m4-1.4.19.
An error occurs first in gl_oset.h where there is a _GL_ATTRIBUTE_NODISCARD on line 275. I moved it to a separate line, tried that, added a ; tried that and finally took it out. Don't know whether that causes the susequent warnings in gl_xlist.h about pointer conversion. I think "-Wint-conversion" is an error in C++ and so it compiles only to the end of the file.
It seems that the environment g++ flags are overruled by the m4 flags which may include -Werror somewhere. If you want to see the original error in gl_oset.h I can create another config.log for that by re-inserting _GL_ATTRIBUTE_NODISCARD before int in line 275.
Thx for interest.
PS I'm glad I did have to make an error log. It shows that these attribute errors originate in gl_list.h, included later by gl_oset.h; better try to solve them in gl_list.h I suppose.
Last edited by JohnHendry; 07-24-2023 at 07:41 AM.
Reason: remove unwanted smiley
I see that another syntax for attributes puts the attribute after the closing } of the definition so I did that with all the "errors" in gl_list.h and the one in gl_oset.h and then it built ok. I hesitate to mark this solved as every change elicited a warning "attribute nodiscard ignored" in the error log (attached). But i'm proceeding to "ncurses". I'll mark it solved if pan64 says ok.
JohnHendry, as I'm looking at the M4 source code (and your TXT outputs) it's mostly C and H files giving you the warnings, so maybe you want to set `CFLAGS` in addition to `CXXFLAGS`?
Also running `./configure --help` hints at the `--enable-c++` option:
Code:
Optional Features:
(...)
--enable-c++ also build C++ sources
Yes, indeed, Projectile, I realised that it was mostly C after a while and I put in my CFLAGS -Wno-error=attributes and -Wno-error=int-conversion, without effect however. But I hadn't seen --enable-c++. The LFS-11.3 book tends to minimise options till the final installation of the package a bit later in the procedure. And thx, Hazel, I could rename these .h files, just didn't want to offend LQ. Anyway I found a workaround for the attributes and if m4 can manage without them for two more chapters I'll install it again.
JohnHendry, I don't think `CFLAGS` and `CXXFLAGS` would simply get ignored: in my generated Makefile they appear at lines 394 and 401 respectively.
Additionally, on Slackware64 15.0, GCC 11.2.0, M4 1.4.19 builds without any errors. Perhaps this is a bug in GCC 12, or specifically in your LFS compiler?
You're right, Projectile, they are where you said; another line says CXX = no, however, presumably because the command-line only specified build, host and target, and another line says CFLAG_VISIBILITY= . My workaround was to move the offending "_GL_ATTRIBUTE_NODISCARD" phrases after the definition } where they still form part of it, according to what I read. But part of it or not the compiler says "ignoring attribute nodiscard" for every one so there's probably a better way. At least it builds.
Last edited by JohnHendry; 07-25-2023 at 03:44 AM.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.