vlang / v

Simple, fast, safe, compiled language for developing maintainable software. Compiles itself in <1s with zero library dependencies. Supports automatic C => V translation. https://vlang.io
MIT License
35.76k stars 2.16k forks source link

Clang-Compiled V Fails 4 `build-tools` Tests #15555

Closed ThisNekoGuy closed 1 year ago

ThisNekoGuy commented 2 years ago

V version: 0.3.0 70de4e1 (weekly.2022.34) OS: Arch Linux x86_64

What did you do?

I compiled V using Clang and LTO, then self-hosted (self-compiled) V without LTO using Clang, then attempted to use the resulting V build to compile the build-tools without LTO.

EDIT: The outcome is the same regardless if LTO is used or not, after further testing, so this is not an LTO issue

Understandably, this doesn't happen with TCC, but the goal of performing this was to produce consistent working results with Clang as an alternative to TCC; which, apparently, doesn't go well with this configuration for some reason when it shouldn't. The below shows step-by-step what I did to perform this:

Terminal/Console History: ```bash export CC=clang export LD="/usr/bin/ld.lld" export AR="/usr/bin/llvm-ar" export NM="/usr/bin/llvm-nm" export AS="/usr/bin/llvm-as" export RANLIB="/usr/bin/llvm-ranlib" export OBJCOPY="/usr/bin/llvm-objcopy" export CFLAGS="-march=znver2 -mtune=znver2 -O3 -pipe -fno-plt -minline-all-stringops -fexceptions \ -Wp,-D_FORTIFY_SOURCE=2 -Wformat -Werror=format-security \ -fstack-clash-protection -fstack-protector-strong -fcf-protection" export LDFLAGS="-static -unwind=libunwind -Wl,-O3,--sort-common,--as-needed,-z,relro,-z,now" export LTOFLAGS="-flto=full" export CFLAGS="${CFLAGS} ${LTOFLAGS}" export LDFLAGS="${LDFLAGS} ${LTOFLAGS}" export USE_TCC_COMPILER=false . . . # Downloads and extracts the "weekly.2022.34" release # changes directory to the extracted folder . . . if [ ${USE_TCC_COMPILER} == true ]; then # This is to prevent TCC (if used) from vomiting because of incompatible LDFLAGS export LDFLAGS="" else export VFLAGS="-cc ${CC}" fi make if [ ${USE_TCC_COMPILER} == true ]; then # This is to set a "clean" environment for TCC (if used), though this *shouldn't* be necessary export CC="" export LD="" export AR="" export NM="" export AS="" export RANLIB="" export OBJCOPY="" fi if [ ${USE_TCC_COMPILER} == false ]; then # This filters out LTOFLAGS for V's self-hosted build if [ "${LTOFLAGS}" != "" ]; then export CFLAGS="${CFLAGS/${LTOFLAGS}/}" export LDFLAGS="${LDFLAGS/${LTOFLAGS}/}" fi fi ./v -prod self ./v build-tools ```

What did you expect to see?

Passing build-tools tests

What did you see instead?

4 failed build-tools tests:

