Closed docelic closed 4 years ago
I did notice that the CLANG_LIBS
also include the LLVM_LIBS
this may be where its doubling up?
I am able to reproduce in a ubuntu container with llvb 6. Here is the MASSIVE command it makes:
/usr/lib/llvm-6.0/bin/clang++ CMakeFiles/bindgen.dir/src/bindgen.cpp.o CMakeFiles/bindgen.dir/src/bindgen_ast_consumer.cpp.o CMakeFiles/bindgen.dir/src/bindgen_frontend_action.cpp.o CMakeFiles/bindgen.dir/src/enum_match_handler.cpp.o CMakeFiles/bindgen.dir/src/function_match_handler.cpp.o CMakeFiles/bindgen.dir/src/json_stream.cpp.o CMakeFiles/bindgen.dir/src/macro_ast_consumer.cpp.o CMakeFiles/bindgen.dir/src/preprocessor_handler.cpp.o CMakeFiles/bindgen.dir/src/record_match_handler.cpp.o CMakeFiles/bindgen.dir/src/regex.cpp.o CMakeFiles/bindgen.dir/src/structures.cpp.o CMakeFiles/bindgen.dir/src/type_helper.cpp.o -o bindgen -Wl,-rpath,/usr/lib/llvm-6.0/lib -Wl,--start-group -lclangTidyModernizeModule -lclangSerialization -lclangSema -lclangParse -lclangTidyCppCoreGuidelinesModule -lclangFrontend -lclangTidyMPIModule -lclangTooling -lclangTidyPlugin -lclangTidyLLVMModule -lclangTidyBoostModule -lclangChangeNamespace -lclangTidyBugproneModule -lclangTidyGoogleModule -lclangTidyUtils -lclangHandleCXX -lclangLex -lclangFrontendTool -lclangCodeGen -lclangEdit -lclangTidyMiscModule -lclangIndex -lclangARCMigrate -lclangAST -lclangTidyFuchsiaModule -lclangTidyHICPPModule -lclangToolingASTDiff -lclangApplyReplacements -lclangBasic -lclangMove -lclangTidyPerformanceModule -lclangDaemon -lclangStaticAnalyzerFrontend -lclangFormat -lclangStaticAnalyzerCore -lclangToolingCore -lclangQuery -lclangCrossTU -lclangRewriteFrontend -lclangDriver -lclangTidyCERTModule -lclangStaticAnalyzerCheckers -lclangDynamicASTMatchers -lclangToolingRefactor -lclangReorderFields -lclangASTMatchers -lclangIncludeFixer -lclangTidyObjCModule -lclangAnalysis -lclangTidyReadabilityModule -lclangTidyAndroidModule -lclangIncludeFixerPlugin -lclangTidy -lclangRewrite -Wl,--start-group /usr/lib/llvm-6.0/lib/libLLVMDemangle.a /usr/lib/llvm-6.0/lib/libLLVMSupport.a /usr/lib/llvm-6.0/lib/libLLVMTableGen.a /usr/lib/llvm-6.0/lib/libLLVMCore.a /usr/lib/llvm-6.0/lib/libLLVMFuzzMutate.a /usr/lib/llvm-6.0/lib/libLLVMIRReader.a /usr/lib/llvm-6.0/lib/libLLVMCodeGen.a /usr/lib/llvm-6.0/lib/libLLVMSelectionDAG.a /usr/lib/llvm-6.0/lib/libLLVMAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMMIRParser.a /usr/lib/llvm-6.0/lib/libLLVMGlobalISel.a /usr/lib/llvm-6.0/lib/libLLVMBinaryFormat.a /usr/lib/llvm-6.0/lib/libLLVMBitReader.a /usr/lib/llvm-6.0/lib/libLLVMBitWriter.a /usr/lib/llvm-6.0/lib/libLLVMTransformUtils.a /usr/lib/llvm-6.0/lib/libLLVMInstrumentation.a /usr/lib/llvm-6.0/lib/libLLVMInstCombine.a /usr/lib/llvm-6.0/lib/libLLVMScalarOpts.a /usr/lib/llvm-6.0/lib/libLLVMipo.a /usr/lib/llvm-6.0/lib/libLLVMVectorize.a /usr/lib/llvm-6.0/lib/libLLVMObjCARCOpts.a /usr/lib/llvm-6.0/lib/libLLVMCoroutines.a /usr/lib/llvm-6.0/lib/libLLVMLinker.a /usr/lib/llvm-6.0/lib/libLLVMAnalysis.a /usr/lib/llvm-6.0/lib/libLLVMLTO.a /usr/lib/llvm-6.0/lib/libLLVMMC.a /usr/lib/llvm-6.0/lib/libLLVMMCParser.a /usr/lib/llvm-6.0/lib/libLLVMMCDisassembler.a /usr/lib/llvm-6.0/lib/libLLVMObject.a /usr/lib/llvm-6.0/lib/libLLVMObjectYAML.a /usr/lib/llvm-6.0/lib/libLLVMOption.a /usr/lib/llvm-6.0/lib/libLLVMDebugInfoDWARF.a /usr/lib/llvm-6.0/lib/libLLVMDebugInfoMSF.a /usr/lib/llvm-6.0/lib/libLLVMDebugInfoCodeView.a /usr/lib/llvm-6.0/lib/libLLVMDebugInfoPDB.a /usr/lib/llvm-6.0/lib/libLLVMSymbolize.a /usr/lib/llvm-6.0/lib/libLLVMExecutionEngine.a /usr/lib/llvm-6.0/lib/libLLVMInterpreter.a /usr/lib/llvm-6.0/lib/libLLVMMCJIT.a /usr/lib/llvm-6.0/lib/libLLVMOrcJIT.a /usr/lib/llvm-6.0/lib/libLLVMRuntimeDyld.a /usr/lib/llvm-6.0/lib/libLLVMTarget.a /usr/lib/llvm-6.0/lib/libLLVMAArch64CodeGen.a /usr/lib/llvm-6.0/lib/libLLVMAArch64Info.a /usr/lib/llvm-6.0/lib/libLLVMAArch64AsmParser.a /usr/lib/llvm-6.0/lib/libLLVMAArch64Disassembler.a /usr/lib/llvm-6.0/lib/libLLVMAArch64AsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMAArch64Desc.a /usr/lib/llvm-6.0/lib/libLLVMAArch64Utils.a /usr/lib/llvm-6.0/lib/libLLVMAMDGPUCodeGen.a /usr/lib/llvm-6.0/lib/libLLVMAMDGPUAsmParser.a /usr/lib/llvm-6.0/lib/libLLVMAMDGPUAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMAMDGPUDisassembler.a /usr/lib/llvm-6.0/lib/libLLVMAMDGPUInfo.a /usr/lib/llvm-6.0/lib/libLLVMAMDGPUDesc.a /usr/lib/llvm-6.0/lib/libLLVMAMDGPUUtils.a /usr/lib/llvm-6.0/lib/libLLVMARMCodeGen.a /usr/lib/llvm-6.0/lib/libLLVMARMInfo.a /usr/lib/llvm-6.0/lib/libLLVMARMAsmParser.a /usr/lib/llvm-6.0/lib/libLLVMARMDisassembler.a /usr/lib/llvm-6.0/lib/libLLVMARMAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMARMDesc.a /usr/lib/llvm-6.0/lib/libLLVMARMUtils.a /usr/lib/llvm-6.0/lib/libLLVMBPFCodeGen.a /usr/lib/llvm-6.0/lib/libLLVMBPFAsmParser.a /usr/lib/llvm-6.0/lib/libLLVMBPFDisassembler.a /usr/lib/llvm-6.0/lib/libLLVMBPFAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMBPFInfo.a /usr/lib/llvm-6.0/lib/libLLVMBPFDesc.a /usr/lib/llvm-6.0/lib/libLLVMHexagonCodeGen.a /usr/lib/llvm-6.0/lib/libLLVMHexagonAsmParser.a /usr/lib/llvm-6.0/lib/libLLVMHexagonInfo.a /usr/lib/llvm-6.0/lib/libLLVMHexagonDesc.a /usr/lib/llvm-6.0/lib/libLLVMHexagonDisassembler.a /usr/lib/llvm-6.0/lib/libLLVMLanaiCodeGen.a /usr/lib/llvm-6.0/lib/libLLVMLanaiAsmParser.a /usr/lib/llvm-6.0/lib/libLLVMLanaiInfo.a /usr/lib/llvm-6.0/lib/libLLVMLanaiDesc.a /usr/lib/llvm-6.0/lib/libLLVMLanaiAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMLanaiDisassembler.a /usr/lib/llvm-6.0/lib/libLLVMMipsCodeGen.a /usr/lib/llvm-6.0/lib/libLLVMMipsAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMMipsDisassembler.a /usr/lib/llvm-6.0/lib/libLLVMMipsInfo.a /usr/lib/llvm-6.0/lib/libLLVMMipsDesc.a /usr/lib/llvm-6.0/lib/libLLVMMipsAsmParser.a /usr/lib/llvm-6.0/lib/libLLVMMSP430CodeGen.a /usr/lib/llvm-6.0/lib/libLLVMMSP430AsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMMSP430Info.a /usr/lib/llvm-6.0/lib/libLLVMMSP430Desc.a /usr/lib/llvm-6.0/lib/libLLVMNVPTXCodeGen.a /usr/lib/llvm-6.0/lib/libLLVMNVPTXInfo.a /usr/lib/llvm-6.0/lib/libLLVMNVPTXAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMNVPTXDesc.a /usr/lib/llvm-6.0/lib/libLLVMPowerPCCodeGen.a /usr/lib/llvm-6.0/lib/libLLVMPowerPCAsmParser.a /usr/lib/llvm-6.0/lib/libLLVMPowerPCDisassembler.a /usr/lib/llvm-6.0/lib/libLLVMPowerPCAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMPowerPCInfo.a /usr/lib/llvm-6.0/lib/libLLVMPowerPCDesc.a /usr/lib/llvm-6.0/lib/libLLVMSparcCodeGen.a /usr/lib/llvm-6.0/lib/libLLVMSparcInfo.a /usr/lib/llvm-6.0/lib/libLLVMSparcDesc.a /usr/lib/llvm-6.0/lib/libLLVMSparcAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMSparcAsmParser.a /usr/lib/llvm-6.0/lib/libLLVMSparcDisassembler.a /usr/lib/llvm-6.0/lib/libLLVMSystemZCodeGen.a /usr/lib/llvm-6.0/lib/libLLVMSystemZAsmParser.a /usr/lib/llvm-6.0/lib/libLLVMSystemZDisassembler.a /usr/lib/llvm-6.0/lib/libLLVMSystemZAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMSystemZInfo.a /usr/lib/llvm-6.0/lib/libLLVMSystemZDesc.a /usr/lib/llvm-6.0/lib/libLLVMX86CodeGen.a /usr/lib/llvm-6.0/lib/libLLVMX86AsmParser.a /usr/lib/llvm-6.0/lib/libLLVMX86Disassembler.a /usr/lib/llvm-6.0/lib/libLLVMX86AsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMX86Desc.a /usr/lib/llvm-6.0/lib/libLLVMX86Info.a /usr/lib/llvm-6.0/lib/libLLVMX86Utils.a /usr/lib/llvm-6.0/lib/libLLVMXCoreCodeGen.a /usr/lib/llvm-6.0/lib/libLLVMXCoreDisassembler.a /usr/lib/llvm-6.0/lib/libLLVMXCoreAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMXCoreInfo.a /usr/lib/llvm-6.0/lib/libLLVMXCoreDesc.a /usr/lib/llvm-6.0/lib/libLLVMAsmParser.a /usr/lib/llvm-6.0/lib/libLLVMLineEditor.a /usr/lib/llvm-6.0/lib/libLLVMProfileData.a /usr/lib/llvm-6.0/lib/libLLVMCoverage.a /usr/lib/llvm-6.0/lib/libLLVMPasses.a /usr/lib/llvm-6.0/lib/libLLVMDlltoolDriver.a /usr/lib/llvm-6.0/lib/libLLVMLibDriver.a /usr/lib/llvm-6.0/lib/libLLVMXRay.a /usr/lib/llvm-6.0/lib/libLLVMWindowsManifest.a /usr/lib/llvm-6.0/lib/libLTO.so.6.0.0 /usr/lib/llvm-6.0/lib/libLLVM-6.0.so.1 -ltinfo -ldl -lz -lcurses -lpcre /usr/lib/llvm-6.0/lib/libLLVMObjCARCOpts.a /usr/lib/llvm-6.0/lib/libLLVMDebugInfoDWARF.a /usr/lib/llvm-6.0/lib/libLLVMDebugInfoPDB.a /usr/lib/x86_64-linux-gnu/libffi.so /usr/lib/llvm-6.0/lib/libLLVMExecutionEngine.a /usr/lib/llvm-6.0/lib/libLLVMRuntimeDyld.a /usr/lib/llvm-6.0/lib/libLLVMAArch64Info.a /usr/lib/llvm-6.0/lib/libLLVMAArch64AsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMAArch64Utils.a /usr/lib/llvm-6.0/lib/libLLVMAMDGPUAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMAMDGPUInfo.a /usr/lib/llvm-6.0/lib/libLLVMAMDGPUUtils.a /usr/lib/llvm-6.0/lib/libLLVMARMInfo.a /usr/lib/llvm-6.0/lib/libLLVMARMAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMARMUtils.a /usr/lib/llvm-6.0/lib/libLLVMBPFAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMBPFInfo.a /usr/lib/llvm-6.0/lib/libLLVMHexagonDesc.a /usr/lib/llvm-6.0/lib/libLLVMHexagonInfo.a /usr/lib/llvm-6.0/lib/libLLVMLanaiDesc.a /usr/lib/llvm-6.0/lib/libLLVMLanaiInfo.a /usr/lib/llvm-6.0/lib/libLLVMLanaiAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMMipsDesc.a /usr/lib/llvm-6.0/lib/libLLVMMipsAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMMipsInfo.a /usr/lib/llvm-6.0/lib/libLLVMMSP430AsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMMSP430Info.a /usr/lib/llvm-6.0/lib/libLLVMipo.a /usr/lib/llvm-6.0/lib/libLLVMIRReader.a /usr/lib/llvm-6.0/lib/libLLVMAsmParser.a /usr/lib/llvm-6.0/lib/libLLVMInstrumentation.a /usr/lib/llvm-6.0/lib/libLLVMLinker.a /usr/lib/llvm-6.0/lib/libLLVMVectorize.a /usr/lib/llvm-6.0/lib/libLLVMNVPTXInfo.a /usr/lib/llvm-6.0/lib/libLLVMNVPTXAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMPowerPCAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMPowerPCInfo.a /usr/lib/llvm-6.0/lib/libLLVMSparcDesc.a /usr/lib/llvm-6.0/lib/libLLVMSparcAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMSparcInfo.a /usr/lib/llvm-6.0/lib/libLLVMSystemZAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMSystemZInfo.a /usr/lib/llvm-6.0/lib/libLLVMGlobalISel.a /usr/lib/llvm-6.0/lib/libLLVMX86AsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMX86Utils.a /usr/lib/llvm-6.0/lib/libLLVMSelectionDAG.a /usr/lib/llvm-6.0/lib/libLLVMAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMCodeGen.a /usr/lib/llvm-6.0/lib/libLLVMBitWriter.a /usr/lib/llvm-6.0/lib/libLLVMScalarOpts.a /usr/lib/llvm-6.0/lib/libLLVMInstCombine.a /usr/lib/llvm-6.0/lib/libLLVMDebugInfoCodeView.a /usr/lib/llvm-6.0/lib/libLLVMDebugInfoMSF.a /usr/lib/llvm-6.0/lib/libLLVMTransformUtils.a /usr/lib/llvm-6.0/lib/libLLVMTarget.a /usr/lib/llvm-6.0/lib/libLLVMAnalysis.a /usr/lib/llvm-6.0/lib/libLLVMXCoreAsmPrinter.a /usr/lib/llvm-6.0/lib/libLLVMMCDisassembler.a /usr/lib/llvm-6.0/lib/libLLVMXCoreInfo.a -ledit /usr/lib/llvm-6.0/lib/libLLVMProfileData.a /usr/lib/llvm-6.0/lib/libLLVMOption.a /usr/lib/llvm-6.0/lib/libLLVMObject.a /usr/lib/llvm-6.0/lib/libLLVMBitReader.a /usr/lib/llvm-6.0/lib/libLLVMCore.a /usr/lib/llvm-6.0/lib/libLLVMBinaryFormat.a /usr/lib/llvm-6.0/lib/libLLVMMCParser.a /usr/lib/llvm-6.0/lib/libLLVMMC.a /usr/lib/llvm-6.0/lib/libLLVMSupport.a /usr/lib/llvm-6.0/lib/libLLVMDemangle.a -lz -lrt -ltinfo -ldl -lpthread -lm -pthread
Hm, even if it's doubling, the main problem is that .so should not be in the list at all.
What's interesting though is that your comment reminds me that these two .so files are present only once, meaning that they're not coming from LLVM_LIBS (if LLVM_LIBS are doubled, then the .so would appear twice if it's coming through that variable).
For the output on Ubuntu, yes, very similar to what I see here -- namely libLTO.so and libLLVM.so being included, when they shouldn't. Thanks.
You can run cmake -DCMAKE_BUILD_TYPE=Debug .
as well to get more output.
So looks like its coming from the llvm itself. running llvm-config --libnames
on ubuntu gives the .so
.
On ubuntu:
root@a5244a6aac65:/app# llvm-config-6.0 --libnames
libLLVM-6.0.so
on OSX:
llvm-config --libnames
libLLVMLTO.a libLLVMPasses.a libLLVMObjCARCOpts.a libLLVMMIRParser.a libLLVMSymbolize.a libLLVMDebugInfoPDB.a libLLVMDebugInfoDWARF.a libLLVMCoverage.a libLLVMTableGen.a libLLVMDlltoolDriver.a libLLVMOrcJIT.a libLLVMXCoreDisassembler.a libLLVMXCoreCodeGen.a libLLVMXCoreDesc.a libLLVMXCoreInfo.a libLLVMXCoreAsmPrinter.a libLLVMSystemZDisassembler.a libLLVMSystemZCodeGen.a libLLVMSystemZAsmParser.a libLLVMSystemZDesc.a libLLVMSystemZInfo.a libLLVMSystemZAsmPrinter.a libLLVMSparcDisassembler.a libLLVMSparcCodeGen.a libLLVMSparcAsmParser.a libLLVMSparcDesc.a libLLVMSparcInfo.a libLLVMSparcAsmPrinter.a libLLVMPowerPCDisassembler.a libLLVMPowerPCCodeGen.a libLLVMPowerPCAsmParser.a libLLVMPowerPCDesc.a libLLVMPowerPCInfo.a libLLVMPowerPCAsmPrinter.a libLLVMNVPTXCodeGen.a libLLVMNVPTXDesc.a libLLVMNVPTXInfo.a libLLVMNVPTXAsmPrinter.a libLLVMMSP430CodeGen.a libLLVMMSP430Desc.a libLLVMMSP430Info.a libLLVMMSP430AsmPrinter.a libLLVMMipsDisassembler.a libLLVMMipsCodeGen.a libLLVMMipsAsmParser.a libLLVMMipsDesc.a libLLVMMipsInfo.a libLLVMMipsAsmPrinter.a libLLVMLanaiDisassembler.a libLLVMLanaiCodeGen.a libLLVMLanaiAsmParser.a libLLVMLanaiDesc.a libLLVMLanaiAsmPrinter.a libLLVMLanaiInfo.a libLLVMHexagonDisassembler.a libLLVMHexagonCodeGen.a libLLVMHexagonAsmParser.a libLLVMHexagonDesc.a libLLVMHexagonInfo.a libLLVMBPFDisassembler.a libLLVMBPFCodeGen.a libLLVMBPFAsmParser.a libLLVMBPFDesc.a libLLVMBPFInfo.a libLLVMBPFAsmPrinter.a libLLVMARMDisassembler.a libLLVMARMCodeGen.a libLLVMARMAsmParser.a libLLVMARMDesc.a libLLVMARMInfo.a libLLVMARMAsmPrinter.a libLLVMARMUtils.a libLLVMAMDGPUDisassembler.a libLLVMAMDGPUCodeGen.a libLLVMAMDGPUAsmParser.a libLLVMAMDGPUDesc.a libLLVMAMDGPUInfo.a libLLVMAMDGPUAsmPrinter.a libLLVMAMDGPUUtils.a libLLVMAArch64Disassembler.a libLLVMAArch64CodeGen.a libLLVMAArch64AsmParser.a libLLVMAArch64Desc.a libLLVMAArch64Info.a libLLVMAArch64AsmPrinter.a libLLVMAArch64Utils.a libLLVMObjectYAML.a libLLVMLibDriver.a libLLVMOption.a libLLVMWindowsManifest.a libLLVMFuzzMutate.a libLLVMX86Disassembler.a libLLVMX86AsmParser.a libLLVMX86CodeGen.a libLLVMGlobalISel.a libLLVMSelectionDAG.a libLLVMAsmPrinter.a libLLVMDebugInfoCodeView.a libLLVMDebugInfoMSF.a libLLVMX86Desc.a libLLVMMCDisassembler.a libLLVMX86Info.a libLLVMX86AsmPrinter.a libLLVMX86Utils.a libLLVMMCJIT.a libLLVMLineEditor.a libLLVMInterpreter.a libLLVMExecutionEngine.a libLLVMRuntimeDyld.a libLLVMCodeGen.a libLLVMTarget.a libLLVMCoroutines.a libLLVMipo.a libLLVMInstrumentation.a libLLVMVectorize.a libLLVMScalarOpts.a libLLVMLinker.a libLLVMIRReader.a libLLVMAsmParser.a libLLVMInstCombine.a libLLVMTransformUtils.a libLLVMBitWriter.a libLLVMAnalysis.a libLLVMProfileData.a libLLVMObject.a libLLVMMCParser.a libLLVMMC.a libLLVMBitReader.a libLLVMCore.a libLLVMBinaryFormat.a libLLVMSupport.a libLLVMDemangle.a
Hey @kalinon, on LLVM 7, when I compile bindgen, it cannot be started due to:
This happens if either it links against different/multiple versions of LLVM, or if it links both .a and .so libs of the same version. In my case it's the second issue.
I've ran
LDFLAGS=-v cmake .; make -j
which showed me the linker line. It is pasted here: https://bpa.st/IJNQIn it, it's clear that it links against a bunch of .a files, but then also against
libLTO.so
andlibLLVM-7.so
. The llvm.so is not linked to only when I remove both llvm.so and liblto.so from linked flags. (I am not sure if lto brings in llvm.so as a dependency or both of them get incorrectly linked to.)I ran clang tool in debug mode (
crystal find_clang.cr -- --debug
) and it shows LLVMLTO as a library on the list, but I don't think this is responsible for the .so objects, because it also links against lto.a (i.e. I think the detected libraries are correct, and the erroneous .so links must be coming from somewhere else).Would you have an idea where the .so things are coming from?
Currently I'm trying to determine this myself by looking at the position of it in the link list, to figure out which variable it came from.