vbcc linker issue
Hi,
trying to get some amiga demo code running i installed a vs-code vbcc integration and am facing a strange linker issue I described the issue here: https://github.com/prb28/vscode-amig...ample/issues/7 but still i do not understand why an object file could cause the program to "not call" its main method at startup Even it was corrupt the linked exe should work fine , right? I tested it so,that I removed all audio.o. related stuff from main.c and it works fine without linking to audio.o, but once I add it to the executable (same code in main.c) it just stops calling main() Any experience on why vbcc executables can be blocked by object files on startup? did not see this behaviour ever when working with gcc on x64-systems. Thanks for any comment. |
Quote:
Without seeing your actual code I can only guess, but the most likely explanation is that audio.c contains an init function (i.e. a function whose name starts with _INIT) which is getting called before main. See http://www.ibaug.de/vbcc/doc/vbcc_2....ctor-functions for more details on this facility. |
I didn’t find the code to audio.c on that Github page so it’s hard to make any qualified comments. Provided that you linked with the standard startup code the only reason for a program to fail before entry into main() is a constructor function, as robinsonb5 already pointed out. Or you are linking with mieee.lib and the mathieee*.library cannot be opened. Or you are linking with auto.lib and another referenced library cannot be opened.
You may want to link with -M to generate a map file. Also have a look at the return code after executing your program. |
https://github.com/Zalewa/snekorama/...r/snek/amiga_c
is the code I want to compile and link. System: MacOS Catalina, VsCode with VsCode-Amiga-Vbcc integration, Includes/Headers NDK3.9 I am using the Makefile ( adapted from https://github.com/prb28/vscode-amiga-vbcc-example ) CC=vc -c99 VASM=vasmm68k_mot VLINK=vlink LDFLAGS=-stdlib -noixemul -s CONFIG=+aos68k ODIR=build-vbcc EXE=fs-uae/hd0/main _OBJ = game.o main.o audio.o view.o list.o vec2.o OBJ = $(patsubst %,$(ODIR)/%,$(_OBJ)) # Prepare variables for target 'clean' ifeq ($(OS),Windows_NT) RM:=del PATHSEP:=\\ CONFIG:=${CONFIG}_win else RM:=rm -f PATHSEP:=/ endif all: $(EXE) $(EXE) : $(OBJ) $(VLINK) -x -bamigahunk -Bstatic -Cvbcc -nostdlib -mrel $(VBCC)/targets/m68k-amigaos/lib/startup.o $(OBJ) -lauto -lamiga -L$(VBCC)/targets/m68k-amigaos/lib -lvc -o $(EXE) $(ODIR)/%.o : %.c $(CC) $(CONFIG) -g -c -o $@ $< $(ODIR)/%.o : %.s $(VASM) -m68000 -linedebug -o $@ $< clean: -$(RM) $(ODIR)$(PATHSEP)*.o -$(RM) $(subst /,$(PATHSEP),$(EXE)) I noticed not only audio but also view are the files that when linked result in the described problem. The other object files work well and main() is called |
__INIT_5_DataTypesBase: global reloc, value 0x16a8, size 0
__INIT_5_IntuitionBase: global reloc, value 0x205c, size 0 __INIT_5_GfxBase: global reloc, value 0x20e0, size 0 These __INIT are added to the map file when linking all object files, but are not present when removing audio and view. How can I see the return code? main() is not called, so no return value |
Quote:
The datatypes.library and individual datatypes are disk-based - are they present and correctly set up in your test environment? |
maybe not
first time i read about datatypes.library i downloaded a version from a forum link. Should I just link it? ps: in both audio.c and view.c I do #include <proto/datatypes.h> pss: all missing include dirs: I added them from NDK3.9 - until it compiled. Maybe its not the correct libs or missing stuff although not complaining and compiling? psss: datatypes only around since AmigaOs 3.0. So if I also want to target amiga500 it will not work with NDK3.9 right? |
Quote:
OK I'm not talking about your build environment - I mean the Amiga environment in which you're trying to run your executable. You said you're using FS-UAE. Which kickstart are you using, and which files are on your boot disk? I suspect the datatypes.library is missing from that boot disk, or something else about your Amiga boot environment is preventing datatypes.library from opening. |
i guess that is right. All points to a problem with the datatypes.lib
launch.json "--chip_memory=1024", "--hard_drive_0=${workspaceFolder}/fs-uae/hd0", "--joystick_port_1=none", "--amiga_model=A1200", "--slow_memory=1792", "--remote_debugger=200", "--use_remote_debugger=true", "--automatic_input_grab=0" no special files on FS-UAE. assuming 1200 uses kickstart 3.1 or higher |
One more thought: if you don't link against amiga.lib, the libraries won't be defined either.
|
Quote:
For Kickstart 1.3 development I would recommend the m68k-kick13 target together with the original 1.3-NDK. Quote:
|
thanks phx
I downloaded NDK 1.3 and in the Include-Strip1.3/lib folder , there is only amiga.lib, ddebug.lib, debug.lib , diskfont_lib.lib , mathieesdoubbas_lib.lib , small.lib whereas in my vscode integration I have many many libs (most seem vbcc libs). What are the essential vbcc libs needed to compile on 1.3 and on amigaos3+ ? |
Although the linker libs from the NDK might work there is usually no reason to use them. vbcc comes with all libraries you need.
|
really?
http://sun.hasenbraten.de/vbcc/ has some minimal includes (maybe it has all libs) most projects for amigaos 2/3 require many more include headers (folders exec, hardware , graphics etc....) Any source for a complete vbcc include/lib setup ? for any platform (1.3, 3.0) . I am struggeling to get anything together. Its like copypasting tons of includes from NDKs. |
Quote:
Quote:
I'm not sure about the current legal situation, but in the past it was not allowed for a compiler to include the NDK without license. Quote:
But there is nothing to copy. When using the installer under AmigaOS/MorphOS just point it to the directory with the NDK includes. When you do it manually, just add the NDK include path to vincludeos3:, or add another -I option to the config file, for Unix/MacOS,Windows. |
ok, sorry libs i have
includes from NDK3.9 also cover anything the amiga c program would ever need, but then again: my initial problem. trying now with another sample project: I can get main() running with a setup of AmigaOs(2,3) libs and NDK3.9 ! new error after startup: "Sanity check on memory list failed"...somehow InitView fails |
All times are GMT +2. The time now is 07:16. |
Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.