Terminal/Console Output: ```v Note: `tcc` was not used, so unless you install it yourself, your backend C compiler will be `cc`, which is usually either `clang`, `gcc` or `msvc`. These C compilers, are several times slower at compiling C source code, compared to `tcc`. They do produce more optimised executables, but that is done at the cost of compilation speed. V has been successfully built V 0.3.0 70de4e1 V self compiling (-prod -o v2)... V built successfully as executable "v". Warning: `markdown` exists, but is not updated. V will continue, since updates can fail due to temporary network problems, and the existing module `markdown` may still work. -------------------------------------------------- ---- Building cmd/tools ... ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- OK [ 1/61] 4714.342 ms cmd/tools/gen1m.v OK [ 2/61] 4747.742 ms cmd/tools/detect_tcc.v OK [ 3/61] 6447.247 ms cmd/tools/fuzz/map_fuzz.v OK [ 4/61] 7520.090 ms cmd/tools/fast/fast_job.v OK [ 5/61] 7766.790 ms cmd/tools/fast/fast.v OK [ 6/61] 8676.020 ms cmd/tools/bench/wyhash.v OK [ 7/61] 8654.397 ms cmd/tools/oldv.v OK [ 8/61] 8886.376 ms cmd/tools/performance_compare.v OK [ 9/61] 7389.579 ms cmd/tools/regress.v FAIL [10/61] 14275.544 ms cmd/tools/gen_vc.v builder error: Your V installation may be out-of-date. Try removing `thirdparty/tcc/` and running `make` OK [11/61] 7876.208 ms cmd/tools/test_if_v_test_system_works.v OK [12/61] 7612.089 ms cmd/tools/test_os_process.v OK [13/61] 9949.081 ms cmd/tools/repeat.v OK [14/61] 7122.032 ms cmd/tools/vbin2v.v OK [15/61] 22192.461 ms cmd/tools/measure/scanner_speed.v OK [16/61] 7958.458 ms cmd/tools/vbug.v OK [17/61] 12263.428 ms cmd/tools/translate.v OK [18/61] 10775.261 ms cmd/tools/vbuild-examples.v OK [19/61] 10927.489 ms cmd/tools/vbuild-vbinaries.v OK [20/61] 8827.340 ms cmd/tools/vbump.v OK [21/61] 13536.220 ms cmd/tools/vbuild-tools.v OK [22/61] 6840.602 ms cmd/tools/vcomplete.v OK [23/61] 11751.973 ms cmd/tools/vbump_test.v OK [24/61] 11852.469 ms cmd/tools/vcheck-md.v OK [25/61] 34621.595 ms cmd/tools/measure/parser_speed.v OK [26/61] 6611.590 ms cmd/tools/vcreate.v OK [27/61] 8606.400 ms cmd/tools/vcompress.v OK [28/61] 10224.179 ms cmd/tools/vcreate_test.v OK [29/61] 8112.759 ms cmd/tools/vdoctor.v OK [30/61] 7231.783 ms cmd/tools/vmissdoc.v FAIL [31/61] 13349.432 ms cmd/tools/vpm.v builder error: Your V installation may be out-of-date. Try removing `thirdparty/tcc/` and running `make` FAIL [32/61] 14021.924 ms cmd/tools/vls.v builder error: Your V installation may be out-of-date. Try removing `thirdparty/tcc/` and running `make` OK [33/61] 9997.531 ms cmd/tools/vrepl.v OK [34/61] 9447.423 ms cmd/tools/vself.v OK [35/61] 20126.332 ms cmd/tools/vgret.v OK [36/61] 6363.360 ms cmd/tools/vshould-compile-all.v OK [37/61] 43160.041 ms cmd/tools/vast OK [38/61] 9208.906 ms cmd/tools/vsetup-freetype.v OK [39/61] 58102.454 ms cmd/tools/builders/interpret_builder.v OK [40/61] 58404.771 ms cmd/tools/builders/native_builder.v OK [41/61] 61164.844 ms cmd/tools/builders/golang_builder.v FAIL [42/61] 12687.160 ms cmd/tools/vshader.v builder error: Your V installation may be out-of-date. Try removing `thirdparty/tcc/` and running `make` OK [43/61] 8207.839 ms cmd/tools/vtest-all.v OK [44/61] 22828.307 ms cmd/tools/vscan.v OK [45/61] 12422.060 ms cmd/tools/vsymlink.v OK [46/61] 66668.547 ms cmd/tools/builders/js_builder.v OK [47/61] 11090.032 ms cmd/tools/vtest-self.v OK [48/61] 11039.845 ms cmd/tools/vtest.v OK [49/61] 13126.114 ms cmd/tools/vtest-cleancode.v OK [50/61] 13211.511 ms cmd/tools/vtest-fmt.v OK [51/61] 9331.681 ms cmd/tools/vtracev.v OK [52/61] 9197.789 ms cmd/tools/vup.v OK [53/61] 5655.810 ms cmd/tools/vwipe-cache.v OK [54/61] 9002.189 ms cmd/tools/vwatch.v OK [55/61] 10117.547 ms cmd/tools/vwhere OK [56/61] 41857.984 ms cmd/tools/vfmt.v OK [57/61] 78984.385 ms cmd/tools/check_os_api_parity.v OK [58/61] 79229.689 ms cmd/tools/builders/c_builder.v OK [59/61] 27697.667 ms cmd/tools/vtest-parser.v OK [60/61] 25295.231 ms cmd/tools/vvet OK [61/61] 58595.046 ms cmd/tools/vdoc --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- Failed command 1: '/mnt/extraStorage/Development/vlang-latest.sh/vlang-latest/src/v-weekly.2022.34/v' -o '/tmp/v/test_session_239240260848741/gen_vc' '/mnt/extraStorage/Development/vlang-latest.sh/vlang-latest/src/v-weekly.2022.34/cmd/tools/gen_vc.v' Failed command 2: '/mnt/extraStorage/Development/vlang-latest.sh/vlang-latest/src/v-weekly.2022.34/v' -o '/tmp/v/test_session_239240260848741/vpm' '/mnt/extraStorage/Development/vlang-latest.sh/vlang-latest/src/v-weekly.2022.34/cmd/tools/vpm.v' Failed command 3: '/mnt/extraStorage/Development/vlang-latest.sh/vlang-latest/src/v-weekly.2022.34/v' -o '/tmp/v/test_session_239240260848741/vls' '/mnt/extraStorage/Development/vlang-latest.sh/vlang-latest/src/v-weekly.2022.34/cmd/tools/vls.v' Failed command 4: '/mnt/extraStorage/Development/vlang-latest.sh/vlang-latest/src/v-weekly.2022.34/v' -o '/tmp/v/test_session_239240260848741/vshader' '/mnt/extraStorage/Development/vlang-latest.sh/vlang-latest/src/v-weekly.2022.34/cmd/tools/vshader.v' Summary for building cmd/tools: 4 failed, 57 passed, 61 total. Runtime: 88420 ms, on 15 parallel jobs. ```
ThisNekoGuy commented 1 year ago

This appears to no longer be a problem with 1b721250e09d72b2f8505752b7099f35f1e2a1cf All tests pass with Clang with at least this latest revision at the time of writing, though I don't know when this changed

shove70 commented 1 year ago

OK, Then close it. Thanks.