c-semantics icon indicating copy to clipboard operation
c-semantics copied to clipboard

kcc can't compile wrk

Open Lycbel opened this issue 6 years ago • 3 comments

#kcc can't compile the C project wrk, for the first error: #"out of memory" I created the minimized input to reproduce it. You can run the following command

if [ -f "run.sh" ];then
rm run.sh
fi
wget https://raw.githubusercontent.com/Lycbel/cs510Files/master/report4/report_wrk/minimized_input/run.sh
bash run.sh

Lycbel avatar Oct 24 '18 02:10 Lycbel

kcc ran out of memory when trying to build wrk on your computer? What was the exact message? Have you tried maybe increasing the stack size limit (ulimit -s)?

chathhorn avatar Nov 06 '18 19:11 chathhorn

as it is LuaJIT problem, it is moved to LuaJIT's problem

Lycbel avatar Nov 13 '18 07:11 Lycbel

update on wrk: the previous problem is caused by LuaJIT, but I can work around by using the lib which is compiled by gcc. however there is still problems with src of wrk: units.c the compilation will fail with the error:

src/units.c:17:1: error: Encountered an unknown error. This may be due to encountering undefined behavior, an unsupported language feature, or a bug in this tool.

    Unknown error (UNK-1)

src/units.c:23:1: error: Encountered an unknown error. This may be due to encountering undefined behavior, an unsupported language feature, or a bug in this tool.

    Unknown error (UNK-1)

src/units.c:29:1: error: Encountered an unknown error. This may be due to encountering undefined behavior, an unsupported language feature, or a bug in this tool.

    Unknown error (UNK-1)

src/units.c:35:1: error: Encountered an unknown error. This may be due to encountering undefined behavior, an unsupported language feature, or a bug in this tool.

    Unknown error (UNK-1)

Fatal error: exception Stack overflow
Translation failed. To repeat, run this command in directory wrk:
kcc -d -std=c99 -Wall -O2 -D_REENTRANT -D_POSIX_C_SOURCE=200112L -D_BSD_SOURCE -D_DEFAULT_SOURCE -Iobj/include -I/home/andy/Desktop/test598/wrk/include -I/usr/include -c -o obj/units.o src/units.c
Makefile:70: recipe for target 'obj/units.o' failed
make: *** [obj/units.o] Error 2

platform info:

java: 
	java version "1.8.0_181"
	Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
	Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

ubuntu 16.04 on Vmware 5GB memory 

kcc: 	kcc: version 1.0 GNU-compatible

	Build number: 07dcaa9-1541738973679
	Current profile: x86_64-linux-gcc-glibc
	Installed profiles: x86_64-linux-gcc-glibc-gnuc-reverse-eval-order
	                    x86_64-linux-gcc-glibc-gnuc
	                    x86_64-linux-gcc-glibc
	                    x86-gcc-limited-libc
	                    x86_64-linux-gcc-glibc-reverse-eval-order
	Default profile: x86_64-linux-gcc-glibc

make:
	GNU Make 4.1
	Built for x86_64-pc-linux-gnu
	Copyright (C) 1988-2014 Free Software Foundation, Inc.

I created the minimized input and bash file to run it the minimized input unit.c:

#include <stdlib.h>
#include <stdio.h>
typedef struct {
    int scale;
    char *base;
    char *arr[];
} units;
units time_units_us = {// here will have the same problem
    .scale = 1000,
    .base  = "us",
    .arr = { "ms", "s", NULL } 
};

int main()
{
     printf("can work with gcc%d",time_units_us.scale);
     return 0;
}

output:

units.c:8:1: error: Encountered an unknown error. This may be due to encountering undefined behavior, an unsupported language feature, or a bug in this tool.

    Unknown error (UNK-1)

to run it:

wget https://github.com/Lycbel/cs510Files/blob/master/report6/wrk/wrk.zip?raw=true -O wrk.zip
unzip wrk.zip
cd wrk
bash run.sh

Lycbel avatar Nov 26 '18 09:11 Lycbel