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

Fails to build - Ubuntu #25

Open
Ishimachi opened this issue Feb 11, 2024 · 18 comments
Open

Fails to build - Ubuntu #25

Ishimachi opened this issue Feb 11, 2024 · 18 comments

Comments

@Ishimachi
Copy link

Unsure why, but CSpydr is failing to build on Ubuntu while all dependencies are met:

./configure 
checking host system type... linux-gnu
checking for C compiler... /usr/bin/gcc
checking whether the C compiler works... yes
checking for linker... /usr/bin/gcc
checking for pkg-config... /usr/bin/pkg-config
checking pkg-config directory... /usr/share/pkgconfig
checking for bear... found.
checking for git... found.
checking for install... found.
checking for find... found.
checking for mkdir... found.
checking for rm... found.
checking for sed... found.
checking for libpkgconf... found.
checking for json-c... found.
checking for acutest... found.
removing existing /home/ishimachi/Repositories/cspydr/config.mk file... done.
generating /home/ishimachi/Repositories/cspydr/config.mk file... done.

generated configuration:
# Auto-generated by `configure`

CC := /usr/bin/gcc
LD := /usr/bin/gcc
CFLAGS :=  -fPIC -flto -Wall -Wextra -Wno-unused-parameter -DDEFAULT_STD_PATH="\"/usr/local/share/cspydr/std\"" -I/usr/include/pkgconf  -I/usr/include/json-c 
LDFLAGS :=  -lm -lpkgconf  -ljson-c 

INSTALL := /usr/bin/install
FIND := /usr/bin/find
MKDIR := /usr/bin/mkdir
RM := /usr/bin/rm
SED := /usr/bin/sed
BEAR := /usr/bin/bear

PREFIX := /usr/local
EXEC_PREFIX := /usr/local
BUILD_PREFIX := /home/ishimachi/Repositories/cspydr/build
BIN_PREFIX := /home/ishimachi/Repositories/cspydr/build/bin

PKG_CONFIG_DIR := /usr/share/pkgconfig
SRC_DIR := /home/ishimachi/Repositories/cspydr/src

CSPC_DEFAULT_STD_PATH := /usr/local/share/cspydr/std

VERSION := 0.1.1
VERSION_X := 0
VERSION_Y := 1
VERSION_Z := 1

GIT_HASH := cad5936

done.

Error logs:

