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

segmentation violation when use C code that do IO #208

Open
aerphanas opened this issue Aug 29, 2024 · 2 comments
Open

segmentation violation when use C code that do IO #208

aerphanas opened this issue Aug 29, 2024 · 2 comments

Comments

@aerphanas
Copy link

os: intel x86_64 GNU/Linux Debian 12
myrddin ver: master branch from github

i am trying to do raylib in myrddin, but when i try to run it it crash, i don't know why, i do simple test to check it
here's the code

bld.proj

bin ctest =
	main.myr
	lib cmain
;;

lib cmain =
	cmain.myr
	cmain.glue.c
;;

main.myr

use std
use cmain

const main = { -> void
	cmain.print_hello()
}

cmain.myr

use std

pkg cmain =
	extern const print_hello : (-> void)
;;

cmain.glue.c

/* CFLAGS: -Wall -Wextra */
/* LIBS: c */

#include <stdio.h>

void
cmain$print_hello()
{
	printf("test");
}

when i compile & run it says this

	cc -c -o obj/cmain.glue.o cmain.glue.c -Wall -Wextra
	ar -rcs obj/libcmain.a obj/cmain.o obj/cmain.glue.o
	6m -O obj -I obj main.myr
	ld --gc-sections -o obj/ctest /usr/local/lib/myr/_myrrt.o obj/main.o -Lobj -lcmain -lc -lstd -L/usr/local/lib/myr -lsys -dynamic-linker /lib64/ld-linux-x86-64.so.2
ld: warning: syscall.o: missing .note.GNU-stack section implies executable stack
ld: NOTE: This behaviour is deprecated and will be removed in a future version of the linker
ctest: exit 1
10887: signal: sys: segmentation violation

but when i change cmain$print_hello() and the rest to just return "int" it works

@aerphanas
Copy link
Author

I tested it with Myrddin version r0.3.1; it works.

@aerphanas
Copy link
Author

The last commit that I know worked is b17873e. After that, a couple of commits couldn't be built, and then in 4d6ba69, it started to segfault.

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

1 participant