modula3 / cm3

Critical Mass Modula-3
http://modula3.github.io/cm3/
Other
134 stars 25 forks source link

Building on macOS Mojave 10.14.3 fails at recompiling HMTime.i3 #46

Closed brakmic closed 5 years ago

brakmic commented 5 years ago

Hi everyone,

I'm trying to compile an AMD64_DARWIN release on my Mac but it always stops at this step:

new exporters -> recompiling HMTime.i3
 -> archiving libcit_util.a
Undefined symbols for architecture x86_64:
  "_UtimeOpsC__delete_T", referenced from:
      _UtimeWrap__delete_T in UtimeWrap_m.o
  "_UtimeOpsC__make_T", referenced from:
      _UtimeWrap__make_T in UtimeWrap_m.o
  "_UtimeOpsC__check_types", referenced from:
      _UtimeOpsC_M3 in UtimeOpsC_m.o
  "_UtimeOpsC__Get_second", referenced from:
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__Get_minute", referenced from:
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__Get_hour", referenced from:
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__Get_month", referenced from:
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__Get_year", referenced from:
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__mktime", referenced from:
      _TZ__Mktime in TZ_m.o
  "_UtimeOpsC__Get_wday", referenced from:
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__Set_second", referenced from:
      _TZ__Mktime in TZ_m.o
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__Set_day", referenced from:
      _TZ__Mktime in TZ_m.o
  "_UtimeOpsC__Get_gmtoff", referenced from:
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__Set_month", referenced from:
      _TZ__Mktime in TZ_m.o
  "_CTZ__setTZ", referenced from:
      _TZ__SetCurTZ in TZ_m.o
      _TZ_M3 in TZ_m.o
  "_UtimeOpsC__Get_zone", referenced from:
      _UCTime__ctime in UCTime_m.o
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__write_double_clock", referenced from:
      _UCTime__ctime in UCTime_m.o
  "_UtimeOpsC__Set_year", referenced from:
      _TZ__Mktime in TZ_m.o
  "_UtimeOpsC__Set_minute", referenced from:
      _TZ__Mktime in TZ_m.o
  "_UtimeOpsC__ctime_r", referenced from:
      _UCTime__ctime in UCTime_m.o
  "_UtimeOpsC__Get_day", referenced from:
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__localtime_r", referenced from:
      _UCTime__ctime in UCTime_m.o
      _TZ__Mktime in TZ_m.o
      _TZ__Localtime in TZ_m.o
  "_UtimeOpsC__Set_hour", referenced from:
      _TZ__Mktime in TZ_m.o
  "_diskAvail", referenced from:
      _SysPerf__DiskAvail in SysPerf_m.o
  "_getloadavg_glue", referenced from:
      _SysPerf__GetLoadAvg in SysPerf_m.o
  "_printf_prints", referenced from:
      _RTRefStats__Visit in RTRefStats_m.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
  make_lib => 1
librarian failed building: cit_util
Fatal Error: package build failed
 *** execution of [<function _BuildGlobalFunction at 0x10f6b87d0>, <function _ShipFunction at 0x10f6b8848>] failed ***
ERROR: ./do-cm3-all.py buildship

I've properly setup the environment, with the latest available x64 compiler release for macOS. I've used boot2.py from scripts/python directory to kickoff the compilation.

I'm not sure if there are any alternative ways to compile the toolchain.

Kind regards,

mikanystrom commented 5 years ago

Yes, I think it is fine with just "gcc". It ought to be a few lines of changes in Darwin.common to get that to work more generally.

On Fri, Mar 15, 2019 at 5:58 PM Harris Brakmić notifications@github.com wrote:

Yes, this is what I am hoping for. Ideally, there would be no need to change anything in compiler configuration files. If it compiles with the two changes from above then maybe one could make a few changes for macOS (if this issue happens on macs only).

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/modula3/cm3/issues/46#issuecomment-473385998, or mute the thread https://github.com/notifications/unsubscribe-auth/AFWGpR3q7ZHtlihroTTcTTZdJ_fneJwXks5vW98-gaJpZM4b1aCr .

brakmic commented 5 years ago

I'm now getting C99 errors in other files (voronoi.c):

