[help needed] Build files (*.o, etc..) are saved in /tmp?

It's all about the code!
Post Reply
yumechizu
Posts: 2
Joined: Sun Aug 11, 2024 9:52 pm
Github Username: mirusu400

Build files (*.o, etc..) are saved in /tmp?

Post by yumechizu »

Hi, I'm trying to analyze using given *.o and *.dot files using "-fdump-tree-all-graph" options.
but after building there are no *.o and *.dot files per each file, there are only rusefi.elf.ltrans.....dot files.

After quick check, it seems that ruesfi's build system itself compile each each files into /tmp with random name, and after linking they just simply remove it.
Can I change this to other directory, not changing to random name, and not to removing?

https://github.com/rusefi/rusefi/issues/1079
^ Related issue
User avatar
AndreyB
Site Admin
Posts: 14508
Joined: Wed Aug 28, 2013 1:28 am
Location: Jersey City
Github Username: rusefillc
Slack: Andrey B

Re: Build files (*.o, etc..) are saved in /tmp?

Post by AndreyB »

yumechizu wrote:
Sun Aug 11, 2024 10:42 pm
After quick check, it seems that ruesfi's build system itself compile each each files into /tmp with random name
Please provide much, much more details on what _exactly_ are you doing how _exactly_ since this all sounds so odd.
Very limited telepathic abilities - please post logs & tunes where appropriate - http://rusefi.com/s/questions

Always looking for C/C++/Java/PHP developers! Please help us see https://rusefi.com/s/howtocontribute
yumechizu
Posts: 2
Joined: Sun Aug 11, 2024 9:52 pm
Github Username: mirusu400

Re: Build files (*.o, etc..) are saved in /tmp?

Post by yumechizu »

AndreyB wrote:
Sun Aug 11, 2024 10:51 pm
yumechizu wrote:
Sun Aug 11, 2024 10:42 pm
After quick check, it seems that ruesfi's build system itself compile each each files into /tmp with random name
Please provide much, much more details on what _exactly_ are you doing how _exactly_ since this all sounds so odd.
Hi AndreyB, I'm sorry for not explaining my situation exactly.

I resolved this issue, so I'll just post it the ways I resolved.

The reason why object files are saved into /tmp and after linking removes, is caused by LTO options.
So I just add -fno-lto flag for disable it.

Code: Select all

On the Makefile...
...
# Compiler options here.
# yes we have two kinds of EXTRA_*PARAMS so that we can define those in two different places independently
#
ifeq ($(USE_OPT),)
  USE_OPT = $(EXTRA_PARAMS) $(EXTRA_2_PARAMS) $(DEBUG_LEVEL_OPT) $(RFLAGS) -fno-lto -fdump-tree-optimized-graph -fomit-frame-pointer -fsingle-precision-constant  -fno-inline-functions
endif

# EFI_UNIT_TEST determines if we are running in a unit test (hide things from hw/sim)
# EFI_PROD_CODE determines if we are running on real hardware (hide things from tests/sim)
# EFI_SIMULATOR determines if we are running in the simulator (hide things from hw/tests)
USE_OPT += $(RUSEFI_OPT) -DEFI_UNIT_TEST=0 -DEFI_PROD_CODE=1 -DEFI_SIMULATOR=0

# signalling to libfirmware that we have criticalError() method
USE_OPT += -DWE_HAVE_CRITICAL_ERROR_METHOD -fstack-usage

# C specific options here (added to USE_OPT).
ifeq ($(USE_COPT),)
  USE_COPT = -fgnu89-inline -std=gnu99 -Wno-error=implicit-fallthrough -fdump-tree-optimized-graph -fno-devirtualize -fstack-usage
endif

# C++ specific options here (added to USE_OPT).
ifeq ($(USE_CPPOPT),)
  USE_CPPOPT  = -std=c++20 -Wno-register -fno-rtti -fno-threadsafe-statics -fno-exceptions -fno-use-cxa-atexit -fdump-tree-optimized-graph -fno-devirtualize -fstack-usage -fdump-lang-class
  # gcc-10 c++ 20 depricated uses of volatile errors
  USE_CPPOPT += -Wno-deprecated
endif
...

# (Comment or remove these lines)
# Enable this if you want link time optimizations (LTO)
# ifeq ($(USE_LTO),)
  # ChibiOS has not yet migrated to gcc12 syntax of '-flto' thus some weird code here
  #
  # drama: in case of 'syntax error near unexpected token' on Windows either comment out the two lines below
  # or just more your GCC into a folder without spaces in the path like 'C:\stuff\arm-gcc-12.2'
  #
#   USE_LTO = no
#   USE_OPT += -flto=auto
# endif
...
And after make, it makes all of *.dot, *.o, *.su, *.class file in build/obj directory.

Code: Select all

ubuntu@DESKTOP-0DMMSRG:~/lab/rusefi/firmware/build/obj$ ls | head
AemXSeriesEgt.cpp.001l.class
AemXSeriesEgt.cpp.252t.optimized
AemXSeriesEgt.cpp.252t.optimized.dot
AemXSeriesEgt.o
AemXSeriesEgt.su
AemXSeriesLambda.cpp.001l.class
AemXSeriesLambda.cpp.252t.optimized
AemXSeriesLambda.cpp.252t.optimized.dot
AemXSeriesLambda.o
AemXSeriesLambda.su
Post Reply