Closed denverh2000 closed 1 year ago
Adding -lm to the Makefile fixes this problem, but when running the simulator and clicking to operate a switch it crashes with a bus error. The Altair sim works fine though.
The am9511 APU code needs log10(), so linking with -lm is required.
For the bus error you need to build with -g3 and run under debugger, looking at the backtrace then should give us an idea where and why it crashes.
Then, I don't know which patch for generic-at-modem.c you mean? This should build ok as is in the repository. Are you building the master or the dev branch? I would suggest dev branch because it includes fixes for many things.
The generic-at-modem.c patch is from issue #238, "build fix for FreeBSD". I switched to the dev branch and everything except imsaisim built and ran ok. I had to make two changes to imsaisim/srcsim/Makefile.bsd to include -lm, and add a missing path to iodevices.
Here's what I got from running imsaisim using gdb, after compiling with -g3: Thread 2 received signal SIGBUS, Bus error. Object-specific hardware error. [Switching to LWP 105972 of process 20404] 0x0000000808511d87 in llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value, llvm::Type, llvm::Twine const&, llvm::Instruction*) () from /usr/local/llvm15/lib/libLLVM-15.so (gdb)
In the dev branch there is no Makefile.bsd anymore, just Makefile because everything was moved to use GNU make. The OS dependend section for BSD might need -lm, currently it is:
EXEC = $(SIM) ifeq ($(TARGET_OS),BSD) PLAT_INCS = -I/usr/local/include PLAT_LDFLAGS = -L/usr/local/lib PLAT_LIBS = -lthr endif
For some reason it dies somewhere in libllvm it seems, you could provide the output from bt command, so that we can see where it comes from the emulation code.
Ok, I see what happened when I thought I was cloning the dev branch: even if I'm looking at the dev branch with my browser, the "code" button doesn't reflect that.
Here's the backtrace: (gdb) bt
at /usr/src/lib/libthr/thread/thr_create.c:292
Backtrace stopped: Cannot access memory at address 0x7fffdfffe000 (gdb)
If I need to use a different version of llvm, I do have other versions installed, but I have no idea how to force an something to use a specific version.
From imsaisim using the dev branch: Thread 2 received signal SIGBUS, Bus error. Object-specific hardware error. [Switching to LWP 106931 of process 26395] 0x0000000808311d87 in llvm::CastInst::Create(llvm::Instruction::CastOps, llvm::Value, llvm::Type, llvm::Twine const&, llvm::Instruction*) () from /usr/local/llvm15/lib/libLLVM-15.so (gdb) bt
Backtrace stopped: Cannot access memory at address 0x7fffdfffe000 (gdb)
Nothing suspect to see, the thread for the front panel gets started and then works on the event loop. No idea about the problem in libllvm, it tries to address memory which is outside the scope of the process, so bus error.
Try software rendering:
env LIBGL_ALWAYS_SOFTWARE=1 imsaisim
some Mesa DRI drivers have problems with OpenGL selections (GL_SELECT render mode)
Yes, that works, thanks. This is very impressive.
One questions is left, should I add -lm to PLAT_LIBS = -lthr in Makefile for building?
Should be added, since the manual page of log10() on FreeBSD specifies the libm library. Strange thing is, that the builds on my FreeBSD 13.1-stable VM from a few months ago didn't need -lm
.
OK, done
I'm getting the following at what looks like the end of the build on FreeBSD 13.1: cc sim0.o sim1.o sim1a.o sim2.o sim3.o sim4.o sim5.o sim6.o sim7.o simctl.o simint.o memory.o iosim.o simfun.o simglb.o simbdos.o am9511.o floatcnv.o ova.o unix_terminal.o unix_network.o config.o imsai-sio2.o imsai-hal.o imsai-fif.o cromemco-dazzler.o cromemco-88ccc.o cromemco-d+7a.o imsai-vio.o netsrv.o generic-at-modem.o libtelnet.o rtc.o -L../../frontpanel -L/usr/local/lib -lfrontpanel -ljpeg -lGL -lGLU -lX11 -lthr -o ../imsaisim /usr/local/bin/x86_64-unknown-freebsd13.1-ld: am9511.o: undefined reference to symbol 'log10@@FBSD_1.0' /usr/local/bin/x86_64-unknown-freebsd13.1-ld: /lib/libm.so.5: error adding symbols: DSO missing from command line cc: error: linker command failed with exit code 1 (use -v to see invocation) *** Error code 1
I did find the patch for generic-at-modem.c, which is how I got this far. Both cromemcosim and altairsim seem to build Ok.