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

fix low verion gcc build err #635

Merged
merged 1 commit into from
Aug 12, 2024
Merged

fix low verion gcc build err #635

merged 1 commit into from
Aug 12, 2024

Conversation

ririyeye
Copy link
Contributor

@ririyeye ririyeye commented Aug 6, 2024

/home/wangyang/cross/.xmake/cache/packages/2408/t/txiki.js/v24.6.0/source/txiki.js/src/builtins.c:44:34: error: initializer element is not constant { "tjs:assert", tjs__assert, tjs__assert_size }, ^~~~~~~~~~~~~~~~ /home/wangyang/cross/.xmake/cache/packages/2408/t/txiki.js/v24.6.0/source/txiki.js/src/builtins.c:44:34: note: (near initialization for ‘builtins[0].data_size’) /home/wangyang/cross/.xmake/cache/packages/2408/t/txiki.js/v24.6.0/source/txiki.js/src/builtins.c:45:28: error: initializer element is not constant { "tjs:ffi", tjs__ffi, tjs__ffi_size }, ^~~~~~~~~~~~~ /home/wangyang/cross/.xmake/cache/packages/2408/t/txiki.js/v24.6.0/source/txiki.js/src/builtins.c:45:28: note: (near initialization for ‘builtins[1].data_size’) /home/wangyang/cross/.xmake/cache/packages/2408/t/txiki.js/v24.6.0/source/txiki.js/src/builtins.c:46:36: error: initializer element is not constant { "tjs:getopts", tjs__getopts, tjs__getopts_size }, ^~~~~~~~~~~~~~~~~ /home/wangyang/cross/.xmake/cache/packages/2408/t/txiki.js/v24.6.0/source/txiki.js/src/builtins.c:46:36: note: (near initialization for ‘builtins[2].data_size’) /home/wangyang/cross/.xmake/cache/packages/2408/t/txiki.js/v24.6.0/source/txiki.js/src/builtins.c:47:36: error: initializer element is not constant { "tjs:hashing", tjs__hashing, tjs__hashing_size }, ^~~~~~~~~~~~~~~~~ /home/wangyang/cross/.xmake/cache/packages/2408/t/txiki.js/v24.6.0/source/txiki.js/src/builtins.c:47:36: note: (near initialization for ‘builtins[3].data_size’) /home/wangyang/cross/.xmake/cache/packages/2408/t/txiki.js/v24.6.0/source/txiki.js/src/builtins.c:48:34: error: initializer element is not constant { "tjs:ipaddr", tjs__ipaddr, tjs__ipaddr_size }, ^~~~~~~~~~~~~~~~ /home/wangyang/cross/.xmake/cache/packages/2408/t/txiki.js/v24.6.0/source/txiki.js/src/builtins.c:48:34: note: (near initialization for ‘builtins[4].data_size’) /home/wangyang/cross/.xmake/cache/packages/2408/t/txiki.js/v24.6.0/source/txiki.js/src/builtins.c:49:30: error: initializer element is not constant { "tjs:path", tjs__path, tjs__path_size }, ^~~~~~~~~~~~~~ /home/wangyang/cross/.xmake/cache/packages/2408/t/txiki.js/v24.6.0/source/txiki.js/src/builtins.c:49:30: note: (near initialization for ‘builtins[5].data_size’) /home/wangyang/cross/.xmake/cache/packages/2408/t/txiki.js/v24.6.0/source/txiki.js/src/builtins.c:50:46: error: initializer element is not constant { "tjs:posix-socket", tjs__posix_socket, tjs__posix_socket_size }, ^~~~~~~~~~~~~~~~~~~~~~ /home/wangyang/cross/.xmake/cache/packages/2408/t/txiki.js/v24.6.0/source/txiki.js/src/builtins.c:50:46: note: (near initialization for ‘builtins[6].data_size’) /home/wangyang/cross/.xmake/cache/packages/2408/t/txiki.js/v24.6.0/source/txiki.js/src/builtins.c:51:34: error: initializer element is not constant { "tjs:sqlite", tjs__sqlite, tjs__sqlite_size }, ^~~~~~~~~~~~~~~~ /home/wangyang/cross/.xmake/cache/packages/2408/t/txiki.js/v24.6.0/source/txiki.js/src/builtins.c:51:34: note: (near initialization for ‘builtins[7].data_size’) /home/wangyang/cross/.xmake/cache/packages/2408/t/txiki.js/v24.6.0/source/txiki.js/src/builtins.c:52:30: error: initializer element is not constant { "tjs:uuid", tjs__uuid, tjs__uuid_size }, ^~~~~~~~~~~~~~ /home/wangyang/cross/.xmake/cache/packages/2408/t/txiki.js/v24.6.0/source/txiki.js/src/builtins.c:52:30: note: (near initialization for ‘builtins[8].data_size’)

low version gcc will trig error like this

@saghul
Copy link
Owner

saghul commented Aug 6, 2024

I hate versions trigger that behavior?!

@ririyeye
Copy link
Contributor Author

ririyeye commented Aug 6, 2024

i tried gcc 7.5 and 5.4 ,it does not work
but gcc 13 works well

@saghul
Copy link
Owner

saghul commented Aug 12, 2024

You'd need to update the code that genrates those C files, since your changes wwould be overwritten otherwise.

That's here:

fprintf(fo, "const uint8_t %s%s[%u] = {\n", prefix, c_name, (unsigned int) out_buf_len);

@saghul
Copy link
Owner

saghul commented Aug 12, 2024

You need to run make js to make sure all the C files are generated after your changes. Then commit the result.

@saghul
Copy link
Owner

saghul commented Aug 12, 2024

Ah, one of my PRs now creates a conflict, oh well. Can you rebase?

@saghul
Copy link
Owner

saghul commented Aug 12, 2024

/usr/local/bin/cmake -E cmake_link_script CMakeFiles/tjs-cli.dir/link.txt --verbose=1
/usr/bin/cc -O3 -DNDEBUG "CMakeFiles/tjs-cli.dir/src/cli.c.o" "CMakeFiles/tjs-cli.dir/src/mod_posix-socket.c.o" -o tjs  libtjs.a ffi_root/usr/local/lib/libffi.a deps/quickjs/libqjs.a deps/libuv/libuv.a -ldl -lrt deps/wasm3/source/libm3.a deps/sqlite3/libsqlite3.a -lm -lpthread /usr/lib/x86_64-linux-gnu/libcurl.so deps/mimalloc/libmimalloc.a /usr/lib/x86_64-linux-gnu/libpthread.a /usr/lib/x86_64-linux-gnu/librt.a
/usr/bin/ld: libtjs.a(mod_sys.c.o): warning: relocation against `tjs__run_repl_size' in read-only section `.text'
/usr/bin/ld: libtjs.a(vm.c.o): in function `TJS_NewRuntimeInternal':
/home/runner/work/txiki.js/txiki.js/src/vm.c:341: undefined reference to `tjs__polyfills_size'
/usr/bin/ld: /home/runner/work/txiki.js/txiki.js/src/vm.c:342: undefined reference to `tjs__core_size'
/usr/bin/ld: libtjs.a(vm.c.o): in function `TJS_Run':
/home/runner/work/txiki.js/txiki.js/src/vm.c:505: undefined reference to `tjs__run_main_size'
/usr/bin/ld: libtjs.a(worker.c.o): in function `worker_entry':
/home/runner/work/txiki.js/txiki.js/src/worker.c:386: undefined reference to `tjs__worker_bootstrap_size'
/usr/bin/ld: libtjs.a(mod_sys.c.o): in function `tjs_runRepl':
/home/runner/work/txiki.js/txiki.js/src/mod_sys.c:61: undefined reference to `tjs__run_repl_size'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status

@ririyeye
Copy link
Contributor Author

/usr/local/bin/cmake -E cmake_link_script CMakeFiles/tjs-cli.dir/link.txt --verbose=1
/usr/bin/cc -O3 -DNDEBUG "CMakeFiles/tjs-cli.dir/src/cli.c.o" "CMakeFiles/tjs-cli.dir/src/mod_posix-socket.c.o" -o tjs  libtjs.a ffi_root/usr/local/lib/libffi.a deps/quickjs/libqjs.a deps/libuv/libuv.a -ldl -lrt deps/wasm3/source/libm3.a deps/sqlite3/libsqlite3.a -lm -lpthread /usr/lib/x86_64-linux-gnu/libcurl.so deps/mimalloc/libmimalloc.a /usr/lib/x86_64-linux-gnu/libpthread.a /usr/lib/x86_64-linux-gnu/librt.a
/usr/bin/ld: libtjs.a(mod_sys.c.o): warning: relocation against `tjs__run_repl_size' in read-only section `.text'
/usr/bin/ld: libtjs.a(vm.c.o): in function `TJS_NewRuntimeInternal':
/home/runner/work/txiki.js/txiki.js/src/vm.c:341: undefined reference to `tjs__polyfills_size'
/usr/bin/ld: /home/runner/work/txiki.js/txiki.js/src/vm.c:342: undefined reference to `tjs__core_size'
/usr/bin/ld: libtjs.a(vm.c.o): in function `TJS_Run':
/home/runner/work/txiki.js/txiki.js/src/vm.c:505: undefined reference to `tjs__run_main_size'
/usr/bin/ld: libtjs.a(worker.c.o): in function `worker_entry':
/home/runner/work/txiki.js/txiki.js/src/worker.c:386: undefined reference to `tjs__worker_bootstrap_size'
/usr/bin/ld: libtjs.a(mod_sys.c.o): in function `tjs_runRepl':
/home/runner/work/txiki.js/txiki.js/src/mod_sys.c:61: undefined reference to `tjs__run_repl_size'
/usr/bin/ld: warning: creating DT_TEXTREL in a PIE
collect2: error: ld returned 1 exit status

maybe the first patch is best, and is src/builtins.c a codegen C file?

@saghul
Copy link
Owner

saghul commented Aug 12, 2024

Turns out, yeah! Thanks for giving it a try though.

@saghul saghul merged commit b50f2f1 into saghul:master Aug 12, 2024
18 checks passed
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.

2 participants