g++: error: unrecognized option ‘--end-group’ - g++

I had been using ubuntu 10.10 for quite some time as my development PC. My code was to build without error with g++ version 4.4.5. Recently I had upgraded my system to 11.10 which has come with g++ version 4.6.1
Now , using this compiler, when I am trying to build the same piece of code, I am getting this error:
g++: error: unrecognized option ‘--end-group’
The Make file line, where this error is thrown is:
$(TARGET): $(OBJS)
g++ $(LDFLAGS) $^ $ -Wl,--start-group $(ARCHIVE_LIBS) --end-group -o $(TARGET)
cp -f $(TARGET) ../../../bin/
Can some please throw some light on this? I had googled but I did not get any clue?
Thanks and Regards,
Souvik

--end-group is a linker flag so you should prefix it with -Wl, i.e.
g++ $(LDFLAGS) $^ $ -Wl,--start-group $(ARCHIVE_LIBS) -Wl,--end-group -o $(TARGET)
I am not sure why this worked before.

Related

Redis build failure

I'm attempting to build redis on my aws linux server in order to get access to the redis-cli and connect to my redis instance which is also running successfully in aws.
my gcc is:
gcc version 4.8.5 20150623 (Red Hat 4.8.5-28) (GCC)
I downloaded the source and started the build:
wget http://download.redis.io/redis-stable.tar.gz
tar xvzf redis-stable.tar.gz
cd redis-stable
make distclean
make
It built the dependencies and then gave me this:
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/tsd.o src/tsd.c
gcc -std=gnu99 -Wall -pipe -g3 -O3 -funroll-loops -c -D_GNU_SOURCE -D_REENTRANT -Iinclude -Iinclude -o src/witness.o src/witness.c
ar crus lib/libjemalloc.a src/jemalloc.o src/arena.o src/background_thread.o src/base.o src/bin.o src/bitmap.o src/ckh.o src/ctl.o src/div.o src/extent.o src/extent_dss.o src/extent_mmap.o src/hash.o src/hooks.o src/large.o src/log.o src/malloc_io.o src/mutex.o src/mutex_pool.o src/nstime.o src/pages.o src/prng.o src/prof.o src/rtree.o src/stats.o src/sz.o src/tcache.o src/ticker.o src/tsd.o src/witness.o
make[3]: Leaving directory `/home/ec2-user/redis-stable/deps/jemalloc'
make[2]: Leaving directory `/home/ec2-user/redis-stable/deps'
CC adlist.o
CC quicklist.o
CC ae.o
CC anet.o
CC dict.o
CC server.o
In file included from server.c:30:0:
server.h:1044:5: error: expected specifier-qualifier-list before ‘_Atomic’
_Atomic unsigned int lruclock; /* Clock for LRU eviction */
^
server.c: In function ‘serverLogRaw’:
server.c:1028:31: error: ‘struct redisServer’ has no member named ‘logfile’
int log_to_stdout = server.logfile[0] == '\0';
^
server.c:1031:23: error: ‘struct redisServer’ has no member named ‘verbosity’
if (level < server.verbosity) return;
^
server.c:1033:47: error: ‘struct redisServer’ has no member named ‘logfile’
fp = log_to_stdout ? stdout : fopen(server.logfile,"a");
...and a lot more
I assume that I must have done something wrong as this is code that undoubtedly builds for everyone else. I'm a java developer with little to no c background. Any pointers will be appreciated.
Jay
Appears that gcc >= 4.9 is required to build redis 6x ...
Problem here is latest Redis version(6.0.7) depends on _Atomic which is not supported in older gcc 4.8.5.
One can also compile latest Redis code with clang if updating gcc version is not possible.
$ cd redis-stable
$ CC=clang make
i have successed.
at first i want to install gcc6, but failed again and agin, then i notise that,devtoolset-6 is deprecated. Maybe you should try -7 or -8.
then i use the flow cmd and it worked
yum install -y devtoolset-6-gcc devtoolset-7-gcc-c++
so i hope it can also help you
Thanks for the responses. The solution I ended up with was to build a new server with CentOS8 and gcc 8.3.1. This combination built the redis server 6.0.3 with no issues. Moral: you need to have up to date infra and software in order to properly build new software.
Download older version, seems some issue with 6.0.*
That worked for me on ubunt 14.04 LTS

g++ error: Cannot specify -static with -fsanitize=address

