Ticket #700 (closed defect: fixed)

Opened 3 months ago

Last modified 2 months ago

CentOS 6.8 fails with default ew_linux.bash

Reported by: stefan Owned by: somebody
Priority: major Milestone: Linux
Component: ALL modules Version: 7.10
Keywords: Cc:

Description

CentOS 7 works fine, but 6.8 with a fresh download gives me the following error.

Same error whether EW_BITS=64 or if it is unset.

-*-*-*-*-*-*-*-*-*-*
Earthworm build info
-*-*-*-*-*-*-*-*-*-*
cd diagnostic_tools/buildinfo && \
                make -f makefile.unix clean ; \
                make -f makefile.unix clean_bin ; \
                make -f makefile.unix
make[1]: Entering directory `/opt/earthworm/earthworm_svn/src/diagnostic_tools/buildinfo'
rm -f a.out core *.o *.obj *% *~
make[1]: Leaving directory `/opt/earthworm/earthworm_svn/src/diagnostic_tools/buildinfo'
make[1]: Entering directory `/opt/earthworm/earthworm_svn/src/diagnostic_tools/buildinfo'
rm -f /opt/earthworm/earthworm_svn/bin/buildinfo*
make[1]: Leaving directory `/opt/earthworm/earthworm_svn/src/diagnostic_tools/buildinfo'
make[1]: Entering directory `/opt/earthworm/earthworm_svn/src/diagnostic_tools/buildinfo'
gcc  -g -D_LINUX -Dlinux -D_INTEL -D_USE_SCHED -pthread -D_USE_PTHREADS -D_USE_TERMIOS -D_FILE_OFFSET_BITS=64 -I/opt/earthworm/earthworm_svn/include -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unknown-pragmas -Wno-pragmas -Wformat -Wdeclaration-after-statement -m32 -Dlinux -D__i386 -D_LINUX -D_INTEL -D_USE_SCHED  -D_USE_PTHREADS -D_USE_TERMIOS -I/opt/earthworm/earthworm_svn/include  -c -o unixbuildinfo.o unixbuildinfo.c
gcc -o /opt/earthworm/earthworm_svn/bin/buildinfo  -g -D_LINUX -Dlinux -D_INTEL -D_USE_SCHED -pthread -D_USE_PTHREADS -D_USE_TERMIOS -D_FILE_OFFSET_BITS=64 -I/opt/earthworm/earthworm_svn/include -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unknown-pragmas -Wno-pragmas -Wformat -Wdeclaration-after-statement unixbuildinfo.o -lpthread
unixbuildinfo.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make[1]: *** [/opt/earthworm/earthworm_svn/bin/buildinfo] Error 1
make[1]: Leaving directory `/opt/earthworm/earthworm_svn/src/diagnostic_tools/buildinfo'
make: *** [unix_buildinfo] Error 2

Change History

comment:1 Changed 3 months ago by baker

Stefan,

I build everything when I am at home on a CentOS 6.10 system. When I am at work, I build everything on a CentOS 7 system. I follow these steps:

CentOS 7 x86_64 (aqms)
----------------------
$ cd ~/Software/Earthworm
$ rm -f -r earthworm-svn
$ svn checkout svn://svn.isti.com/earthworm/trunk earthworm-svn
$ export EW_REV=rev
$ rm -f -r earthworm-7.10-${EW_REV}
$ svn export -r ${EW_REV} earthworm-svn earthworm-7.10-${EW_REV}

>>> to start over later <<<

$ tar -cjf earthworm-7.10-${EW_REV}-src.tar.bz2 earthworm-7.10-${EW_REV}

>>> to start over from saved tar file <<<

$ cd ~/Software/Earthworm
$ export EW_REV=rev
$ rm -r earthworm-7.10-${EW_REV}
$ tar -xjf earthworm-7.10-${EW_REV}-src.tar.bz2

$ ARCH=`uname -m`
$ EW_INSTALL_HOME="`pwd`" \
  EW_INSTALL_VERSION=earthworm-7.10-${EW_REV} \
  EW_INSTALL_BITS=32 \
  source earthworm-7.10-${EW_REV}/environment/ew_linux.bash
