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

Cannot build release on Ubuntu 22.04 #20576

Open
nordlow opened this issue Jan 18, 2024 · 7 comments
Open

Cannot build release on Ubuntu 22.04 #20576

nordlow opened this issue Jan 18, 2024 · 7 comments
Labels
Bug This tag is applied to issues which reports bugs. Build V build error on any OS/CPU architecture.

Comments

@nordlow
Copy link

nordlow commented Jan 18, 2024

Describe the bug

Building compiler in release mode fails.

Reproduction Steps

make -f GNUmakefile rebuild prod=1

Expected Behavior

The shell command should pass.

Current Behavior

Failed as

rm -rf ./thirdparty/tcc
rm -rf ./thirdparty/legacy
rm -rf ./vc
make fresh_vc
make[1]: Entering directory '~/.cache/repos/vlang'
rm -rf ./vc
git clone --filter=blob:none --quiet https://github.com/vlang/vc ./vc
remote: Enumerating objects: 3, done.        
remote: Counting objects: 100% (3/3), done.        
remote: Compressing objects: 100% (3/3), done.        
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0        
Receiving objects: 100% (3/3), 1020.57 KiB | 5.46 MiB/s, done.
Resolving deltas: 100% (1/1), done.
make[1]: Leaving directory '~/.cache/repos/vlang'
cd ./vc && git clean -xf && git pull --quiet
make fresh_tcc
make[1]: Entering directory '~/.cache/repos/vlang'
rm -rf ./thirdparty/tcc
git clone --filter=blob:none --quiet --branch thirdparty-linux-amd64 https://github.com/vlang/tccbin ./thirdparty/tcc
remote: Enumerating objects: 25, done.        
remote: Counting objects: 100% (18/18), done.        
remote: Compressing objects: 100% (18/18), done.        
remote: Total 25 (delta 0), reused 3 (delta 0), pack-reused 7        
Receiving objects: 100% (25/25), 2.07 MiB | 5.66 MiB/s, done.
make[2]: Entering directory '~/.cache/repos/vlang'
make[2]: Leaving directory '~/.cache/repos/vlang'
make[1]: Leaving directory '~/.cache/repos/vlang'
cd ./thirdparty/tcc && git clean -xf && git pull --quiet
cc  -std=gnu99 -w -o v1.exe ./vc/v.c -lm -lpthread 
./v1.exe -no-parallel -o v2.exe -prod cmd/v
==================
ld: error: undefined symbol: main
>>> referenced by /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/Scrt1.o:(_start)
collect2: error: ld returned 1 exit status
...
==================
(Use `v -cg` to print the entire error message)

builder error: 
==================
C error. This should never happen.

This is a compiler bug, please report it using `v bug file.v`.

https://github.com/vlang/v/issues/new/choose

You can also use #help on Discord: https://discord.gg/vlang

make: *** [GNUmakefile:114: all] Error 1

Compilation exited abnormally with code 2 at Thu Jan 18 09:36:51, duration 27.4 s

.

Possible Solution

No response

Additional Information/Context

No response

V version

master

Environment details (OS name and version, etc.)

Ubuntu 22.04

gcc --version

outputs

gcc (Ubuntu 12.3.0-1ubuntu1~22.04) 12.3.0
Copyright (C) 2022 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

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.

@nordlow nordlow added the Bug This tag is applied to issues which reports bugs. label Jan 18, 2024
@JalonSolov
Copy link
Contributor

Try building with the following:

make
v -prod self

instead of make -f GNUmakefile The GNUmakefile is mainly for *BSD systems, that need to use gmake instead of make.

@nordlow
Copy link
Author

nordlow commented Jan 18, 2024

Try building with the following:

make
v -prod self

instead of make -f GNUmakefile The GNUmakefile is mainly for *BSD systems, that need to use gmake instead of make.

Ok, thanks. Will try that.

@nordlow
Copy link
Author

nordlow commented Jan 18, 2024

[> Try building with the following:

make
v -prod self
make

passes as

cd ./vc && git clean -xf && git pull --quiet
cd ./thirdparty/tcc && git clean -xf && git pull --quiet
cc  -std=gnu99 -w -o v1.exe ./vc/v.c -lm -lpthread 
./v1.exe -no-parallel -o v2.exe  cmd/v
./v2.exe -nocache -o ./v  cmd/v
rm -rf v1.exe v2.exe
Your `tcc` is working. Good - it is much faster at compiling C source code.
V has been successfully built
V 0.4.4 45e13ea

but

./v -prod self

then fails as

V self compiling (-prod -o v2)...
failed    cmd: '/home/per/.cache/repos/vlang/v' -prod -o v2 'cmd/v'
failed   code: 1
==================
ld: error: undefined symbol: main
>>> referenced by /usr/lib/gcc/x86_64-linux-gnu/12/../../../x86_64-linux-gnu/Scrt1.o:(_start)
collect2: error: ld returned 1 exit status
...
==================
(Use `v -cg` to print the entire error message)

builder error: 
==================
C error. This should never happen.

This is a compiler bug, please report it using `v bug file.v`.

https://github.com/vlang/v/issues/new/choose

You can also use #help on Discord: https://discord.gg/vlang

. Need help.

Note that I need to compile with full optimizations in order get fair benchmarks at when rerunning and updating the table at https://gitlab.com/per.nordlow/compiler-benchmark.

@JalonSolov
Copy link
Contributor

I pulled down a docker image of ubuntu 22.04, installed git and build-essential, then did the following

root@52856e212881:~# git clone https://github.com/vlang/v
Cloning into 'v'...
remote: Enumerating objects: 163543, done.
remote: Counting objects: 100% (20293/20293), done.
remote: Compressing objects: 100% (2284/2284), done.
remote: Total 163543 (delta 18122), reused 18095 (delta 18006), pack-reused 143250
Receiving objects: 100% (163543/163543), 62.07 MiB | 37.63 MiB/s, done.
Resolving deltas: 100% (119119/119119), done.
root@52856e212881:~# cd v
root@52856e212881:~/v# make
make fresh_vc
make[1]: Entering directory '/root/v'
rm -rf ./vc
git clone --filter=blob:none --quiet https://github.com/vlang/vc ./vc
remote: Enumerating objects: 3, done.
remote: Counting objects: 100% (3/3), done.
remote: Compressing objects: 100% (3/3), done.
remote: Total 3 (delta 1), reused 0 (delta 0), pack-reused 0
Receiving objects: 100% (3/3), 1020.57 KiB | 7.91 MiB/s, done.
Resolving deltas: 100% (1/1), done.
make[1]: Leaving directory '/root/v'
cd ./vc && git clean -xf && git pull --quiet
make fresh_tcc
make[1]: Entering directory '/root/v'
rm -rf ./thirdparty/tcc
git clone --filter=blob:none --quiet --branch thirdparty-linux-amd64 https://github.com/vlang/tccbin ./thirdparty/tcc
remote: Enumerating objects: 25, done.
remote: Counting objects: 100% (18/18), done.
remote: Compressing objects: 100% (18/18), done.
remote: Total 25 (delta 0), reused 3 (delta 0), pack-reused 7
Receiving objects: 100% (25/25), 2.07 MiB | 5.11 MiB/s, done.
make[2]: Entering directory '/root/v'
make[2]: Leaving directory '/root/v'
make[1]: Leaving directory '/root/v'
cd ./thirdparty/tcc && git clean -xf && git pull --quiet
cc  -std=gnu99 -w -o v1.exe ./vc/v.c -lm -lpthread 
./v1.exe -no-parallel -o v2.exe  cmd/v
./v2.exe -nocache -o ./v  cmd/v
rm -rf v1.exe v2.exe
Your `tcc` is working. Good - it is much faster at compiling C source code.
V has been successfully built
V 0.4.4 45e13ea
root@52856e212881:~/v# ./v -prod self
V self compiling (-prod -o v2)...
V built successfully as executable "v".
root@52856e212881:~/v#

Note that there were no errors at all - v -prod self worked fine.

This implies there is something else going on with your system that is preventing V from compiling properly.

@nordlow
Copy link
Author

nordlow commented Jan 19, 2024

This implies there is something else going on with your system that is preventing V from compiling properly.

Ok, thanks for looking into it anway.

@nacho00112
Copy link

nacho00112 commented Jan 19, 2024

Have you tried deleting the repository directory and cloning it again,
Maybe that GNUmakefile did something irreversible.

@JalonSolov
Copy link
Contributor

Also delete ~/.vmodules/cache to make sure no cached values are interfering.

@felipensp felipensp added the Build V build error on any OS/CPU architecture. label Jan 22, 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. Build V build error on any OS/CPU architecture.
Projects
None yet
Development

No branches or pull requests

4 participants