make
make -C /home/ishimachi/Repositories/cspydr/src/compiler LIBCSPC=/home/ishimachi/Repositories/cspydr/build/bin/libcspc.o CSPC=/home/ishimachi/Repositories/cspydr/build/bin/cspc /home/ishimachi/Repositories/cspydr/build/bin/libcspc.o
make[1]: Entering directory '/home/ishimachi/Repositories/cspydr/src/compiler'
make[1]: '/home/ishimachi/Repositories/cspydr/build/bin/libcspc.o' is up to date.
make[1]: Leaving directory '/home/ishimachi/Repositories/cspydr/src/compiler'
make -C /home/ishimachi/Repositories/cspydr/src/compiler LIBCSPC=/home/ishimachi/Repositories/cspydr/build/bin/libcspc.o CSPC=/home/ishimachi/Repositories/cspydr/build/bin/cspc /home/ishimachi/Repositories/cspydr/build/bin/cspc
make[1]: Entering directory '/home/ishimachi/Repositories/cspydr/src/compiler'
/usr/bin/gcc -lm -lpkgconf  -ljson-c  /home/ishimachi/Repositories/cspydr/build/compiler/./context.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./version.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./parser/typechecker.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./parser/directives.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./parser/utils.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./parser/queue.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./parser/parser.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./parser/validator.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./debugger/breakpoint.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./debugger/register.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./debugger/debugger.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./main.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./c_parser/c_lexer.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./c_parser/c_parser.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./preprocessor/preprocessor.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./preprocessor/stdmacros.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./ast/ast_iterator.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./ast/ast_json.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./ast/types.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./ast/ast.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./memory/allocator.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./toolchain.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./timer/timer.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./interpreter/stack.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./interpreter/interpreter.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./interpreter/value.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./platform/win32/win32_platform.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./platform/pkg_config.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./platform/linux/linux_platform.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./error/error.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./error/panic.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./error/default.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./codegen/asm/asm_codegen.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./codegen/asm/relocation.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./codegen/asm/linker.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./codegen/codegen_utils.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./codegen/transpiler/keywords.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./codegen/transpiler/c_codegen.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./hashmap.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./optimizer/constexpr.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./optimizer/optimizer.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./lexer/token.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./lexer/lexer.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./config.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./list.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./io/io.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./io/file.c.o /home/ishimachi/Repositories/cspydr/build/compiler/./util.c.o -o /home/ishimachi/Repositories/cspydr/build/bin/cspc
/usr/bin/ld: /tmp/ccf7MyUz.ltrans0.ltrans.o: in function `align_type':
<artificial>:(.text+0x14b41): undefined reference to `log'
/usr/bin/ld: <artificial>:(.text+0x14b66): undefined reference to `floor'
/usr/bin/ld: <artificial>:(.text+0x14b81): undefined reference to `pow'
/usr/bin/ld: <artificial>:(.text+0x14bbb): undefined reference to `log'
/usr/bin/ld: <artificial>:(.text+0x14be0): undefined reference to `floor'
/usr/bin/ld: <artificial>:(.text+0x14bfb): undefined reference to `pow'
/usr/bin/ld: <artificial>:(.text+0x14c22): undefined reference to `log'
/usr/bin/ld: <artificial>:(.text+0x14c47): undefined reference to `floor'
/usr/bin/ld: <artificial>:(.text+0x14c62): undefined reference to `pow'
/usr/bin/ld: <artificial>:(.text+0x14c95): undefined reference to `log'
/usr/bin/ld: <artificial>:(.text+0x14cba): undefined reference to `floor'
/usr/bin/ld: <artificial>:(.text+0x14cd5): undefined reference to `pow'
/usr/bin/ld: /tmp/ccf7MyUz.ltrans0.ltrans.o: in function `get_type_align':
<artificial>:(.text+0x15364): undefined reference to `log'
/usr/bin/ld: <artificial>:(.text+0x15389): undefined reference to `floor'
/usr/bin/ld: <artificial>:(.text+0x153a4): undefined reference to `pow'
/usr/bin/ld: <artificial>:(.text+0x153de): undefined reference to `log'
/usr/bin/ld: <artificial>:(.text+0x15403): undefined reference to `floor'
/usr/bin/ld: <artificial>:(.text+0x1541e): undefined reference to `pow'
/usr/bin/ld: <artificial>:(.text+0x15445): undefined reference to `log'
/usr/bin/ld: <artificial>:(.text+0x1546a): undefined reference to `floor'
/usr/bin/ld: <artificial>:(.text+0x15485): undefined reference to `pow'
/usr/bin/ld: <artificial>:(.text+0x154b8): undefined reference to `log'
/usr/bin/ld: <artificial>:(.text+0x154dd): undefined reference to `floor'
/usr/bin/ld: <artificial>:(.text+0x154f8): undefined reference to `pow'
/usr/bin/ld: /tmp/ccf7MyUz.ltrans0.ltrans.o: in function `ast_to_json':
<artificial>:(.text+0x1d779): undefined reference to `json_object_to_json_string_ext'
/usr/bin/ld: <artificial>:(.text+0x1d7ae): undefined reference to `json_object_put'
/usr/bin/ld: /tmp/ccf7MyUz.ltrans0.ltrans.o: in function `gen_str':
<artificial>:(.text+0x1d7d4): undefined reference to `json_object_new_string'
/usr/bin/ld: <artificial>:(.text+0x1d7db): undefined reference to `json_object_new_null'
/usr/bin/ld: /tmp/ccf7MyUz.ltrans0.ltrans.o: in function `gen_i32':
<artificial>:(.text+0x1d7f6): undefined reference to `json_object_new_int'
/usr/bin/ld: /tmp/ccf7MyUz.ltrans0.ltrans.o: in function `gen_i64':
<artificial>:(.text+0x1d814): undefined reference to `json_object_new_int64'
/usr/bin/ld: /tmp/ccf7MyUz.ltrans0.ltrans.o: in function `gen_bool':
<artificial>:(.text+0x1d832): undefined reference to `json_object_new_boolean'
/usr/bin/ld: /tmp/ccf7MyUz.ltrans0.ltrans.o: in function `gen_list':
<artificial>:(.text+0x1d854): undefined reference to `json_object_new_null'
/usr/bin/ld: <artificial>:(.text+0x1d85b): undefined reference to `json_object_new_array'
/usr/bin/ld: <artificial>:(.text+0x1d89a): undefined reference to `json_object_array_add'
/usr/bin/ld: /tmp/ccf7MyUz.ltrans0.ltrans.o: in function `gen_tok':
<artificial>:(.text+0x1d8ce): undefined reference to `json_object_new_null'
/usr/bin/ld: <artificial>:(.text+0x1d8d8): undefined reference to `json_object_new_object'
/usr/bin/ld: <artificial>:(.text+0x1d914): undefined reference to `json_object_object_add'
/usr/bin/ld: <artificial>:(.text+0x1d947): undefined reference to `json_object_object_add'
/usr/bin/ld: <artificial>:(.text+0x1d97c): undefined reference to `json_object_object_add'
/usr/bin/ld: <artificial>:(.text+0x1d9a6): undefined reference to `json_object_object_add'
/usr/bin/ld: <artificial>:(.text+0x1d9de): undefined reference to `json_object_object_add'
/usr/bin/ld: /tmp/ccf7MyUz.ltrans0.ltrans.o: in function `gen_srcfile':
<artificial>:(.text+0x1da00): undefined reference to `json_object_new_null'
/usr/bin/ld: <artificial>:(.text+0x1da07): undefined reference to `json_object_new_object'
/usr/bin/ld: <artificial>:(.text+0x1da35): undefined reference to `json_object_object_add'
/usr/bin/ld: <artificial>:(.text+0x1da5c): undefined reference to `json_object_object_add'
/usr/bin/ld: /tmp/ccf7MyUz.ltrans0.ltrans.o: in function `gen_ast_identifier':
<artificial>:(.text+0x1da7e): undefined reference to `json_object_new_null'
/usr/bin/ld: <artificial>:(.text+0x1da88): undefined reference to `json_object_new_object'
/usr/bin/ld: <artificial>:(.text+0x1dac0): undefined reference to `json_object_object_add'
/usr/bin/ld: <artificial>:(.text+0x1daf8): undefined reference to `json_object_object_add'
/usr/bin/ld: <artificial>:(.text+0x1db2e): undefined reference to `json_object_object_add'
/usr/bin/ld: <artificial>:(.text+0x1db65): undefined reference to `json_object_object_add'
/usr/bin/ld: /tmp/ccf7MyUz.ltrans0.ltrans.o: in function `gen_namespace_start':
<artificial>:(.text+0x1dbce): undefined reference to `json_object_new_object'
/usr/bin/ld: /tmp/ccf7MyUz.ltrans0.ltrans.o: in function `gen_ast_prog':
<artificial>:(.text+0x1dc2c): undefined reference to `json_object_new_object'
/usr/bin/ld: <artificial>:(.text+0x1dc61): undefined reference to `json_object_object_add'
/usr/bin/ld: <artificial>:(.text+0x1dc90): undefined reference to `json_object_object_add'
/usr/bin/ld: <artificial>:(.text+0x1dcc9): undefined reference to `json_object_object_add'
/usr/bin/ld: /tmp/ccf7MyUz.ltrans0.ltrans.o: in function `pkg_config':
<artificial>:(.text+0x293d7): undefined reference to `pkgconf_cross_personality_default'
/usr/bin/ld: <artificial>:(.text+0x29421): undefined reference to `pkgconf_client_new'
/usr/bin/ld: <artificial>:(.text+0x2942a): undefined reference to `pkgconf_cross_personality_default'
/usr/bin/ld: <artificial>:(.text+0x2943c): undefined reference to `pkgconf_client_dir_list_build'
/usr/bin/ld: <artificial>:(.text+0x29452): undefined reference to `pkgconf_pkg_find'
/usr/bin/ld: <artificial>:(.text+0x294b3): undefined reference to `pkgconf_pkg_libs'
/usr/bin/ld: <artificial>:(.text+0x294e8): undefined reference to `pkgconf_error'
/usr/bin/ld: <artificial>:(.text+0x295d9): undefined reference to `pkgconf_fragment_free'
/usr/bin/ld: <artificial>:(.text+0x295ec): undefined reference to `pkgconf_pkg_free'
/usr/bin/ld: <artificial>:(.text+0x295f8): undefined reference to `pkgconf_client_free'
collect2: error: ld returned 1 exit status
make[1]: *** [Makefile:10: /home/ishimachi/Repositories/cspydr/build/bin/cspc] Error 1
make[1]: Leaving directory '/home/ishimachi/Repositories/cspydr/src/compiler'
make: *** [Makefile:25: cspc] Error 2
@Spydr06
Copy link
Owner