I am trying to use address sanitizer with g++ and during the build it produces the following linker command, which produces the error g++: error: cannot specify -static with -fsanitize=address
I don't understand what this means, so any help is appreciated. The g++ version is g++ (GCC) 8.3.0 20190222 (Cray Inc.).
g++ -g -fsanitize=address CMakeFiles/pisa.dir/src/Alphabet.cpp.o {more .o files} -o pisa -L/global/homes/e/esaliya/sali/git/bitbucket/combinatorial-blas-2.0/CombBLAS/_install/lib -Wl,-rpath,/global/homes/e/esaliya/sali/git/bitbucket/combinatorial-blas-2.0/CombBLAS/_install/lib -lCombBLAS -lGraphGenlib -lUsortlib

can't MAKE tensorflow Raspberry pi examples

I installed tensorflow on the Raspberry Pi 3, running Jessie and did that in two ways, via the .whl file / pip install for Python 2.7.:
https://github.com/samjabrahams/tensorflow-on-raspberry-pi
as well as a full compile via:
https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/makefile
Both installs (I did them on different OS images) where successfull and went through without error.
Next, I wanted to compile the official Raspberry Pi examples from tensorflow's git repository:
https://github.com/tensorflow/tensorflow/tree/master/tensorflow/contrib/pi_examples
However, none of the examples does compile (neither the camera example nor the image recognition), both give the same error and Google doesn't tell me anything:
make -f tensorflow/contrib/pi_examples/camera/Makefile gcc --std=c++11
-O0 -I/usr/local/include -I. -I/home/pi/tensorflow/tensorflow/contrib/pi_examples/camera/../../makefile/downloads
-I/home/pi/tensorflow/tensorflow/contrib/pi_examples/camera/../../makefile/downloads/eigen/
-I/home/pi/tensorflow/tensorflow/contrib/pi_examples/camera/../../makefile/gen/proto/
-I/home/pi/tensorflow/tensorflow/contrib/pi_examples/camera/../../makefile/gen/proto_text/
-c tensorflow/contrib/pi_examples/camera/camera.cc -o /home/pi/tensorflow/tensorflow/contrib/pi_examples/camera/gen/obj/tensorflow/contrib/pi_examples/camera/camera.o
In file included from ./tensorflow/core/platform/mutex.h:31:0,
from ./tensorflow/core/framework/variant.h:31,
from ./tensorflow/core/framework/allocator.h:26,
from ./tensorflow/core/framework/tensor.h:20,
from tensorflow/contrib/pi_examples/camera/camera.cc:33:
./tensorflow/core/platform/default/mutex.h:25:22: fatal error:
nsync_cv.h: No such file or directory #include "nsync_cv.h"
^ compilation terminated. tensorflow/contrib/pi_examples/camera/Makefile:80: recipe for target
'/home/pi/tensorflow/tensorflow/contrib/pi_examples/camera/gen/obj/tensorflow/contrib/pi_examples/camera/camera.o'
failed make: ***
[/home/pi/tensorflow/tensorflow/contrib/pi_examples/camera/gen/obj/tensorflow/contrib/pi_examples/camera/camera.o]
Error 1
as well as:
make -f tensorflow/contrib/pi_examples/label_image/Makefile gcc
--std=c++11 -O0 -I/usr/local/include -I. -I/home/pi/tensorflow/tensorflow/contrib/pi_examples/label_image/../../makefile/downloads
-I/home/pi/tensorflow/tensorflow/contrib/pi_examples/label_image/../../makefile/downloads/eigen/
-I/home/pi/tensorflow/tensorflow/contrib/pi_examples/label_image/../../makefile/gen/proto/
-I/home/pi/tensorflow/tensorflow/contrib/pi_examples/label_image/../../makefile/gen/proto_text/
-c tensorflow/contrib/pi_examples/label_image/label_image.cc -o /home/pi/tensorflow/tensorflow/contrib/pi_examples/label_image/gen/obj/tensorflow/contrib/pi_examples/label_image/label_image.o
In file included from ./tensorflow/core/platform/mutex.h:31:0,
from ./tensorflow/core/framework/variant.h:31,
from ./tensorflow/core/framework/allocator.h:26,
from ./tensorflow/core/framework/tensor.h:20,
from tensorflow/contrib/pi_examples/label_image/label_image.cc:33:
./tensorflow/core/platform/default/mutex.h:25:22: fatal error:
nsync_cv.h: No such file or directory #include "nsync_cv.h"
^ compilation terminated. tensorflow/contrib/pi_examples/label_image/Makefile:79: recipe for
target
'/home/pi/tensorflow/tensorflow/contrib/pi_examples/label_image/gen/obj/tensorflow/contrib/pi_examples/label_image/label_image.o'
failed make: ***
[/home/pi/tensorflow/tensorflow/contrib/pi_examples/label_image/gen/obj/tensorflow/contrib/pi_examples/label_image/label_image.o]
Error 1
How can I locate / add / compile "nsync_cv.h"?
And btw:
export HOST_NSYNC_LIB=`tensorflow/contrib/makefile/compile_nsync.sh`
gives me:
g++ -M -std=c++11 -DNSYNC_USE_CPP11_TIMEPOINT -DNSYNC_ATOMIC_CPP11
-I../../platform/c++11 -I../../platform/gcc -I../../platform/posix -pthread -I../../public -I../../internal ../../internal/*.c ../../testing/*.c ../../platform/c++11/src/nsync_semaphore_mutex.cc
../../platform/c++11/src/per_thread_waiter.cc
../../platform/c++11/src/yield.cc
../../platform/c++11/src/time_rep_timespec.cc
../../platform/c++11/src/nsync_panic.cc \
../../platform/c++11/src/start_thread.cc > dependfile make: 'nsync.a' is up to date.
I once compiled tensorflow with the makefile on a nvidia Jetson TX1 and I could compile and run the examples by adding some lines to the Makefiles of the examples:
after line 18:
NSYNCLIBDIR := $(TFMAKEFILE_DIR)/downloads/nsync/builds/default.linux.c++11 !!!change folder default.linux.c++11 to where your libnsync.a is!!!
NSYNCLIBS := $(NSYNCLIBDIR)/libnsync.a
after line 26:
NSYNC := $(TFMAKEFILE_DIR)/downloads/nsync/public/
after line 36:
-L$(NSYNCLIBDIR) \
after line 43:
-I$(NSYNC) \
after line 51:
-lnsync \
change line 72 to:
$(EXECUTABLE_NAME): $(EXECUTABLE_OBJS) $(TFLIBS) $(NSYNCLIBS)
Hope it works with that changes, good luck :)

CMake on Cygwin with clang not creating expected dll.a

I'm building a shared library and an application using that lib on Cygwin. With GCC CMake creates a .dll.a to use when linking. Switching to clang I get
[ 34%] Built target xxx_shared
make[2]: *** No rule to make target 'src/libxxx.dll.a', needed by 'xxx.exe'. Stop.
Is this a bug in the clang CMake extension?
I'm using cmake --version 3.3.2
Yes, it seems to be a bug in CMake. Running make VERBOSE=1 reveals that with GCC:
/usr/bin/c++.exe -g -shared -Wl,--enable-auto-import -o XXX -Wl,-Bstatic -lm -Wl,-Bdynamic -lstdc++ -lcygwin -ladvapi32 -lshell32 -luser32 -lkernel32
while with clang:
/usr/bin/clang++ -fPIC -g -shared -o XXX -Wl,-Bstatic -lm -Wl,-Bdynamic -lstdc++ -lcygwin -ladvapi32 -lshell32 -luser32 -lkernel32
So it seems that somehow clang++ does not get the -Wl,--enable-auto-import flag. Manually running the corrected clang++ command correctly creates the expected .dll.a allowing the rest of the build to proceed as expected.
Haven't figured out why this happens yet, though. At this point I can't decipher CMakes platform extensions, which seems to set this for GCC.
Update: I've reported this here.

gfortran cannot read its own creation

I am trying to compile a code with gfortran. One of the first things that happens in the compilation is the creation of constants.mod. Soon after that gfortran tells me:
Fatal Error: Cannot read module file ‘constants.mod’ opened at (1), because it was created by a different version of GNU Fortran
Now here's the thing: This module file is created by the same gfortran that it's trying to read it. gfortran creates the thing itself and then 1 second later thinks the file was created by some other version! Any idea what's going on here?
You'll probably want to see the compile command:
mpif90 -c -O3 -ISDF/FORTRAN/include -I/usr/include -Iobj -Jobj -o obj/shared_data.o src/core/shared_data.F90
shared_data.F90 contains the module constants at the top of the file.
EDIT: Here's the compile command followed by the full error message:
$> mpif90 -c -O3 -ISDF/FORTRAN/include -I/usr/include -Iobj -Jobj -o obj/shared_data.o src/core/shared_data.F90
src/core/shared_data.F90:67:6:
USE constants
1
Fatal Error: Cannot read module file ‘constants.mod’ opened at (1), because it was created by a different version of GNU Fortran
compilation terminated.
UPDATE: I hope you'll agree this is weird. The file that is failing is in src/core. If I cd to src/core and issue this command:
mpif90 -c -O3 -I../../SDF/FORTRAN/include -I../../obj -J../../obj -o ../../obj/shared_data.o shared_data.F90
it compiles just fine! But then I clean everything out of the obj directory and I cd two levels up and issue:
mpif90 -c -O3 -ISDF/FORTRAN/include -Iobj -Jobj -o shared_data.o src/core/shared_data.F90
and it fails with the error I showed above! What is the difference??? Thanks.