[ovs-dev] cmap.c gcc 4.9 compile error

Kmindg G kmindg at gmail.com
Wed May 21 06:20:08 UTC 2014


Hi Ben,
When I compile ovs src on the master branch with gcc 4.9, I get this error:

libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I ./include -I ./lib -I
./lib -I/usr/include -Wstrict-prototypes -Wall -Wextra
-Wno-sign-compare -Wpointer-arith -Wdeclaration-after-statement
-Wno-format-zero-length -Wswitch-enum -Wunused-parameter
-Wstrict-aliasing -Wbad-function-cast -Wcast-align
-Wmissing-prototypes -Wmissing-field-initializers -g -O2 -MT
lib/cmap.lo -MD -MP -MF lib/.deps/cmap.Tpo -c lib/cmap.c -o lib/cmap.o
In file included from lib/ovs-atomic-c11.h:23:0,
                 from lib/ovs-atomic.h:252,
                 from lib/ovs-rcu.h:110,
                 from lib/cmap.h:22,
                 from lib/cmap.c:18:
lib/cmap.c: In function 'cmap_find':
lib/ovs-atomic-c11.h:31:15: error: invalid memory model for '__atomic_load'
     (*(DST) = atomic_load_explicit(SRC, ORDER), \
               ^
lib/cmap.c:252:5: note: in expansion of macro 'atomic_read_explicit'
     atomic_read_explicit(&bucket->counter, &counter, order);
     ^
lib/ovs-atomic-c11.h:31:15: error: invalid memory model for '__atomic_load'
     (*(DST) = atomic_load_explicit(SRC, ORDER), \
               ^
lib/cmap.c:252:5: note: in expansion of macro 'atomic_read_explicit'
     atomic_read_explicit(&bucket->counter, &counter, order);
     ^
lib/ovs-atomic-c11.h:31:15: error: invalid memory model for '__atomic_load'
     (*(DST) = atomic_load_explicit(SRC, ORDER), \
               ^
lib/cmap.c:252:5: note: in expansion of macro 'atomic_read_explicit'
     atomic_read_explicit(&bucket->counter, &counter, order);
     ^
lib/ovs-atomic-c11.h:31:15: error: invalid memory model for '__atomic_load'
     (*(DST) = atomic_load_explicit(SRC, ORDER), \
               ^
lib/cmap.c:252:5: note: in expansion of macro 'atomic_read_explicit'
     atomic_read_explicit(&bucket->counter, &counter, order);
     ^
Makefile:3007: recipe for target 'lib/cmap.lo' failed
make[2]: *** [lib/cmap.lo] Error 1
make[2]: Leaving directory '/home/agong/src/openvswitch'
Makefile:3547: recipe for target 'all-recursive' failed
make[1]: *** [all-recursive] Error 1
make[1]: Leaving directory '/home/agong/src/openvswitch'
Makefile:1886: recipe for target 'all' failed
make: *** [all] Error 2


After look into cmap.c, I think that you might have a typo in counter_changed:
static bool
counter_changed(struct cmap_bucket *b, uint32_t c)
{
     return OVS_UNLIKELY(read_counter(b, memory_order_release) != c);
    //  you probably meant  memory_order_acquire ?
}



➜  ~  gcc -v
Using built-in specs.
COLLECT_GCC=gcc
COLLECT_LTO_WRAPPER=/usr/lib/gcc/x86_64-unknown-linux-gnu/4.9.0/lto-wrapper
Target: x86_64-unknown-linux-gnu
Configured with: /build/gcc/src/gcc-4.9-20140507/configure
--prefix=/usr --libdir=/usr/lib --libexecdir=/usr/lib
--mandir=/usr/share/man --infodir=/usr/share/info
--with-bugurl=https://bugs.archlinux.org/
--enable-languages=c,c++,ada,fortran,go,lto,objc,obj-c++
--enable-shared --enable-threads=posix --with-system-zlib
--enable-__cxa_atexit --disable-libunwind-exceptions
--enable-clocale=gnu --disable-libstdcxx-pch --disable-libssp
--enable-gnu-unique-object --enable-linker-build-id
--enable-cloog-backend=isl --disable-cloog-version-check --enable-lto
--enable-plugin --enable-install-libiberty
--with-linker-hash-style=gnu --disable-multilib --disable-werror
--enable-checking=release
Thread model: posix
gcc version 4.9.0 20140507 (prerelease) (GCC)


Thanks,
Kmindg



More information about the dev mailing list