Menu

#2 Build fails with clang

Unstable_(example)
open
nobody
clang (1)
1
2018-10-18
2014-08-11
No

covered fails to build using clang, as it gives the following error:

gcc  -g -O2  -Wl,--as-needed -o covered arc.o assertion.o attr.o parser.o static_parser.o binding.o cli.o codegen.o comb.o db.o enumerate.o exclude.o expr.o
 fastlz.o fsm.o fsm_arg.o fsm_var.o fst.o func_iter.o func_unit.o genprof.o gen_item.o info.o instance.o keywords_1995.o keywords_2001.o keywords_sv.o keywo
rds_sys_1995.o keywords_sys_2001.o keywords_sys_sv.o pplexer.o lexer.o line.o link.o lxt.o lxt2_read.o main.o memory.o merge.o obfuscate.o ovl.o param.o par
se.o parser_misc.o perf.o profiler.o race.o rank.o reentrant.o report.o scope.o score.o search.o sim.o stat.o static.o static_lexer.o statement.o stmt_blk.o
 struct_union.o symtable.o sys_tasks.o tcl_funcs.o toggle.o tree.o util.o vcd.o vector.o vsignal.o -L/usr/lib/x86_64-linux-gnu -ltcl8.5 -L/usr/lib/x86_64-li
nux-gnu -ltk8.5 -lX11 -lXss -lXext -lXft -lfontconfig -lfreetype    -lpthread -ldl  -lpthread -lieee -lm -lm -lm -lz 
lxt.o: In function `lxt_parse':
/«PKGBUILDDIR»/src/lxt.c:153: undefined reference to `lxt2_rd_get_num_facs'
/«PKGBUILDDIR»/src/lxt.c:155: undefined reference to `lxt2_rd_set_fac_process_mask_all'
/«PKGBUILDDIR»/src/lxt.c:156: undefined reference to `lxt2_rd_set_max_block_mem_usage'
/«PKGBUILDDIR»/src/lxt.c:172: undefined reference to `lxt2_rd_get_alias_root'
clang: error: linker command failed with exit code 1 (use -v to see invocation)

according to http://clang.debian.net/status.php?version=3.4.2&key=UNDEF_REF, the issue is caused by the inline behaviour: clang is following by default the C99 standard while gcc promote GNU89. So the inline functions need to be declared as static inline.

The attached patch just removed inline from the declaration of all _LXT2_RD_INLINE functions.
I think a better fix would be to make all the _LXT2_RD_INLINE functions to be static, which I wasn't able to confirm till now.
An alternative fix would be to add some code to configure script to add -std=gnu89 argument to the compiler if it is detected to be clang.

1 Attachments

Discussion

  • Ahmed El-Mahmoudy

    Updated patch to fix FTBFS with GCC 5, that is achieved by marking inline function with 'attribute ((gnu_inline))'

     
  • Udara Piumal De Silva

    Thank you for submitting this patch. With the permission of @phase1geo I have created a covered repository in github. Your patch is added to this new repository.
    Please find the new repository at https://github.com/chiphackers/covered

     

Anonymous
Anonymous

Add attachments
Cancel





Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.