The --host riscv64-unknown-linux-gnu flag looks to me like it might be a problem--since you're cross-compiling your build machine must not be RISC-V, right? Does it work if you remove that one flag?
On Sun, Nov 19, 2017 at 3:56 PM, Jerry Zhao <[email protected]> wrote: > I need a RISCV implementation of protobuf. I tried to follow the same > instructions for cross compiling ARM, but with the compilers set to the > RISCV compilers. > > I first ran > > ./configure > make > make install > make distclean > > This updated my protoc at /usr/local/bin/protoc. > Next I ran ./configure to target RISCV. > > ./configure CC=riscv64-unknown-linux-gnu-gcc \ > CXX=riscv64-unknown-linux-gnu-g++ \ > --target riscv64-unknown-linux-gnu \ > --host riscv64-unknown-linux-gnu \ > --with-protoc=/usr/local/bin/protoc > make > > The build proceeds normally, until I get the following error > Makefile:3601: update target 'protoc' due to: > google/protobuf/compiler/main.o libprotobuf.la libprotoc.la > rm -f protoc > /bin/bash ../libtool --tag=CXX --mode=link > riscv64-unknown-linux-gnu-g++ -pthread -DHAVE_PTHREAD=1 -Wall > -Wno-sign-compare -O2 -g -DNDEBUG -pthread -o protoc > google/protobuf/compiler/main.o -lpthread libprotobuf.la libprotoc.la > libtool: link: riscv64-unknown-linux-gnu-g++ -pthread -DHAVE_PTHREAD=1 > -Wall -Wno-sign-compare -O2 -g -DNDEBUG -pthread -o .libs/protoc > google/protobuf/compiler/main.o -lpthread ./.libs/libprotobuf.so > ./.libs/libprotoc.so -pthread -Wl,-rpath -Wl,/home/jerry/Documents/ > drive/Projects/protobuf/build/lib > ./.libs/libprotobuf.so: undefined reference to > `google::protobuf::internal::Release_CompareAndSwap(long volatile*, long, > long)' > collect2: error: ld returned 1 exit status > Makefile:3601: recipe for target 'protoc' failed > make[3]: *** [protoc] Error 1 > make[3]: Leaving directory '/home/jerry/Documents/drive/ > Projects/protobuf/src' > Makefile:2106: recipe for target 'all' failed > make[2]: *** [all] Error 2 > make[2]: Leaving directory '/home/jerry/Documents/drive/ > Projects/protobuf/src' > Makefile:1555: recipe for target 'all-recursive' failed > make[1]: *** [all-recursive] Error 1 > make[1]: Leaving directory '/home/jerry/Documents/drive/Projects/protobuf' > Makefile:1462: recipe for target 'all' failed > make: *** [all] Error 2 > > > > > I'm not sure why this is happening? libprotobuf should have compiled with > the atomic functions defined in src/google/protobuf/stubs/ > atomicops_internals_generic_gcc.h. Why would there be a linking error > here? > > > -- > You received this message because you are subscribed to the Google Groups > "Protocol Buffers" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/protobuf. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "Protocol Buffers" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/protobuf. For more options, visit https://groups.google.com/d/optout.
