Skip to content

Conversation

@romforth
Copy link

@romforth romforth commented Jan 8, 2026

I can build asm1130 using my ancient Ubuntu version where gcc -v shows:
gcc version 5.3.1 20160413 (Ubuntu 5.3.1-14ubuntu2)

But using a recent version of Gentoo where gcc -v shows:
gcc version 14.2.1 20241221 (Gentoo 14.2.1_p20241221 p7)
the build (make asm1130, within the Ibm1130/utils subdirectory) fails with:

---snip---
asm1130.c: In function ‘save_symbols’
asm1130.c:2132:9: error: implicit declaration of function ‘unlink’; did you mean ‘x_link’? [-Wimplicit-function-declaration]
2132 | unlink(SYSTEM_TABLE);
| ^~~~~~
---snip---

man -s2 unlink shows that #include <unistd.h> is needed but that is
currently ifdef'ed under VMS. So the fix is to use it unconditionally.

I've tested that this works on both the old and newer gcc versions.

BTW, I was using asm1130 as the cross-assembler for my port of
romforth which is dialect of Forth
to the IBM 1130 (only under emulation, using SIMH/ibm1130 as the emulator)

This failed to build with gcc version:
gcc version 14.2.1 20241221 (Gentoo 14.2.1_p20241221 p7)
with the following error:
---snip---
asm1130.c: In function ‘save_symbols’
asm1130.c:2132:9: error: implicit declaration of function ‘unlink’; did you mean ‘x_link’? [-Wimplicit-function-declaration]
 2132 |         unlink(SYSTEM_TABLE);
      |         ^~~~~~
---snip---
@pkoning2
Copy link
Member

pkoning2 commented Jan 8, 2026

Have you tested it on Windows?

@pkoning2
Copy link
Member

pkoning2 commented Jan 8, 2026

It doesn't look like the Github test scripts build this subdirectory. I wonder about an include of "unistd" on Windoze.

@markpizz
Copy link
Contributor

markpizz commented Jan 9, 2026

@pkoning2 said: It doesn't look like the Github test scripts build this subdirectory. I wonder about an include of "unistd" on Windoze.

FYI, there has been no effort to avoid excess warning messages when building things in this directory. In fact, I've never known anyone who actually tried to run any of the makefiles in this directory. On windows, the builds have many warnings, but all but checkdisk.mak produce binaries. Looking closely at that build failure and the details in the checkdisk.mak seem to refer to include files from way before Visual Studio 2008 which is the oldest I've got. Removing the irrelevant references in checkdisk.mak and a binary is built. All the windows binaries run and spit out a usage message.

The simplest change to the asm1130.c source would be to change:

#if defined(VMS)
to 
#if !defined(_WIN32)

@pkoning2
Copy link
Member

pkoning2 commented Jan 9, 2026

Thanks Mark. @romforth could you make that update?

@markpizz
Copy link
Contributor

markpizz commented Jan 9, 2026

As I mentioned, there was all sorts of warning messages produced when building all those programs on windows. When building asm1130 on Ubuntu, many warnings are also produced, including about unlink. Meanwhile, a binary is produced and no link errors were generated, so I suspect the result works just fine.

@markpizz
Copy link
Contributor

markpizz commented Jan 9, 2026

My point is that removing a single warning among many, if the resulting binary works fine, probably doesn't warrant a dedicated change.

@markpizz
Copy link
Contributor

markpizz commented Jan 9, 2026

On Ubuntu I see:

$ make asm1130 2>&1|grep unlink
asm1130.c:2132:9: warning: implicit declaration of function ‘unlink’; did you mean ‘x_link’? [-Wimplicit-function-declaration]
 2132 |         unlink(SYSTEM_TABLE);

Your original complaint has the same message, but in your case we see "error:" rather than "warning:". Is something about your build causing warnings to return as errors?

@pkoning2
Copy link
Member

pkoning2 commented Jan 9, 2026

It's probably caused by gcc moving to a newer edition of the C standard for its default dialect, one in which this issue is an error.

@romforth
Copy link
Author

Hi Paul and Mark,

I didn't have a Windows system to test - so the only testing I did was on Ubuntu 16.04 (which worked with the original code) and on a recent build of Gentoo (where I saw the failure that this fix attempts to solve).

Sorry about causing the Github CI build failures - the fix that I pushed to my repo just now should fix it, I think.
As before I've tested it on the Linux distros that I have (where the fix works as expected) and I'll monitor the CI
for any new build failures on the Windows build.

Thanks for the code review.
Charles

@romforth
Copy link
Author

@pkoning2 said: It doesn't look like the Github test scripts build this subdirectory. I wonder about an include of "unistd" on Windoze.

FYI, there has been no effort to avoid excess warning messages when building things in this directory. In fact, I've never known anyone who actually tried to run any of the makefiles in this directory. On windows, the builds have many warnings, but all but checkdisk.mak produce binaries. Looking closely at that build failure and the details in the checkdisk.mak seem to refer to include files from way before Visual Studio 2008 which is the oldest I've got. Removing the irrelevant references in checkdisk.mak and a binary is built. All the windows binaries run and spit out a usage message.

The simplest change to the asm1130.c source would be to change:

#if defined(VMS)
to 
#if !defined(_WIN32)

Rather than use this change (which would affect anything other than Windows), I've chosen to do the more conservative
#if defined(__linux) || defined(VMS)
which is applicable only on Linux and VMS so nothing else should be affected.

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

Successfully merging this pull request may close these issues.

3 participants