2013年12月20日 星期五

Build and debug ipmitool for mingw64 on linux

Refer to: https://tecadmin.net/install-wine-on-ubuntu

1.
echo 'deb http://us.archive.ubuntu.com/ubuntu trusty main universe' >> /etc/apt/sources.list
sudo apt update
sudo apt install mingw32 mingw32-binutils mingw32-runtime mingw-w64
sudo apt install mingw-w64

#mingw-w64 cimpiler can add -m32 in CFLAGS for 32bits

2.
dpkg --add-architecture i386
wget -qO - https://dl.winehq.org/wine-builds/winehq.key | sudo apt-key add -
apt-add-repository 'deb https://dl.winehq.org/wine-builds/ubuntu/ xenial main'
apt install --install-recommends winehq-stable wine-mono

3. download source and make
http://www.mediafire.com/file/ey054x4xzkzwe1n/ipmitool-IPMITOOL_1_8_18_mingw.tar.xz
(source modified by Jesse Stone)

4. open eclipse
Create Makefile Project with Existing Code for ipmitool-IPMITOOL_1_8_18_mingw

5.
(1)right click project
(2)Debug As->Debug configurations, double click [C/C++ Application]
(3) click bottom line -Select other...
enable [Use configuration specific settings]
select [Legacy Create Process Launcher]

6.
in Main tab
C/C++ Application: /root/InsydeProject/ipmitool-IPMITOOL_1_8_18_mingw/src/ipmitool.exe

7.
in Debugger tab
[Debugger:] GdbServer
[Connection] > [Type:] TCP
[Host name or Ip address:] localhost
[Port number:] 5039

8. open terminal
cd $HOME/ipmitool-IPMITOOL_1_8_18_mingw/src
winedbg --gdb --no-start --port 5039 ./ipmitool -I lan -H localhost -p 9001 -U ipmiusr -P test power status

9. start debug on eclipse

10. If link error -> /usr/bin/i686-w64-mingw32-ld: cannot find -lgcc
gedit ~/ipmitool-IPMITOOL_1_8_18_mingw/src/Makefile
-L/usr/lib/gcc/i686-w64-mingw32/5.3-win32
#change to
-L/usr/lib/gcc/i686-w64-mingw32/7.3-win32

沒有留言:

張貼留言