Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Version with debugger enabled fails to build with MSYS2 #394

Open
Vort opened this issue Nov 21, 2024 · 8 comments
Open

Version with debugger enabled fails to build with MSYS2 #394

Vort opened this issue Nov 21, 2024 · 8 comments

Comments

@Vort
Copy link
Contributor

Vort commented Nov 21, 2024

This is what I see when I try to build Bochs with --enable-debugger --enable-debugger-gui with MSYS2 and clang:

g++ -o bochs -O3 -Wall -Wno-format -mno-ms-bitfields -DWIN32 -D_FILE_OFFSET_BITS=64 -D_LARGE_FILES     -DBX_SHARE_PATH='"/clang64/share/bochs"'   logio.o main.o config.o pc_system.o osdep.o plugin.o crc.o bxthread.o win32res.o  \
        iodev/libiodev.a iodev/display/libdisplay.a iodev/hdimage/libhdimage.a iodev/usb/libusb.a iodev/network/libnetwork.a iodev/sound/libsound.a \
        bx_debug/libdebug.a cpu/libcpu.a cpu/avx/libavx.a cpu/cpudb/libcpudb.a \
         memory/libmemory.a gui/libgui.a \
          \
         cpu/fpu/libfpu.a cpu/softfloat3e/libsoftfloat.a \
        -lws2_32 -luser32 -lgdi32 -lcomdlg32 -lcomctl32 -lshell32 \
        -liphlpapi -lws2_32 -lwinmm \
         \
         \
        -lreadline \
        -static \

ld.lld: error: undefined symbol: tputs
>>> referenced by libreadline.a(display.o):(rl_redisplay)
>>> referenced by libreadline.a(display.o):(rl_redisplay)
>>> referenced by libreadline.a(display.o):(rl_redisplay)
>>> referenced 19 more times

ld.lld: error: undefined symbol: tgetnum
>>> referenced by libreadline.a(terminal.o):(_rl_get_screen_size)
>>> referenced by libreadline.a(terminal.o):(_rl_get_screen_size)

ld.lld: error: undefined symbol: tgetent
>>> referenced by libreadline.a(terminal.o):(_rl_init_terminal_io)

ld.lld: error: undefined symbol: tgetstr
>>> referenced by libreadline.a(terminal.o):(_rl_init_terminal_io)

ld.lld: error: undefined symbol: tgetflag
>>> referenced by libreadline.a(terminal.o):(_rl_init_terminal_io)
>>> referenced by libreadline.a(terminal.o):(_rl_init_terminal_io)
>>> referenced by libreadline.a(terminal.o):(_rl_init_terminal_io)

ld.lld: error: undefined symbol: BC
>>> referenced by libreadline.a(terminal.o):(.refptr.BC)

ld.lld: error: undefined symbol: PC
>>> referenced by libreadline.a(terminal.o):(.refptr.PC)

ld.lld: error: undefined symbol: UP
>>> referenced by libreadline.a(terminal.o):(.refptr.UP)
g++: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [Makefile:180: bochs] Error 1

If I replace -lreadline with -lreadline -lncurses, build finishes correctly.

I did not figured out yet how to make correct change to build scripts.

Version: dbfb11f

@vruppert
Copy link
Contributor

In the configure script there are checks whether or not readline needs the curses library. Checks for curses variants are only present if the term gui is compiled in. For testing you could try to build with --with-term. If this helps, I can have a look how to make the readline checks work correctly.

@Vort
Copy link
Contributor Author

Vort commented Nov 22, 2024

It does not work with MSYS2.
There is clang64/mingw-w64-clang-x86_64-ncurses package, which have no pkgconfig files.
And there is msys/ncurses-devel package, which have pkgconfig files, but they are not accessible from clang64 environment (PKG_CONFIG_PATH is set to /clang64/lib/pkgconfig:/clang64/share/pkgconfig$, while ncurses-devel package drops file into /usr/lib/pkgconfig).

upd. clang64/mingw-w64-clang-x86_64-ncurses have ncursesw.pc, but no ncurses.pc. I will try to use w variant.

@Vort
Copy link
Contributor Author

Vort commented Nov 22, 2024

I tried to use ncursesw, but looks like term.cc compilation in Windows is broken anyway:

term.cc:194:20: error: expression is not assignable
  194 |     stdin = stdout = fdopen(scr_fd,"wr");
term.cc:195:5: error: use of undeclared identifier 'grantpt'
  195 |     grantpt(scr_fd);
      |     ^
term.cc:196:5: error: use of undeclared identifier 'unlockpt'
  196 |     unlockpt(scr_fd);
      |     ^
term.cc:197:60: error: use of undeclared identifier 'ptsname'
  197 |     fprintf(stderr, "\nBochs connected to screen \"%s\"\n",ptsname(scr_fd));
      |      

Looks like this is wrong path.
My goal was to obtain Bochs binary with GUI debugger enabled without manual hacking.
If console debugging will work, that's a bonus, but GUI mode on windows platform is more important I think.

@vruppert
Copy link
Contributor

I just had a look at my Bochs configurations on Windows with debugger enabled. For the MSVC build the option --disable-readline is present in my shortcut script (configuring on MSYS2). I haven't tried this option for the MSYS2-mingw64 build yet. Since the MSVC Bochs debugger works without readline, other environments may also work.

@Vort
Copy link
Contributor Author

Vort commented Nov 23, 2024

I remembered that I tested build with readline disabled as well.
I don't know which functionality will be missing with readline disabled, so I can't say what is better - to try fixing readline support or to just disable it.

By the way, .conf.win32-cygwin-debugger looks outdated compared to .conf.win32-cygwin.
Worth synchronizing I think.

@vruppert
Copy link
Contributor

Since there is a PR from @stlintel to enable debugger, we need to review all of the related stuff after integration. Special shortcut scripts with debugger on may be obsolete then.

@Vort
Copy link
Contributor Author

Vort commented Nov 24, 2024

I agree it is better to merge #197 first.

@stlintel
Copy link
Contributor

Volker, after the integration the debugger will be enabled by default and the problem will be also by default and not for special script....

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants