cms-gem-daq-project / xhal

XHAL interface library
0 stars 10 forks source link

Makefiles are misbehaving #128

Closed lmoureaux closed 4 years ago

lmoureaux commented 5 years ago

Brief summary of issue

Various Makefile in this project can't handle more than one cpp file.

Steps to reproduce

git checkout d1f8b3d8efa7693418773a923f4c2388129130fb # current develop
make # works
echo "int test() { return 0; }" > xhalcore/common/utils/test.cpp
make # broken

Error message for xhalarm is:

arm-linux-gnueabihf-gcc -fomit-frame-pointer -pipe -fno-common -fno-builtin -Wall -std=c++14 -march=armv7-a -mfpu=neon -mfloat-abi=hard -mthumb-interwork -mtune=cortex-a9 -DEMBED -Dlinux -D__linux__ -Dunix -fPIC --sysroot=/data/bigdisk/sw/peta-stage -I/data/bigdisk/sw/peta-stage/usr/include -I/data/bigdisk/sw/peta-stage/include -std=gnu++14 -I/afs/cern.ch/work/l/lmoureau/GEM/test/xhal/xhalcore/include -c -o src/linux/arm/utils/XHALXMLParser.o /afs/cern.ch/work/l/lmoureau/GEM/test/xhal/xhalcore/src/common/utils/test.cpp
arm-linux-gnueabihf-gcc -std=gnu++14 -L/data/bigdisk/sw/peta-stage/lib -L/data/bigdisk/sw/peta-stage/usr/lib -L/data/bigdisk/sw/peta-stage/ncurses -shared  -o /afs/cern.ch/work/l/lmoureau/GEM/test/xhal/xhalarm/lib/libxhal.so src/linux/arm/utils/test.o src/linux/arm/utils/XHALXMLParser.o -llog4cplus -lxerces-c -lstdc++
src/linux/arm/utils/XHALXMLParser.o: In function `test()':
test.cpp:(.text+0x0): multiple definition of `test()'
src/linux/arm/utils/test.o:test.cpp:(.text+0x0): first defined here
collect2: error: ld returned 1 exit status

If I don't try to compile xhalarm, I get a failure in xhalcore:

mkdir -p src/linux/x86_64/utils
gcc -O0 -g3 -fno-inline -Wall -pthread -fPIC -std=c++11 -m64 -I/usr/include/python2.7 -I/opt/xdaq/include -I/afs/cern.ch/work/l/lmoureau/GEM/test/xhal/xhalcore/include -c src/common/utils/test.cpp -o src/linux/x86_64/utils/test.o
mkdir -p src/linux/x86_64/utils
gcc -O0 -g3 -fno-inline -Wall -pthread -fPIC -std=c++11 -m64 -I/usr/include/python2.7 -I/opt/xdaq/include -I/afs/cern.ch/work/l/lmoureau/GEM/test/xhal/xhalcore/include -c src/common/utils/test.cpp -o src/linux/x86_64/utils/XHALXMLParser.o
mkdir -p /afs/cern.ch/work/l/lmoureau/GEM/test/xhal/xhalcore/lib
gcc -fPIC -std=c++11 -m64 -shared -L/opt/xdaq/lib -L/opt/wiscrpcsvc/lib -o /afs/cern.ch/work/l/lmoureau/GEM/test/xhal/xhalcore/lib/libxhal.so src/linux/x86_64/utils/test.o src/linux/x86_64/utils/XHALXMLParser.o src/linux/x86_64/XHALDevice.o src/linux/x86_64/XHALInterface.o -llog4cplus -lxerces-c -lwiscrpcsvc -lstdc++
gcc: error: src/linux/x86_64/utils/test.o: No such file or directory
make[1]: *** [/afs/cern.ch/work/l/lmoureau/GEM/test/xhal/xhalcore/lib/libxhal.so] Error 1
make[1] : leaving directory "/afs/cern.ch/work/l/lmoureau/GEM/test/xhal/xhalcore"
make: *** [xhalcore] Error 2

Types of issue

Expected Behavior

Integrating new source files is seamless.

Current Behavior

Can't understand how to add new source files.

Possible Solution (for bugs)

[troll mode on] Switch over to CMake? [troll mode off]

Context (for feature requests)

Working on build system for #125

Your Environment

jsturdy commented 5 years ago

Hmm, quite the humdinger, I'd propose to simplify the Makefile a la what is the current Makefile in ctp7_modules, because this one is doing a few things that are error prone. I did a quick and dirty conversion and @lmoureaux's error goes away, so I can clean this up and make a PR

lpetre-ulb commented 4 years ago

Won't fix in legacy (since no new C++ source files are expected). Feel free to reopen the issue if it persists with the update build framework.