Spydr06 commented Feb 12, 2024

Which Ubuntu version?

@Ishimachi
Copy link
Author

Ishimachi commented Feb 12, 2024

Ubuntu 23.10

@Spydr06
Copy link
Owner

Spydr06 commented Feb 12, 2024

Thanks, was able to reproduce it in a VM, fixing rn!

@Spydr06
Copy link
Owner

Spydr06 commented Feb 12, 2024

Hopefully fixed with cffa67d

@Spydr06
Copy link
Owner

Spydr06 commented Feb 12, 2024

Did this fix it?

@Ishimachi
Copy link
Author

I'm currently at work so I will test it once I'm back home and have access to my laptop

@Spydr06
Copy link
Owner

Spydr06 commented Feb 12, 2024

Sure, no pressure

@Ishimachi
Copy link
Author

Ishimachi commented Feb 12, 2024

Sure, no pressure

That worked, built fine. However it fails to run the executable when running cspc run ...

cspc run helloworld.csp 
  Compiling  helloworld.csp
  Optimizing (2/2) evaluate constant expressions
  Generating assembly for x86_64-linux-gnu
  Linking    helloworld.out (executable; dynamic) (c)
  Executing  helloworld.out
error executing helloworld.out: No such file or directory

The executable is created and present in current directory as well.

