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

Compilation fails with arm-linux-musleabi-gcc (GCC) 9.1.0 #191

Open
eerimoq opened this issue May 25, 2019 · 10 comments
Open

Compilation fails with arm-linux-musleabi-gcc (GCC) 9.1.0 #191

eerimoq opened this issue May 25, 2019 · 10 comments

Comments

@eerimoq
Copy link

eerimoq commented May 25, 2019

Failure:

$ arm-linux-musleabi-gcc -I. -c ipaddr.c -o libdill_la-ipaddr.o
In file included from ipaddr.c:44:
ipaddr.c: In function 'dill_ipaddr_remotes':
dns/dns.h:1009:24: error: lvalue required as unary '&' operand
 1009 | #define dns_opts(...) (&dns_quietinit((struct dns_options)DNS_OPTS_INIT(__VA_ARGS__)))
      |                        ^
ipaddr.c:335:47: note: in expansion of macro 'dns_opts'
  335 |         dill_dns_hosts, dill_dns_hints, NULL, dns_opts(), &rc);
      |                                               ^~~~~~~~
$ gcc -I. -c ipaddr.c -o libdill_la-ipaddr.o
$

Compiler versions:

$ arm-linux-musleabi-gcc --version
arm-linux-musleabi-gcc (GCC) 9.1.0
Copyright (C) 2019 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.

$ gcc --version
gcc (Ubuntu 8.3.0-6ubuntu1) 8.3.0
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.

$

I've only tested with these two compilers.

@tmlbl
Copy link

tmlbl commented Jun 4, 2019

I am also seeing this error with gcc on Clear Linux

$ gcc --version
gcc (Clear Linux OS for Intel Architecture) 9.1.1 20190529 gcc-9-branch@271737

It can be reproduced exactly as above

@sustrik
Copy link
Owner

sustrik commented Jun 4, 2019

Unfortunately, this looks like a bug in dns.c. The project can be found here: https://github.com/wahern/dns

@tmlbl
Copy link

tmlbl commented Jun 7, 2019

Yes, unfortunately it seems to be pretty widespread throughout the library, and I don't know enough about C macros to fix it :(

@adel-mamin
Copy link
Contributor

@eerimoq @tmlbl I added #197 to address this issue. Please take a look.

@DataPacRat
Copy link

Compilation also fails at the same point when using:
gcc (GCC) 9.2.1 20190827 (Red Hat 9.2.1-1)

@ziotom78
Copy link

ziotom78 commented Feb 1, 2020

I confirm the same issue on my Linux Manjaro computer, running GCC 9.2.0:

$ gcc --version
gcc (GCC) 9.2.0
Copyright (C) 2019 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.


$ uname -a
Linux servername 5.4.13-3-MANJARO #1 SMP PREEMPT Mon Jan 20 18:17:25 UTC 2020 x86_64 GNU/Linux

$ lsb_release -a
LSB Version:	n/a
Distributor ID:	ManjaroLinux
Description:	Manjaro Linux
Release:	18.1.5
Codename:	Juhraya

@sug0
Copy link

sug0 commented May 29, 2020

It builds with clang, for people who come here with the same issue. Just do a make CC=clang and you're good.

@ilitzroth
Copy link

ilitzroth commented Jan 7, 2021

with clang --version
Ubuntu clang version 11.0.0-++20200929060912+dda0a1867cc-1exp120200929162359.110
Target: x86_64-pc-linux-gnu
Thread model: posix
InstalledDir: /usr/bin

make CC=clang
[ 1%] Building C object CMakeFiles/dill.dir/dns/dns.c.o
In file included from /home/immanuel/workspace/libdill/dns/dns.c:94:
/home/immanuel/workspace/libdill/dns/dns.c: In function 'dns_p_merge':
/home/immanuel/workspace/libdill/dns/dns.h:499:16: error: lvalue required as unary '&' operand
499 | dns_rr_i_init(&dns_quietinit((struct dns_rr_i){ 0, VA_ARGS }), (P))
...

@sug0
Copy link

sug0 commented Jan 7, 2021

@ilitzroth It worked for me:

clang version 11.0.0
Target: x86_64-unknown-linux-gnu
Thread model: posix
InstalledDir: /bin

Perhaps try these steps:

git clone https://github.com/sustrik/libdill
cd libdill
mkdir build
cd build
CC=clang cmake ..
make

@laoshaw
Copy link

laoshaw commented Mar 16, 2022

same issue here, why gcc-9/10/11 are all failing?

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

9 participants