JeffersonLab / analyzer

HallA C++ Analyzer
BSD 3-Clause "New" or "Revised" License
7 stars 54 forks source link

SCons build with standalone=1 links duplicate objects #142

Closed hansenjo closed 7 years ago

hansenjo commented 7 years ago

The SCons build with standalone=1 creates and links two copies of the compiled hana_decode objects.

First, the decoder shared library libdc.so is built from *.os objects. A few example lines, highlighting the Lecroy1877Module:

c++ -o hana_decode/Lecroy1877Module.os -c -g -O0 -Wall -Woverloaded-virtual -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -std=c++11 -m64 -pthread -rdynamic -fPIC -DWITH_DEBUG -DLINUXVERS -DHAS_SSTREAM -I/home/ole/evio-4.4.6/Linux-x86_64/include -Isrc -Ihana_decode -I/usr/include/root hana_decode/Lecroy1877Module.C

c++ -o libdc.so.1.6.0 -pthread -shared .... hana_decode/Lecroy1877Module.os .... hana_decode/THaDecDict.so -L/usr/lib64/root -L. -L/home/ole/evio-4.4.6/Linux-x86_64/lib -Lsrc -Lhana_decode

Second, the sources are compiled again, this time into objects with suffix *.o:

c++ -o hana_decode/Lecroy1877Module.o -c -g -O0 -Wall -Woverloaded-virtual -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -std=c++11 -m64 -pthread -rdynamic -DWITH_DEBUG -DLINUXVERS -DHAS_SSTREAM -I/home/ole/evio-4.4.6/Linux-x86_64/include -Isrc -Ihana_decode -I/usr/include/root hana_decode/Lecroy1877Module.C

Those objects are then used to build the standalone executables:

c++ -o hana_decode/tstfadc_main.o -c -g -O0 -Wall -Woverloaded-virtual -Wextra -Wno-missing-field-initializers -Wno-unused-parameter -std=c++11 -m64 -pthread -rdynamic -DWITH_DEBUG -DLINUXVERS -DHAS_SSTREAM -I/home/ole/evio-4.4.6/Linux-x86_64/include -Isrc -Ihana_decode -I/usr/include/root hana_decode/tstfadc_main.C
c++ -o hana_decode/tstfadc -pthread .... hana_decode/Lecroy1877Module.o .... hana_decode/tstfadc_main.o hana_decode/THaDecDict.so -L/usr/lib64/root -L. -L/home/ole/evio-4.4.6/Linux-x86_64/lib -Lsrc -Lhana_decode -lHallA -ldc -levio -lCore -lRIO -lNet -lHist -lGraf -lGraf3d -lGpad -lTree -lRint -lPostscript -lMatrix -lPhysics -lMathCore -lThread -lMultiProc -lm -ldl
Install file: "hana_decode/tstfadc" as "bin/tstfadc"

but those executables are also dynamically linked to libdc.so, do the same objects appear twice at runtime. This causes various breakage (attempt to register modules twice, double free on exit) when running these executables.

The make build is unaffected.

brash99 commented 7 years ago

OK, I think that I have fixed this one. There was a bug in hana_decode/SConscript.py. I also have added a “clean” feature so that the standalone executables are removed when one does “scans -c”.

I tested that the standalone executables all get built and installed correctly, at least.

Here is a link to the commit that includes these changes … Ole, can you just grab these changes from here?

24ff139 https://github.com/brash99/analyzer/commit/24ff139edf62e1d338dece048a5fb62e2bd93cc2

Cheers, E.

On Sep 26, 2017, at 12:27 PM, Ole Hansen notifications@github.com wrote:

Assigned #142 https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_JeffersonLab_analyzer_issues_142&d=DwMCaQ&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=QQI4wgZ48DvzGull4QAPAA&m=1Tzjhg_0nGmnpLyn6288R326uJe3PJJWAgGffJnztKE&s=mk--7WfHb8eo_kwkGm0yz1flPYBKHM_ZQC1becsQh1U&e= to @brash99 https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_brash99&d=DwMCaQ&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=QQI4wgZ48DvzGull4QAPAA&m=1Tzjhg_0nGmnpLyn6288R326uJe3PJJWAgGffJnztKE&s=x10-atNJnhfXJ28AnPlSbd09vQ_mLwSB74bMY_yrJUU&e=.

— You are receiving this because you were assigned. Reply to this email directly, view it on GitHub https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_JeffersonLab_analyzer_issues_142-23event-2D1266120892&d=DwMCaQ&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=QQI4wgZ48DvzGull4QAPAA&m=1Tzjhg_0nGmnpLyn6288R326uJe3PJJWAgGffJnztKE&s=Kf8_FY1eq9DpYS_8AO6GcS9uhW9AGYwfFp_P502cPUA&e=, or mute the thread https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AE1Pu7S7uFlyJO8SD4l4MH6TRhiv0bJSks5smSYJgaJpZM4Pkhon&d=DwMCaQ&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=QQI4wgZ48DvzGull4QAPAA&m=1Tzjhg_0nGmnpLyn6288R326uJe3PJJWAgGffJnztKE&s=qCvQPuVBjidMW7GhrLKAW91fCZj4c4YGkQWiI9RCP5s&e=.

hansenjo commented 7 years ago

Hi Ed,

thanks for the quick fix. Looking at the commit you linked, I was just wondering why hana_decode/haDecode_LinkDef.h was removed. Hopefully this doesn't happen as part of the updated "clean" feature ...

Ole

brash99 commented 7 years ago

Hi Ole,

Sorry … no, that should not be in there. This was a remnant of other work that I was doing on this branch having to do with getting rid of this file, and generating automagically (as is done for the hcana linkdef file).

Cheers, E.

On Sep 27, 2017, at 12:01 PM, Ole Hansen notifications@github.com wrote:

Hi Ed,

thanks for the quick fix. Looking at the commit you linked, I was just wondering why hana_decode/haDecode_LinkDef.h was removed. Hopefully this doesn't happen as part of the updated "clean" feature ...

Ole — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_JeffersonLab_analyzer_issues_142-23issuecomment-2D332570769&d=DwMFaQ&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=QQI4wgZ48DvzGull4QAPAA&m=8dn6NIuQS6ckJGyUx5fGPbXiMpm3Qk_adPSjxX-b80M&s=Xoz_f0MdLP67TecgTLwqJxOn5vUYJUexXoa2F0E4pDA&e=, or mute the thread https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_notifications_unsubscribe-2Dauth_AE1Pu4BKIx2If-2DT1gacgDlPHR8MbyyGmks5smnFNgaJpZM4Pkhon&d=DwMFaQ&c=lz9TcOasaINaaC3U7FbMev2lsutwpI4--09aP8Lu18s&r=QQI4wgZ48DvzGull4QAPAA&m=8dn6NIuQS6ckJGyUx5fGPbXiMpm3Qk_adPSjxX-b80M&s=YXk_HYmKzLdsrVZFRkU_oStPs67WEHKkLudHQ9Al9Zk&e=.