@Spydr06
Copy link
Owner

Spydr06 commented Feb 13, 2024

Can you check your dynamic linker using ldd on the generated executable?
It works in my Ubuntu 23.10 VM

@Spydr06
Copy link
Owner

Spydr06 commented Feb 13, 2024

Or try linking statically

@Ishimachi
Copy link
Author

Can you check your dynamic linker using ldd on the generated executable? It works in my Ubuntu 23.10 VM

ldd helloworld.out 
	linux-vdso.so.1 (0x00007ffd35ad8000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007f343b800000)
	/lib64/ld-linux-x86-64.so.2 (0x00007f343bb11000)

@Spydr06
Copy link
Owner

Spydr06 commented Feb 13, 2024

That seems alright. Can you try linking statically using --static on the compiler?
Also, what error does your shell give you if you just try to run helloworld.out

Sorry for all the questions, I just cannot reproduce this behavior.

@Ishimachi
Copy link
Author

That seems alright. Can you try linking statically using --static on the compiler? Also, what error does your shell give you if you just try to run helloworld.out

Sorry for all the questions, I just cannot reproduce this behavior.

Same error when running it with --static. Just FYI that the file builds fine into an executable, its the running part that fails when using cspc run

Running the executable manually gives no error, it only fails when doing cspc run ...

Running it with that results in errors:

error executing helloworld.out: No such file or directory
[helloworld.out terminated with exit code 255]

@Spydr06
Copy link
Owner

Spydr06 commented Feb 13, 2024

Ok that's very weird... The "No such file or directory" error could also mean an issue during the linking process, which is much more common in my experience.
What is the path you're trying to run this from? (output of pwd)
It could be that spaces or special characters mess things up.

@Ishimachi
Copy link
Author

Ok that's very weird... The "No such file or directory" error could also mean an issue during the linking process, which is much more common in my experience. What is the path you're trying to run this from? (output of pwd) It could be that spaces or special characters mess things up.

Sorry for the delay.

pwd:
/home/ishimachi/Downloads exactly the same location where the .csp file exists.

@Spydr06
Copy link
Owner

Spydr06 commented Feb 16, 2024

Please excuse me, but I'm really at a loss with this... The compiler can't see the file or can't execute it, even though the file exists and runs normally from the shell, is that correct?

@Ishimachi
Copy link
Author

thats correct

@Spydr06
Copy link
Owner

Spydr06 commented Feb 17, 2024

Okay, I'll keep this issue in mind for when I work on that part of the compiler again, as I can't think of any obvious thing wrong right now. I'll keep you updated.
Thank you for your patience :D

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

No branches or pull requests

2 participants