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

Some undeclared variables cause build failures with tightended cflags #67

Closed
nullr0ute opened this issue Oct 7, 2018 · 12 comments
Closed

Comments

@nullr0ute
Copy link

nullr0ute commented Oct 7, 2018

With tightened builds flags on Fedora with gcc8 I get the following builds failure on 0.29:

server.c: In function 'lo_server_resolve_hostname':
server.c:303:10: error: 'it' undeclared (first use in this function); did you mean 'int'?
     for (it = ai; it; it = it->ai_next) {
          ^~
          int
server.c:303:10: note: each undeclared identifier is reported only once for each function it appears in
server.c:303:15: error: 'ai' undeclared (first use in this function)
     for (it = ai; it; it = it->ai_next) {
               ^~
make[3]: *** [Makefile:824: liblo_la-server.lo] Error 1
make[3]: *** Waiting for unfinished jobs....
@radarsat1
Copy link
Owner

Hm I don't get that error on gcc 8.0.1 on Ubuntu. Also, the variable it is declared at the top of that function. That seems more than just "tightened build flags", since "undeclared identifier" is not something that would go away without "-Wall". Can you give more information on how you are configuring the build?

@radarsat1 radarsat1 reopened this Oct 8, 2018
@nullr0ute
Copy link
Author

This is using default build flags on Fedora, and gcc-8.2.1, I believe they're a lot more strict than Ubuntu.

The full failure line is:

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -Wall -I.. -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -c server.c  -fPIC -DPIC -o .libs/liblo_la-server.o
server.c: In function 'lo_server_resolve_hostname':
server.c:303:10: error: 'it' undeclared (first use in this function); did you mean 'int'?
     for (it = ai; it; it = it->ai_next) {
          ^~
          int
server.c:303:10: note: each undeclared identifier is reported only once for each function it appears in
server.c:303:15: error: 'ai' undeclared (first use in this function)
     for (it = ai; it; it = it->ai_next) {
               ^~
make[3]: *** [Makefile:824: liblo_la-server.lo] Error 1
make[3]: Leaving directory '/builddir/build/BUILD/liblo-0.29/src'

The file redhat-hardened-cc1 contains:

*cc1_options:
+ %{!r:%{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}}}

And the file redhat-annobin-cc1 contains:

*cc1_options:
+ %{!-fno-use-annobin:%{!iplugindir*:%:find-plugindir()} -fplugin=annobin}

@radarsat1
Copy link
Owner

I ran a fedora docker container and installed gcc 8 and wget:

$ docker run --rm -it fedora /bin/bash
[root@4d3b63aa33d1 /]# dnf install -yq gcc make wget
[root@f04478e06980 /]# gcc --version
gcc (GCC) 8.1.1 20180712 (Red Hat 8.1.1-5)
Copyright (C) 2018 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

[root@4d3b63aa33d1 /]# wget http://downloads.sourceforge.net/liblo/liblo-0.29.tar.gz
[root@4d3b63aa33d1 /]# tar -xzf liblo-0.29.tar.gz
[root@4d3b63aa33d1 /]# cd liblo-0.29
[root@4d3b63aa33d1 liblo-0.29]# ./configure --enable-debug --disable-silent-rules
[root@4d3b63aa33d1 liblo-0.29]# make

I get no errors.
Can you paste the gcc command that is getting executed?

I have no idea what cc1_options is supposed to indicate, I'm not familiar with that syntax.

@radarsat1 radarsat1 reopened this Oct 8, 2018
@radarsat1
Copy link
Owner

Sorry, just figured out that a browser extension was messing with my "Comment" button, didn't meant to close the issue.

@radarsat1
Copy link
Owner

I'll try again with the gcc line you pasted

@radarsat1
Copy link
Owner

radarsat1 commented Oct 8, 2018

I get:

[root@eb71896e58e9 src]# cat <<EOF >redhat-hardened-cc1
*cc1_options:
+ %{!r:%{!fpie:%{!fPIE:%{!fpic:%{!fPIC:%{!fno-pic:-fPIE}}}}}}
EOF
[root@eb71896e58e9 src]# cat <<EOF >redhat-annobin-cc1
*cc1_options:
+ %{!-fno-use-annobin:%{!iplugindir*:%:find-plugindir()} -fplugin=annobin}
EOF
[root@eb71896e58e9 src]# gcc -DHAVE_CONFIG_H -I. -I.. -Wall -I.. -O2 -g -pipe -Wall -Werror=format-security -Wp,-D_FORTIFY_SOURCE=2 -Wp,-D_GLIBCXX_ASSERTIONS -fexceptions -fstack-protector-strong -grecord-gcc-switches -specs=redhat-hardened-cc1 -specs=redhat-annobin-cc1 -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -c server.c  -fPIC -DPIC -o .libs/liblo_la-server.o
[root@eb71896e58e9 src]#

No errors. Where did you get the 0.29 source?

@nullr0ute
Copy link
Author

The package redhat-rpm-config provides the redhat-hardened-cc1/redhat-annobin-cc1
files that are in /usr/lib/rpm/redhat/

@nullr0ute
Copy link
Author

@radarsat1
Copy link
Owner

And what configure line did you use?

In any case it appears I can't help unless I can reproduce... can you find the source of the error, maybe propose a patch? As far as I can tell both the ai and it variables are defined, so I don't know why it's complaining. Have you tried compiling git master instead of 0.29?

@nullr0ute
Copy link
Author

The full build logs are here with all the options specified: https://kojipkgs.fedoraproject.org//work/tasks/5544/30125544/build.log

You can get the src.rpm from https://pbrobinson.fedorapeople.org/liblo-0.29-1.fc30.src.rpm

On a F-29 or later container you can do "dnf install rpmdevtools" then run rpmdev-setuptree, followed by "rpmbuild --rebuild liblo-0.29-1.fc30.src.rpm" and it should recreate the problem.

@radarsat1
Copy link
Owner

Oh ok, now I see the problem. You are compiling with an unsupported option. Please remove --enable-ipv6 and check issue #57.

@radarsat1
Copy link
Owner

Closing for lack of follow-up, please re-open if necessary!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants