open-watcom / open-watcom-v2

Open Watcom V2.0 - Source code repository, Wiki, Latest Binary build, Archived builds including all installers for download.
Other
991 stars 163 forks source link

Build errors on FreeBSD 11 #184

Closed netbsduser closed 8 years ago

netbsduser commented 9 years ago

Evening,

I experience some build errors with OpenWatcom on FreeBSD 11-Current.

The first of note is that it cannot reach builder due to being unable to find gcc. When switched to clang mode it instead complains about being unable to find libsupc++ and libstdc++; replacing references to those with -lc++ produces problems as well.

The next is that a file which makes reference to off_t (it #defines something as off_t) appears to fail to include unistd.h, which defines off_t on FreeBSD. This fails at some point in the build process where it is included by a C file that does not include unistd.h before it.

Finally, I am stalled at this:


============= 19:56:10 /ws/Misc/open-watcom-v2-master/bld/browser =============
=========== 19:56:10 /ws/Misc/open-watcom-v2-master/bld/browser/gen ===========
======= 19:56:10 /ws/Misc/open-watcom-v2-master/bld/browser/brg/dos386 ========
======== 19:56:10 /ws/Misc/open-watcom-v2-master/bld/browser/brg/nt386 ========
======= 19:56:10 /ws/Misc/open-watcom-v2-master/bld/browser/brg/os2386 ========
========== 19:56:10 /ws/Misc/open-watcom-v2-master/bld/browser/nt386 ==========
dosbox -noautoexec -c "mount c /ws/Misc/open-watcom-v2-master/docs" -c "mount d ." -c "mount e /ws/Misc/open-watcom-v2-master/bld" -c "d:wgml.bat" -noconsole
DOSBox version 0.74
## Copyright 2002-2010 DOSBox Team, published under GNU GPL.

CONFIG:Loading primary settings from config file /home/david/.dosbox/dosbox-0.74.conf
MIDI:Opened device:none
DOSBox switched to max cycles, because of the setting: cycles=auto. If the game runs too fast try a fixed cycles amount in DOSBox's options.
Abort
mv: rename TMP.PTF to wbrw.ptf: No such file or directory
Error(E42): Last command making (compile_gml_to_xxx;wbrw.h) returned a bad status
Error(E02): Make execution terminated
Error(E42): Last command making (wbrw) returned a bad status
Error(E02): Make execution terminated
Error(E42): Last command making (/ws/Misc/open-watcom-v2-master/docs/nt/wbrw.h) returned a bad status
Error(E02): Make execution terminated
<pmake -d build         -h> => non-zero return: 512
Build failed```

This is documentation related, it seems; that I `export OWDOCBUILD=0` in my local setvars.sh copy does not appear to affect this issue, and neither does setting OWDOCBUILD=1 help.
jmalak commented 9 years ago

Thanks for your bug report. I already test gcc support for BSD (9.x) build but not Clang. I fixed main build make files for better support Clang 65c135822412ea109331bde05251e24a67bee4cf and 0596ea0bade7d513d326de37953991f3b26d9308. But there is still problem with C++ code to be portable, it will require some afford.

netbsduser commented 9 years ago

Thanks @jmalak, this has fixed some issues with build now. I have since found a few more issues:

===== 15:33:22 /ws/Misc/open-watcom-v2/bld/cpplib/contain/generic.086/mc ======
c++ wcexcept.obj
c++ wchash.obj
Segmentation fault
Error(E42): Last command making (wchash.obj) returned a bad status
Error(E02): Make execution terminated
<pmake -d build         -h> => non-zero return: 512
Build failed

I have managed to retrieve a stack trace for this segmentation fault in bwpp:

#0  TypePointedAt (type=0x1, flags=0x7fffffffca44) at ../../c/type.c:6680
#1  0x00000000004437a5 in pcPtrConvertSrcTgt (a_expr=0x801521d20, tgt_type=0x0, type_tgt=PC_PTR_REGULAR, type_src=PC_PTR_REGULAR, 
    cl_conv=<value optimized out>, conversion=<value optimized out>) at ../../c/convctl.c:1299
#2  0x0000000000443517 in CastPtrToPtr (ctl=0x0) at ../../c/convctl.c:1380
#3  0x0000000000403416 in doCastResult (ctl=0x0, result=<value optimized out>) at ../../c/analcast.c:1648
#4  0x0000000000406ddf in doCastImplicit (expr=<value optimized out>, type=<value optimized out>, reqd=<value optimized out>, 
    diagnosis=<value optimized out>, destination=0x0) at ../../c/analcast.c:2840
#5  0x000000000040208b in NodeConvertCallArgList (call_expr=0x80149cb58, acount=1, type=<value optimized out>, 
    args=<value optimized out>) at ../../c/analcall.c:194
#6  0x00000000004029f8 in AnalyseCall (expr=0x801521b48, diagnostic=0x0) at ../../c/analcall.c:1116
#7  0x00000000004170fc in AnalyseOperator (expr=0x0) at ../../c/analyse.c:3735
#8  0x0000000000418df7 in AnalyseNode (expr=0x1) at ../../c/analyse.c:4230
#9  0x00000000004784d3 in PTreeTraversePostfix (tree=0x0, visit_rtn=0) at ../../c/ptree.c:612
#10 0x0000000000418e8b in run_traversals (expr=0x0) at ../../c/analyse.c:4272
#11 0x0000000000418e20 in AnalyseStmtExpr (expr=0x1) at ../../c/analyse.c:4288
#12 0x000000000045b4ad in declExprStmt (for_stmts_decl=<value optimized out>) at ../../c/fnbody.c:326
#13 0x00000000004596fa in FunctionBody (dinfo=<value optimized out>) at ../../c/fnbody.c:2211
#14 0x00000000004b12dc in doAction (t=Cannot access memory at address 0x9a
) at ytab.c:7301
#15 0x00000000004b1b32 in ParseDecls () at ytab.c:8497
#16 0x0000000000475b0a in doCCompile (argv=<value optimized out>) at ../../c/plusplus.c:353
#17 0x0000000000475445 in front_end (argv=0x0) at ../../c/plusplus.c:467
#18 0x00000000004752c8 in compileFiles (argv=0x0) at ../../c/plusplus.c:490
#19 0x0000000000475206 in compilePrimaryCmd (argv=0x0) at ../../c/plusplus.c:509
#20 0x0000000000475175 in WppCompile (dll_data=<value optimized out>, input=<value optimized out>, output=<value optimized out>)
    at ../../c/plusplus.c:619
#21 0x0000000000468167 in IDERunYourSelfArgv (hdl=<value optimized out>, argc=<value optimized out>, argv=<value optimized out>, 
    fatal_error=0x0) at ../../c/ideentry.c:291
#22 0x00000000004c2087 in IdeDrvExecDLLArgv (inf=0x1, argc=Unhandled dwarf expression opcode 0x93
) at /ws/Misc/open-watcom-v2/bld/watcom/c/idedrv.c:654
#23 0x00000000004c2348 in main (argc=Unhandled dwarf expression opcode 0x93
) at ../../c/maindrv.c:87
jmalak commented 9 years ago

I must review a little bit build make files to properly handle unsupported platforms and use native compilers for build OW. Anyway thanks for your info. I have now installed FreeBSD 11 on VM that I am able to do some testing. It looks like on FreeBSD is problem with building DLL import libraries caused by wlink (it call wlib tool for this task), but something is wrong because import library is blank (no any entries).

stsp commented 8 years ago

I have the same problem on linux. Same crash, same stack trace. If you have any problems with reproducing it, here's the shell script that will reproduce it for you.

a.sh.txt

stsp commented 8 years ago

Here's the fix: 0001-fix-crash-on-build.patch.txt

stsp commented 8 years ago

Please run valgrind on your code - it seems to be finding many errors like this.

stsp commented 8 years ago

I think this is fixed. My testing shows it is fixed by commit 4f92b79, which seems very odd, but it works.

jmalak commented 8 years ago

My check on FreeBSD looks OK. I am closing this issue.