../src/voronoi.c:53:5: error: implicit declaration of function 'PQinsert' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                {       PQinsert(bisector, p, dist(p,newsite));
                        ^
../src/voronoi.c:65:3: error: implicit declaration of function 'out_triple' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                out_triple(bot, top, rightreg(lbnd));
                ^
../src/voronoi.c:67:3: error: implicit declaration of function 'makevertex' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                makevertex(v);
                ^
../src/voronoi.c:68:3: error: implicit declaration of function 'endpoint' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                endpoint(lbnd->ELedge,lbnd->ELpm,v);
                ^
../src/voronoi.c:70:3: error: implicit declaration of function 'ELdelete' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                ELdelete(lbnd);
                ^
../src/voronoi.c:71:3: error: implicit declaration of function 'PQdelete' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                PQdelete(rbnd);
                ^
../src/voronoi.c:78:3: error: implicit declaration of function 'ELinsert' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                ELinsert(llbnd, bisector);
                ^
../src/voronoi.c:82:4: error: implicit declaration of function 'PQinsert' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                        PQinsert(llbnd, p, dist(p,bot));
                        ^
../src/voronoi.c:85:5: error: implicit declaration of function 'PQinsert' is invalid in C99 [-Werror,-Wimplicit-function-declaration]
                {       PQinsert(bisector, p, dist(p,bot));
                        ^
../src/voronoi.c:93:3: error: implicit declaration of function 'out_ep' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

But the caltech_ files seem to have been successfully compiled.

brakmic commented 5 years ago

There is only one entry with voronoi in pkginfo.txt so maybe just remove it?

voronoi caltech-other
mikanystrom commented 5 years ago

remove -Werror ...?

On Fri, Mar 15, 2019 at 6:29 PM Harris Brakmić notifications@github.com wrote:

I'm now getting C99 errors in other files (voronoi.c):

../src/voronoi.c:53:5: error: implicit declaration of function 'PQinsert' is invalid in C99 [-Werror,-Wimplicit-function-declaration] { PQinsert(bisector, p, dist(p,newsite)); ^ ../src/voronoi.c:65:3: error: implicit declaration of function 'out_triple' is invalid in C99 [-Werror,-Wimplicit-function-declaration] out_triple(bot, top, rightreg(lbnd)); ^ ../src/voronoi.c:67:3: error: implicit declaration of function 'makevertex' is invalid in C99 [-Werror,-Wimplicit-function-declaration] makevertex(v); ^ ../src/voronoi.c:68:3: error: implicit declaration of function 'endpoint' is invalid in C99 [-Werror,-Wimplicit-function-declaration] endpoint(lbnd->ELedge,lbnd->ELpm,v); ^ ../src/voronoi.c:70:3: error: implicit declaration of function 'ELdelete' is invalid in C99 [-Werror,-Wimplicit-function-declaration] ELdelete(lbnd); ^ ../src/voronoi.c:71:3: error: implicit declaration of function 'PQdelete' is invalid in C99 [-Werror,-Wimplicit-function-declaration] PQdelete(rbnd); ^ ../src/voronoi.c:78:3: error: implicit declaration of function 'ELinsert' is invalid in C99 [-Werror,-Wimplicit-function-declaration] ELinsert(llbnd, bisector); ^ ../src/voronoi.c:82:4: error: implicit declaration of function 'PQinsert' is invalid in C99 [-Werror,-Wimplicit-function-declaration] PQinsert(llbnd, p, dist(p,bot)); ^ ../src/voronoi.c:85:5: error: implicit declaration of function 'PQinsert' is invalid in C99 [-Werror,-Wimplicit-function-declaration] { PQinsert(bisector, p, dist(p,bot)); ^ ../src/voronoi.c:93:3: error: implicit declaration of function 'out_ep' is invalid in C99 [-Werror,-Wimplicit-function-declaration]

But the caltech_ files seem to have been successfully compiled.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/modula3/cm3/issues/46#issuecomment-473396194, or mute the thread https://github.com/notifications/unsubscribe-auth/AFWGpcT-SQqrh4KbZ2OkAEpa8-sGMoFxks5vW-Z7gaJpZM4b1aCr .

brakmic commented 5 years ago

Ok, I'll do it. Now eating away all the warnings :)

brakmic commented 5 years ago

Hm, seems not to be working. Still the same error although I've commented out the section with "-Werror".

I'm using ./do-cm3-all.py buildship to compile. Is there maybe any caching of config files?

brakmic commented 5 years ago

I have manually compiled libvoronoi in its AMD64_DARWIN subdirectory and it worked (without the flag -Werror of course).

Still not sure why the compiled isn't using the updated Darwin.common that has -Werror commented out.

brakmic commented 5 years ago

Another error, this time regarding libtool. Maybe some flags in config are missing?

****  PARALLEL BACK-END BUILD, M3_PARALLEL_BACK = 20
 -> archiving libnewuoa.a
error: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool: no files specified
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -static [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-sacLT] [-no_warning_for_no_symbols]
Usage: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/libtool -dynamic [-] file [...] [-filelist listfile[,dirname]] [-arch_only arch] [-o output] [-install_name name] [-compatibility_version #] [-current_version #] [-seg1addr 0x#] [-segs_read_only_addr 0x#] [-segs_read_write_addr 0x#] [-seg_addr_table <filename>] [-seg_addr_table_filename <file_system_path>] [-all_load] [-noall_load]
  make_lib => 1
librarian failed building: newuoa
Fatal Error: package build failed
 *** execution of [<function _BuildGlobalFunction at 0x10b9417d0>, <function _ShipFunction at 0x10b941848>] failed ***
brakmic commented 5 years ago

After I have removed the newuoa caltech-other-entry from pkginfo.txt it compiled successfully.

g++   -g -O2 -DIN_GCC  -Wno-missing-field-initializers -W -Wall -Wno-narrowing -Wwrite-strings -Wcast-qual -Wmissing-format-attribute -pedantic -Wno-long-long -Wno-variadic-macros -Wno-overlength-strings   -DHAVE_CONFIG_H  -o m3cgc1 m3cg/parse.o attribs.o main.o tree-browser.o libbackend.a libcommon-target.a libcommon.a ../libcpp/libcpp.a libcommon.a ../libcpp/libcpp.a ../libiberty/libiberty.a
Forced ship of cm3cg.
 ==> /Users/brakmic/projects/learning/m3/cm3/m3-sys/m3cc done

 +++ /usr/local/cm3/bin/cm3  -ship -DROOT=/Users/brakmic/projects/learning/m3/cm3 +++
--- shipping from AMD64_DARWIN ---

. => /usr/local/cm3/bin
  cm3cg
 ==> /Users/brakmic/projects/learning/m3/cm3/m3-sys/m3cc done

do-cm3-all.py: Success.

I think this is acceptable for now. Of course this one project should still compile & get archived successfully, but I am not sure what else I could do to make it happen.

brakmic commented 5 years ago

And to help fellow macOS users save their time here the distribution packages hosted on my server:

File: cm3-all-AMD64_DARWIN-d5.10.0-Darwin18.2.0-20190315.tar.gz SHA256: 803ad9df07bd3cbb3b68dcae739ffe93c3cda432f4b292aa13f166260d2e5913 Malware Report Download Link


File: cm3-min-AMD64_DARWIN-d5.10.0-Darwin18.2.0-20190315.tar.gz SHA256: 96a58b17898fc9f3dcf2ee3398c141186a369664a75046854e5b4f8e88fbedf3 Malware Report Download Link

mikanystrom commented 5 years ago

Looks good. newuoa may be written in assembly...so maybe it will only build on AMD64_LINUX or similar. Not sure the assembly is compatible with AMD64_DARWIN.

The assembly was generated by ifort running on Fortran files, which are checked in but not set up to be compiled. If you have f2c or g77 that would be another way to build these things, by working directly from the Fortran.

But you probably don't care about this. Unless you want to use NEWUOA of course!

https://en.wikipedia.org/wiki/NEWUOA

On Fri, Mar 15, 2019 at 7:33 PM Harris Brakmić notifications@github.com wrote:

And to help fellow macOS users save their time here the distribution packages hosted on my server:

File: cm3-all-AMD64_DARWIN-d5.10.0-Darwin18.2.0-20190315.tar.gz SHA256: 803ad9df07bd3cbb3b68dcae739ffe93c3cda432f4b292aa13f166260d2e5913 Malware Report https://www.virustotal.com/#/file/803ad9df07bd3cbb3b68dcae739ffe93c3cda432f4b292aa13f166260d2e5913 Download Link https://brakmic.com/download/tar/cm3-all-AMD64_DARWIN-d5.10.0-Darwin18.2.0-20190315.tar.gz

File: cm3-min-AMD64_DARWIN-d5.10.0-Darwin18.2.0-20190315.tar.gz SHA256: 96a58b17898fc9f3dcf2ee3398c141186a369664a75046854e5b4f8e88fbedf3 Malware Report https://www.virustotal.com/#/file/96a58b17898fc9f3dcf2ee3398c141186a369664a75046854e5b4f8e88fbedf3 Download Link https://brakmic.com/download/tar/cm3-min-AMD64_DARWIN-d5.10.0-Darwin18.2.0-20190315.tar.gz

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/modula3/cm3/issues/46#issuecomment-473415126, or mute the thread https://github.com/notifications/unsubscribe-auth/AFWGpY1rjjl5NmzX39cz0-cdaFb2ltDDks5vW_V0gaJpZM4b1aCr .

brakmic commented 5 years ago

Hm, assembly. There is another variable referencing the assembler in Darwin.config that had g++ as value and I replaced it with gcc. Maybe I should have left it untouched?

brakmic commented 5 years ago

It was this entry: SYSTEM_CC_ASM = "g++" Let me try to compile everything again, just to get the whole package.

mikanystrom commented 5 years ago

no I think we normally use gcc to build the assembly.

Here is what I see on AMD64_LINUX:

new source -> compiling bigden.s gcc -gstabs+ -m64 -fPIC -g -c ../src/bigden.s -o bigden.o

new source -> compiling biglag.s gcc -gstabs+ -m64 -fPIC -g -c ../src/biglag.s -o biglag.o

new source -> compiling calfun.s gcc -gstabs+ -m64 -fPIC -g -c ../src/calfun.s -o calfun.o

new source -> compiling newuoa.s gcc -gstabs+ -m64 -fPIC -g -c ../src/newuoa.s -o newuoa.o

new source -> compiling newuob.s gcc -gstabs+ -m64 -fPIC -g -c ../src/newuob.s -o newuob.o

new source -> compiling trsapp.s gcc -gstabs+ -m64 -fPIC -g -c ../src/trsapp.s -o trsapp.o

new source -> compiling update.s gcc -gstabs+ -m64 -fPIC -g -c ../src/update.s -o update.o

On Fri, Mar 15, 2019 at 7:59 PM Harris Brakmić notifications@github.com wrote:

Hm, assembly. There is another variable referencing the assembler in Darwin.config that had g++ as value and I replaced it with gcc. Maybe I should have left it untouched?

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/modula3/cm3/issues/46#issuecomment-473422232, or mute the thread https://github.com/notifications/unsubscribe-auth/AFWGpa4tkgzb-6ppGg5HQkaFzlW3afMRks5vW_uZgaJpZM4b1aCr .

brakmic commented 5 years ago

Ok, no problem. I was referring to this line in Darwin.common.

mikanystrom commented 5 years ago

yes I see... I'd maybe use gcc for that too (and not g++)

On Fri, Mar 15, 2019 at 8:04 PM Harris Brakmić notifications@github.com wrote:

Ok, no problem. I was referring to this line https://github.com/modula3/cm3/blob/master/m3-sys/cminstall/src/config-no-install/Darwin.common#L111 in Darwin.common.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/modula3/cm3/issues/46#issuecomment-473423693, or mute the thread https://github.com/notifications/unsubscribe-auth/AFWGpUY8FpYsJe15qnpCvzWGpLdrXflBks5vW_zPgaJpZM4b1aCr .

brakmic commented 5 years ago

Yes, you're right. It still doesn't work. Even with g++ set in SYSTEM_CC_ASM. So, then I think we will remain with the current package.

Many thanks for all the info and hints! 👍 Now I can try to build something with CM3!

jaykrell commented 3 years ago

I fixed all the Caltech stuff to compile ok as C++. i.e. converted from K&R to ANSI and added extern "C". It should compile as C or C++ and mean the same thing either way. Sorry about that. I don't know how you got a mix though.