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

Compilation fails under Illumos / OmniOS r151050 #22236

Open
madelinehebert opened this issue Sep 16, 2024 · 0 comments
Open

Compilation fails under Illumos / OmniOS r151050 #22236

madelinehebert opened this issue Sep 16, 2024 · 0 comments
Labels
Bug This tag is applied to issues which reports bugs.

Comments

@madelinehebert
Copy link

madelinehebert commented Sep 16, 2024

Describe the bug

Compilation of Vlang/v fails under Solaris/Illumos based systems due to lack of tm_gmtoff field in tm struct in time_iso.h, and use of sys/ptrace.h.

Reproduction Steps

git clone https://github.com/vlang/v
cd v
gmake

Expected Behavior

No errors

Current Behavior

gmake[1]: Leaving directory '/tmp/v'
cd ./thirdparty/tcc && git clean -xf && git pull --quiet
gcc -std=gnu99 -w -o v1.exe ./vc/v.c -lm -lpthread
./vc/v.c:2052:2: error: #error VERROR_MESSAGE Header file <sys/ptrace.h>, needed for module os was not found. Please install the corresponding development headers.
2052 | #error VERROR_MESSAGE Header file <sys/ptrace.h>, needed for module os was not found. Please install the corresponding development headers.
| ^~~~~
./vc/v.c: In function 'time__time_with_unix':
./vc/v.c:33053:18: error: 'struct tm' has no member named 'tm_gmtoff'
33053 | .tm_gmtoff = 0,
| ^~~~~~~~~
./vc/v.c: In function 'time__Time_strftime':
./vc/v.c:33099:174: error: 'struct tm' has no member named 'tm_gmtoff'
33099 | struct tm* tm = ((struct tm*)memdup(&(struct tm){.tm_sec = 0,.tm_min = 0,.tm_hour = 0,.tm_mday = 0,.tm_mon = 0,.tm_year = 0,.tm_wday = 0,.tm_yday = 0,.tm_isdst = 0,.tm_gmtoff = 0,}, sizeof(struct tm)));
| ^~~~~~~~~
./vc/v.c: In function 'time__Time_local':
./vc/v.c:33473:157: error: 'struct tm' has no member named 'tm_gmtoff'
33473 | struct tm loc_tm = ((struct tm){.tm_sec = 0,.tm_min = 0,.tm_hour = 0,.tm_mday = 0,.tm_mon = 0,.tm_year = 0,.tm_wday = 0,.tm_yday = 0,.tm_isdst = 0,.tm_gmtoff = 0,});
| ^~~~~~~~~
./vc/v.c: In function 'time__linux_now':
./vc/v.c:33508:157: error: 'struct tm' has no member named 'tm_gmtoff'
33508 | struct tm loc_tm = ((struct tm){.tm_sec = 0,.tm_min = 0,.tm_hour = 0,.tm_mday = 0,.tm_mon = 0,.tm_year = 0,.tm_wday = 0,.tm_yday = 0,.tm_isdst = 0,.tm_gmtoff = 0,});
| ^~~~~~~~~
gmake: *** [GNUmakefile:113: all] Error 1

Possible Solution

Working solution:

Step 1: Replace <sys/ptrace.h> in vc/v.c definitions with <uninstd.h> and <sys/types.h> according to ptrace illumos man page.

Step 2: Edit '/usr/include/iso/time_iso.h' file's 'tm' struct to include an 'int tm_gmtoff' field, as this is not default under Solaris.

Step 3: Install and configure C library and Include paths for gc.h. Can be installed with pkgsrc tool from Joyent/SmartOS. I used 'v -cflags "-Wl,-rpath=/opt/local/lib -L/opt/local/lib -I/opt/local/include"' to include the needed libraries for a Hello World program compilation.

Additional Information/Context

It seems like this compilation error is due to missing struct fields under Solaris-based environments. I'm not familiar with Makefile rules or how to create an automated solution to fix this, or if that would even be possible.

V version

0.4.7 ca5f47a

Environment details (OS name and version, etc.)

V full version: V 0.4.7 0fb95a8.ca5f47a
OS: solaris, ,
Processor: 12 cpus, 64bit, little endian

getwd: /opt/v
vexe: /opt/v/v
vexe mtime: 2024-09-16 10:14:41

vroot: OK, value: /opt/v
VMODULES: OK, value: /root/.vmodules
VTMP: OK, value: /tmp/v_0

Git version: git version 2.44.2
Git vroot status: weekly.2024.37-3-gca5f47a9-dirty (4 commit(s) behind V master)
.git/config present: true

CC version: cc (OmniOS 151050/13.2.0-il-0) 13.2.0
thirdparty/tcc status: thirdparty-unknown-unknown de82a13

Note

You can use the 👍 reaction to increase the issue's priority for developers.

Please note that only the 👍 reaction to the issue itself counts as a vote.
Other reactions and those to comments will not be taken into account.

@madelinehebert madelinehebert added the Bug This tag is applied to issues which reports bugs. label Sep 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug This tag is applied to issues which reports bugs.
Projects
None yet
Development

No branches or pull requests

1 participant