$ cd earthworm-7.10-${EW_REV}/src
$ make clean_unix 2>&1 | grep '[*][*][*]'
$ make clean_bin_unix 2>&1 | grep '[*][*][*]'
$ make unix &>../../make-centos-${ARCH}-${EW_BITS}.log
$ tail ../../make-centos-${ARCH}-${EW_BITS}.log
$ grep -i ': err' ../../make-centos-${ARCH}-${EW_BITS}.log
$ grep '[*][*][*]' ../../make-centos-${ARCH}-${EW_BITS}.log

Except that I normally do all the SVN downloads and edits on my Mac, then pass a ZIP file around to build from the identical sources on all my platforms. At home, I build 32-bit and 64-bit on MacOS 10.13.6, CentOS Linux 6.10, and Windows 7 Enterprise. At work, I build 32-bit and 64-bit on MacOS 10.11.6, CentOS 7.?, Ubuntu 14.04.5 LTS, Windows 7 Enterprise, SPARC Solaris ? (Sun C 5.12), and 32-bit on ARM Debian 7.

What exactly are the steps you use that fail?

comment:2 Changed 3 months ago by baker

Stefan,

I can confirm that the error is caused by your environment settings. Your login shell script must be sourcing a stale version of ew_linux.bash which exports CPPFLAGS.

When CPPFLAGS is not defined in the environment, the buildinfo build with unspecified EW_INSTALL_BITS (no -m32 or -m64) works fine:

# env | grep FLAGS
GLOBALFLAGS= -g -D_LINUX -Dlinux -D_INTEL -D_USE_SCHED -pthread -D_USE_PTHREADS -D_USE_TERMIOS -D_FILE_OFFSET_BITS=64 -I/opt/earthworm/earthworm-7.10-7869/include -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unknown-pragmas -Wno-pragmas -Wformat -Wdeclaration-after-statement
CXXFLAGS= -g -D_LINUX -Dlinux -D_INTEL -D_USE_SCHED -pthread -D_USE_PTHREADS -D_USE_TERMIOS -D_FILE_OFFSET_BITS=64 -I/opt/earthworm/earthworm-7.10-7869/include -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unknown-pragmas -Wno-pragmas -Wformat -Wdeclaration-after-statement
CFLAGS= -g -D_LINUX -Dlinux -D_INTEL -D_USE_SCHED -pthread -D_USE_PTHREADS -D_USE_TERMIOS -D_FILE_OFFSET_BITS=64 -I/opt/earthworm/earthworm-7.10-7869/include -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unknown-pragmas -Wno-pragmas -Wformat -Wdeclaration-after-statement
FFLAGS= -O -g -Wuninitialized -Werror=line-truncation -ffpe-trap=invalid,zero,overflow -fbacktrace

# make -f makefile.unix clean
rm -f a.out core *.o *.obj *% *~

# make -f makefile.unix clean_bin
rm -f /opt/earthworm/earthworm-7.10-7869/bin/buildinfo /opt/earthworm/earthworm-7.10-7869/bin/buildinfo.exe

# make -f makefile.unix
gcc  -g -D_LINUX -Dlinux -D_INTEL -D_USE_SCHED -pthread -D_USE_PTHREADS -D_USE_TERMIOS -D_FILE_OFFSET_BITS=64 -I/opt/earthworm/earthworm-7.10-7869/include -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unknown-pragmas -Wno-pragmas -Wformat -Wdeclaration-after-statement   -c -o unixbuildinfo.o unixbuildinfo.c
gcc -o /opt/earthworm/earthworm-7.10-7869/bin/buildinfo  -g -D_LINUX -Dlinux -D_INTEL -D_USE_SCHED -pthread -D_USE_PTHREADS -D_USE_TERMIOS -D_FILE_OFFSET_BITS=64 -I/opt/earthworm/earthworm-7.10-7869/include -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unknown-pragmas -Wno-pragmas -Wformat -Wdeclaration-after-statement unixbuildinfo.o -lpthread

When I export CPPFLAGS to the environment using the values I saw in your build, the same error results:

# export CPPFLAGS="-m32 -Dlinux -D__i386 -D_LINUX -D_INTEL -D_USE_SCHED  -D_USE_PTHREADS -D_USE_TERMIOS -I/opt/earthworm/earthworm_svn/include"

# env | grep FLAGS
CPPFLAGS=-m32 -Dlinux -D__i386 -D_LINUX -D_INTEL -D_USE_SCHED  -D_USE_PTHREADS -D_USE_TERMIOS -I/opt/earthworm/earthworm_svn/include
GLOBALFLAGS= -g -D_LINUX -Dlinux -D_INTEL -D_USE_SCHED -pthread -D_USE_PTHREADS -D_USE_TERMIOS -D_FILE_OFFSET_BITS=64 -I/opt/earthworm/earthworm-7.10-7869/include -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unknown-pragmas -Wno-pragmas -Wformat -Wdeclaration-after-statement
CXXFLAGS= -g -D_LINUX -Dlinux -D_INTEL -D_USE_SCHED -pthread -D_USE_PTHREADS -D_USE_TERMIOS -D_FILE_OFFSET_BITS=64 -I/opt/earthworm/earthworm-7.10-7869/include -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unknown-pragmas -Wno-pragmas -Wformat -Wdeclaration-after-statement
CFLAGS= -g -D_LINUX -Dlinux -D_INTEL -D_USE_SCHED -pthread -D_USE_PTHREADS -D_USE_TERMIOS -D_FILE_OFFSET_BITS=64 -I/opt/earthworm/earthworm-7.10-7869/include -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unknown-pragmas -Wno-pragmas -Wformat -Wdeclaration-after-statement
FFLAGS= -O -g -Wuninitialized -Werror=line-truncation -ffpe-trap=invalid,zero,overflow -fbacktrace

# make -f makefile.unix clean
rm -f a.out core *.o *.obj *% *~

# make -f makefile.unix clean_bin
rm -f /opt/earthworm/earthworm-7.10-7869/bin/buildinfo /opt/earthworm/earthworm-7.10-7869/bin/buildinfo.exe

# make -f makefile.unix
gcc  -g -D_LINUX -Dlinux -D_INTEL -D_USE_SCHED -pthread -D_USE_PTHREADS -D_USE_TERMIOS -D_FILE_OFFSET_BITS=64 -I/opt/earthworm/earthworm-7.10-7869/include -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unknown-pragmas -Wno-pragmas -Wformat -Wdeclaration-after-statement -m32 -Dlinux -D__i386 -D_LINUX -D_INTEL -D_USE_SCHED  -D_USE_PTHREADS -D_USE_TERMIOS -I/opt/earthworm/earthworm_svn/include  -c -o unixbuildinfo.o unixbuildinfo.c
gcc -o /opt/earthworm/earthworm-7.10-7869/bin/buildinfo  -g -D_LINUX -Dlinux -D_INTEL -D_USE_SCHED -pthread -D_USE_PTHREADS -D_USE_TERMIOS -D_FILE_OFFSET_BITS=64 -I/opt/earthworm/earthworm-7.10-7869/include -Wall -Wextra -Wno-sign-compare -Wno-unused-parameter -Wno-unknown-pragmas -Wno-pragmas -Wformat -Wdeclaration-after-statement unixbuildinfo.o -lpthread
unixbuildinfo.o: could not read symbols: File in wrong format
collect2: ld returned 1 exit status
make: *** [/opt/earthworm/earthworm-7.10-7869/bin/buildinfo] Error 1

This is operator error. Sorry.

comment:3 Changed 3 months ago by baker

Stefan,

If you confirm my diagnosis and can cure your problem, then go ahead and close this ticket "worksforme." If not, let me know and we'll figure out what to do next.

comment:4 Changed 2 months ago by stefan

I never use environment variables for my Earthworm compile, I always use ew_linux.bash from the most recent distribution, and I expect it to override any environment variables I may have set, as long as I don't use these lines: EW_VERSION="${EW_INSTALL_VERSION:-earthworm_7.10}" which use values from the environment. I make a copy of it every time I do a new svn checkout, and put in my path and version numbers. I did that in this case.

