LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch
User Name
Password
Linux From Scratch This 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


Reply
  Search this Thread
Old 07-23-2023, 07:10 AM   #1
JohnHendry
Member
 
Registered: Apr 2020
Location: Sydney, Australia
Distribution: Crux Linux, LFS, Artix, source packages (64-bit PC)
Posts: 39

Rep: Reputation: Disabled
CXXFLAGS ignored by g++


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.
 
Old 07-23-2023, 09:27 AM   #2
pan64
LQ Addict
 
Registered: Mar 2012
Location: Hungary
Distribution: debian/ubuntu/suse ...
Posts: 21,855

Rep: Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311Reputation: 7311
would be nice to see some console output or similar, otherwise hard to say anything. g++ cannot ignore those flags "just for fun"
 
Old 07-24-2023, 03:03 AM   #3
JohnHendry
Member
 
Registered: Apr 2020
Location: Sydney, Australia
Distribution: Crux Linux, LFS, Artix, source packages (64-bit PC)
Posts: 39

Original Poster
Rep: Reputation: Disabled
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.
Attached Files
File Type: log make0.log (22.5 KB, 3 views)
File Type: log config0.log (61.1 KB, 3 views)
File Type: txt env.txt (528 Bytes, 3 views)
File Type: log make1.log (714 Bytes, 3 views)

Last edited by JohnHendry; 07-24-2023 at 07:41 AM. Reason: remove unwanted smiley
 
Old 07-24-2023, 07:53 AM   #4
JohnHendry
Member
 
Registered: Apr 2020
Location: Sydney, Australia
Distribution: Crux Linux, LFS, Artix, source packages (64-bit PC)
Posts: 39

Original Poster
Rep: Reputation: Disabled
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.
Attached Files
File Type: log make4.log (9.8 KB, 4 views)
 
Old 07-24-2023, 07:56 AM   #5
hazel
LQ Guru
 
Registered: Mar 2016
Location: Harrow, UK
Distribution: LFS, AntiX, Slackware
Posts: 7,576
Blog Entries: 19

Rep: Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453Reputation: 4453
Put a .txt suffix on your header files and LQ will accept them.
 
Old 07-24-2023, 08:34 AM   #6
Projectile
Member
 
Registered: Jun 2023
Posts: 72
Blog Entries: 1

Rep: Reputation: 13
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
 
Old 07-24-2023, 08:40 PM   #7
JohnHendry
Member
 
Registered: Apr 2020
Location: Sydney, Australia
Distribution: Crux Linux, LFS, Artix, source packages (64-bit PC)
Posts: 39

Original Poster
Rep: Reputation: Disabled
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.
 
Old 07-25-2023, 03:05 AM   #8
Projectile
Member
 
Registered: Jun 2023
Posts: 72
Blog Entries: 1

Rep: Reputation: 13
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?

Anyway, glad you found a workaround.
 
Old 07-25-2023, 03:38 AM   #9
JohnHendry
Member
 
Registered: Apr 2020
Location: Sydney, Australia
Distribution: Crux Linux, LFS, Artix, source packages (64-bit PC)
Posts: 39

Original Poster
Rep: Reputation: Disabled
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.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] How serious is a CXXFLAGS option error? bayou self Linux From Scratch 6 11-18-2021 10:25 PM
How to set SLACKBUILD CFLAGS / CXXFLAGS / QMAKE C/CXX flags globally? qwxy Slackware 8 01-10-2018 06:20 AM
Why Are #CXXFLAGS etc Crossed out browser Calculate 5 03-28-2012 12:09 AM
Sbopkg : building a queue file with CFLAGS and CXXFLAGS set. Linux.tar.gz Slackware 4 03-11-2012 10:24 PM
Autoconf's default CXXFLAGS Nicholas Bishop Programming 0 05-21-2005 01:26 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Linux From Scratch

All times are GMT -5. The time now is 04:10 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration