open-iscsi / target-isns

Target-isns is an iSNS client for the Linux LIO iSCSI target
GNU General Public License v2.0
16 stars 19 forks source link

target-isns doesn't compile with GCC 10 #54

Closed maurizio-lombardi closed 4 years ago

maurizio-lombardi commented 4 years ago

There are multiple definitions of the "config" variable

[root@kvm-02-guest07 target-isns]# gcc --version gcc (GCC) 10.0.1 20200328 (Red Hat 10.0.1-0.11)

[root@kvm-02-guest07 build]# make Scanning dependencies of target ccan [ 5%] Building C object src/CMakeFiles/ccan.dir/ccan/daemonize/daemonize.c.o [ 11%] Building C object src/CMakeFiles/ccan.dir/ccan/list/list.c.o [ 16%] Linking C static library libccan.a [ 16%] Built target ccan Scanning dependencies of target target-isns [ 22%] Building C object src/CMakeFiles/target-isns.dir/configfs.c.o [ 27%] Building C object src/CMakeFiles/target-isns.dir/isns.c.o [ 33%] Building C object src/CMakeFiles/target-isns.dir/isns_proto.c.o [ 38%] Building C object src/CMakeFiles/target-isns.dir/itimer.c.o [ 44%] Building C object src/CMakeFiles/target-isns.dir/log.c.o [ 50%] Building C object src/CMakeFiles/target-isns.dir/util.c.o [ 55%] Building C object src/CMakeFiles/target-isns.dir/target-isns.c.o [ 61%] Linking C executable target-isns /usr/bin/ld: CMakeFiles/target-isns.dir/util.c.o:(.bss+0x0): multiple definition of config'; CMakeFiles/target-isns.dir/configfs.c.o:(.bss+0x0): first defined here /usr/bin/ld: CMakeFiles/target-isns.dir/target-isns.c.o:(.bss+0x0): multiple definition ofconfig'; CMakeFiles/target-isns.dir/configfs.c.o:(.bss+0x0): first defined here collect2: error: ld returned 1 exit status make[2]: [src/CMakeFiles/target-isns.dir/build.make:192: src/target-isns] Error 1 make[1]: [CMakeFiles/Makefile2:162: src/CMakeFiles/target-isns.dir/all] Error 2 make: *** [Makefile:147: all] Error 2

I attached a patch that should fix it, but I only compile-tested it target-fix2.txt

cvubrugier commented 4 years ago

Hi @maurizio-lombardi !

I applied your patch named target-fix2.txt and was able to build target-isns on Debian with the following preview version of GCC 10:

Then I managed to register an iSCSI target with target-isns to an Open-iSNS server running on the same host, so it seems to work.

Could you please create a merge request with your commit? I would like you to get credited for your work.

Thanks!