I assumed if I set EW_BITS manually in ew_linux.bash, it would override anything in the environment saying otherwise, because there's no syntax like this for EW_BITS: export EW_VERSION="${EW_INSTALL_VERSION:-earthworm_7.10}" or EW_BITS="${EW_BITS:-32}" which tells me that the environment will override my setting, if I don't set it here.

In this case, my environment was sourcing an old ew_linux.bash, and when I went to source the new ew_linux.bash, it didn't override my old settings -- CPPFLAGS as you correctly diagnosed -- and this was messing up my compile. Once I removed that .bash_profile source, I was able to compile on 6.8 both 32 and 64 bit versions. Great! I still think the ew_linux.bash file should make sure 32 or 64 bit is set properly throughout the compile flags, if one sets EW_BITS at the top.

comment:5 Changed 2 months ago by baker

EW_BITS is being correctly set in ew_linux.bash. Take a look at the comments at the top of the file about whether you want to enable the option to have it deduce the correct value. Whether that is enabled or not, it always honors the EW_INSTALL_BITS "default", which has been there for quite a while. That is how EW_BITS gets set later in the file.

The reason your compile had the wrong -m32 is because of the CPPFLAGS value your old copy of ew_linux.bash set. That stale ew_linux.bash set CPPFLAGS assuming that meant C++ flags. On Linux, CPPFLAGS are C preprocessor flags;CXXFLAGS are C++ flags.

I will modify the Unix/Linux? environment scripts to explicitly unset CPPFLAGS so your existing environment settings will not be inherited for the Earthworm build.

comment:6 Changed 2 months ago by baker

  • Status changed from new to closed
  • Resolution set to fixed

The reason your manual setting of EW_BITS in ew_linux.bash didn't work is that the *nix environment shell scripts always define EW_BITS; they override whatever might exist in the environment or that you edit at the top of the script. That change was made 2 years ago in r6876.

Here's some info about how EW_BITS is set and used now.

The qlib2 Makefile has separate targets for 32-bit and 64-bit builds. I use EW_BITS to select the correct target for the Earthworm build. Ergo, we have to know what EW_BITS is during the build.

What we used to do was define EW_BITS from EW_INSTALL_BITS (after r6876) and use that to define the -m32 or -m64 C compiler option to select the target processor. That was set in GLOBALFLAGS as TARGET=-m${EW_BITS}. That both defined EW_BITS for the qlib2 Makefile and selected the target processor for the compiles. This works fine for x86 gcc and SPARC cc. It does not work for ARM gcc.

On ARM, 32-bit and 64-bit gcc are separate compilers; there is no -m32 or -m64 option. The TARGET shell variable is of no use; you get the target processor the gcc compiler was built for. The trouble is, we still need to define EW_BITS for the qlib2 Makefile. For ARM, instead of using EW_BITS to select the target processor, we have to do the opposite: we have to set EW_BITS based on the target processor of the gcc compiler being used. I modified the ARM environment shell script to deduce the target processor and to use that to set EW_BITS.

I retrofitted the portion of the ARM script that deduces EW_BITS and made that an optional feature of the MacOS, Linux, and Solaris scripts. I enabled that option by default, so that users can build an Earthworm that targets the processor on their system without having to specify whether it is 32 or 64 bits.

Based on what happened to you, I modified the *nix environment shell scripts to define the appropriate flags variables that get used by gmake (MacOS and Linux) and make (Solaris). Both gmake and make use CFLAGS for the C compiler flags and CPPFLAGS for the C Preprocesor flags. gmake uses CXXFLAGS for the C++ compiler flags; make uses CCFLAGS. I made sure they all get defined appropriately. I changed the order of the definitions so that GLOBALFLAGS="${CFLAGS} ${CPPFLAGS}" is at the end.

These should be an improvement. I am going to close the ticket as fixed. You can reopen it if you find this does not fix the problem after you restore your ~/.bash_profile back the way it was.

Fixed in r7914.

Note: See TracTickets for help on using tickets.