GithubHelp home page GithubHelp logo

Comments (68)

mikanystrom avatar mikanystrom commented on September 14, 2024 1

from cm3.

jaykrell avatar jaykrell commented on September 14, 2024 1

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.

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

brakmic avatar brakmic commented on September 14, 2024
  • I've used the latest available cm3 package for x64 macOS: cm3-bin-core-AMD64_DARWIN-d5.10.0-i386-unknown-Darwin15.6.0-2016-11-20-19-16-08.tgz
  • the CM3 sources are from the current master.
  • I installed the cm3 package to /usr/local/cm3
  • set the CM3_ROOT to point it
  • and then went to compile it with scripts/python/boot2.py.

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

brakmic avatar brakmic commented on September 14, 2024

Ok, I've started the compilation process again. Will come back when I know more.
I only use macOS, so no AMD64_LINUX here.

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

brakmic avatar brakmic commented on September 14, 2024

I hope so :)
And if it works I think I could make a package containing all the binaries/libs so other macOS users don't have to repeat it again.

Not sure how to contact the maintainers of this repo. 🤔

from cm3.

brakmic avatar brakmic commented on September 14, 2024

Hm, same error. :(

from cm3.

brakmic avatar brakmic commented on September 14, 2024
  "_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

from cm3.

brakmic avatar brakmic commented on September 14, 2024

However, I think this error has to do with certain flags passed to the linker on macOS. I had a similar error in some other package unrelated to cm3. When I checked the Makefile there it came out that my linker doesn't accept certain flags like -dyand -dn. After I have removed them the compilation could continue.

So maybe I am experiencing the same problem with cm3?

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

brakmic avatar brakmic commented on September 14, 2024

Ok, then I will try all the methods and report back!

from cm3.

brakmic avatar brakmic commented on September 14, 2024

Here is the output of nm libcit_common.dylib from cm3/caltech-parser/cit_common/AMD64_DARWIN

nm libcit_common.dylib
                 U _FloatMode_I3
00000000000040c0 s _L_1
0000000000004160 s _L_1
                 U _Lex_I3
0000000000004560 d _MI_TextReader
0000000000004720 d _MM_TextReader
                 U _RTHooks_I3
                 U _RTHooks__AllocateTracedObj
                 U _RTHooks__CheckLoadTracedRef
                 U _RTHooks__CheckStoreTraced
                 U _RTHooks__Concat
                 U _RTHooks__PopEFrame
                 U _RTHooks__PushEFrame
                 U _RTHooks__Raise
                 U _RTHooks__ReportFault
                 U _RTHooks__TextLitGetChar
                 U _RTHooks__TextLitGetChars
                 U _RTHooks__TextLitGetWideChar
                 U _RTHooks__TextLitGetWideChars
                 U _RTHooks__TextLitInfo
                 U _RdCopy_I3
                 U _RdCopy__ToWriter
                 U _Rd_I3
                 U _Scan_I3
                 U _Scan__Bool
                 U _Scan__Int
                 U _Scan__LongReal
                 U _TextList_I3
                 U _TextList__Cons
                 U _TextList__ReverseD
0000000000002173 T _TextReader_I3
000000000000392c T _TextReader_M3
00000000000024ba t _TextReader__Get
0000000000003811 t _TextReader__GetBool
0000000000003852 t _TextReader__GetCard
00000000000037ca t _TextReader__GetInt
0000000000003776 t _TextReader__GetLR
0000000000003138 t _TextReader__Init
00000000000031ea t _TextReader__InitFromRd
000000000000261a t _TextReader__IsEmpty
00000000000038e0 T _TextReader__New
0000000000002f78 t _TextReader__Next
0000000000002521 t _TextReader__NextE
000000000000269a t _TextReader__NextS
000000000000259d t _TextReader__NextSE
0000000000003614 t _TextReader__PushBack
0000000000002184 t _TextReader__Save
00000000000033d1 t _TextReader__Shatter
00000000000032e8 t _TextReader__Shatter__CheckOverlap.1166
0000000000002321 t _TextReader__Unwind
                 U _TextWr_I3
                 U _TextWr__ToText
                 U _Text_I3
                 U _Text__FindChar
                 U _Text__GetChar
                 U _Text__Length
                 U _Text__Sub
                 U _Thread_I3
                 U _Wr_I3
000000000000393d t __m3_fault
                 U __setjmp
                 U _m3_jmpbuf_size
                 U _set_union
                 U dyld_stub_binder

from cm3.

brakmic avatar brakmic commented on September 14, 2024

When I execute cm3 -keep -verbose in cm3/caltech-parser I get this error (maybe completely unrelated to my problem, so not sure how helful this info is):

Looking in ../drawcontext/src
ignoring ../drawcontext/src/form.ps (not a directory)
ignoring ../drawcontext/src/m3makefile (not a directory)
ignoring ../drawcontext/src/m3overrides (not a directory)
ignoring ../drawcontext/src/times.afm (not a directory)
ignoring ../AMD64_DARWIN (derived object directory)
ignoring ../PkgTags (not a directory)
EVAL ("m3make.args")
rm .M3SHIP
rm .M3OVERRIDES
rm Main.o
ln -s ../m3tmplhack/AMD64_DARWIN/Main.o Main.o
rm _m3main.o
ln -s ../m3tmplhack/AMD64_DARWIN/_m3main.o _m3main.o

Fatal Error: duplicate unit: ../m3tmplhack/src/Main.m3 ../m3browserhack/src/Main.m3


 seconds  #times  operation
    0.02       3  garbage collection
    0.29          other
---------------------------------------------------
    0.31          TOTAL

cd ..
is_empty (AMD64_DARWIN) => Main.o

from cm3.

brakmic avatar brakmic commented on September 14, 2024

And this is the result of cm3 -keep -verbose in cm3/caltech-parser/cit_util (showing only the last few lines)

  "_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)
rm libcit_util.a
  make_lib => 1
  make_lib => 1
librarian failed building: cit_util
Fatal Error: package build failed

 seconds  #times  operation
    0.03      10  inhaling library link info
    0.18       1  getting derived timestamps
    0.01     384  checking timestamps
    0.01     379  checking old link info
    0.02     363  merging new link info
    0.45       1  building library archive
    0.02       3  garbage collection
---------------------------------------------------
    0.75          TOTAL

cd ..

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

brakmic avatar brakmic commented on September 14, 2024

Ok, didn't know that.
So I will run it in cm3 itself. Btw. here the nm output for TZ_m.o

0000000000001478 s EH_frame1
                 U _CTZ_I3
                 U _CTZ__setTZ
                 U _Ctypes_I3
                 U _Date_I3
                 U _Debug_I3
                 U _Debug__GetLevel
                 U _Debug__Out
                 U _Env_I3
                 U _Env__Get
                 U _FS_I3
                 U _FS__Status
                 U _Fmt_I3
                 U _Fmt__LongReal
0000000000000de0 s _L_1
                 U _M3toC_I3
                 U _M3toC__CopyStoT
                 U _M3toC__CopyTtoS
                 U _M3toC__FreeCopiedS
0000000000001180 d _MM_TZ
                 U _OSError_I3
                 U _RTHooks_I3
                 U _RTHooks__AllocateTracedObj
                 U _RTHooks__CheckLoadTracedRef
                 U _RTHooks__CheckStoreTraced
                 U _RTHooks__Concat
                 U _RTHooks__PopEFrame
                 U _RTHooks__PushEFrame
                 U _RTHooks__ReportFault
                 U _RTHooks__TextLitGetChar
                 U _RTHooks__TextLitGetChars
                 U _RTHooks__TextLitGetWideChar
                 U _RTHooks__TextLitGetWideChars
                 U _RTHooks__TextLitInfo
                 U _SchedulerIndirection_I3
                 U _SchedulerIndirection__DisableSwitching
                 U _SchedulerIndirection__EnableSwitching
                 U _TZ_I3
0000000000000460 T _TZ_M3
0000000000000340 t _TZ_M3_LINE_170.1170
0000000000000000 t _TZ_M3_LINE_178.1172
0000000000000010 t _TZ_M3_LINE_206.1174
0000000000000020 t _TZ_M3_LINE_82.1168
0000000000000530 t _TZ_M3_t099ad545_INIT
0000000000000450 T _TZ__DisableChecking
0000000000000050 T _TZ__Equal
0000000000000360 t _TZ__GetOldTZ
0000000000000160 T _TZ__Hash
00000000000001a0 t _TZ__Init
0000000000000730 t _TZ__Localtime
0000000000000550 t _TZ__Mktime
0000000000000170 t _TZ__Name
00000000000002b0 t _TZ__SetCurTZ
                 U _Text_I3
                 U _Text__Equal
                 U _Text__GetChar
                 U _Text__Hash
                 U _Text__Sub
                 U _Thread_I3
                 U _Thread__Acquire
                 U _Thread__Release
                 U _UtimeOpsC_I3
                 U _UtimeOpsC__Get_day
                 U _UtimeOpsC__Get_gmtoff
                 U _UtimeOpsC__Get_hour
                 U _UtimeOpsC__Get_minute
                 U _UtimeOpsC__Get_month
                 U _UtimeOpsC__Get_second
                 U _UtimeOpsC__Get_wday
                 U _UtimeOpsC__Get_year
                 U _UtimeOpsC__Get_zone
                 U _UtimeOpsC__Set_day
                 U _UtimeOpsC__Set_hour
                 U _UtimeOpsC__Set_minute
                 U _UtimeOpsC__Set_month
                 U _UtimeOpsC__Set_second
                 U _UtimeOpsC__Set_year
                 U _UtimeOpsC__localtime_r
                 U _UtimeOpsC__mktime
                 U _UtimeWrap_I3
                 U _UtimeWrap__delete_T
                 U _UtimeWrap__make_T
                 U _Word_I3
                 U _XTime_I3
                 U _XTime__Now
0000000000000540 t __m3_fault
                 U _getenv

from cm3.

brakmic avatar brakmic commented on September 14, 2024

Now got this error. Not sure if I am doing something wrong.

gnoring ../m3-tools/m3totex/src/m3overrides (not a directory)
ignoring ../m3-tools/m3totex/src/Example.tex (not a directory)
ignoring ../m3-tools/m3totex/src/COPYRIGHT (not a directory)
ignoring ../m3-tools/m3totex/src/m3totex.1 (not a directory)
EVAL ("m3make.args")
rm .M3SHIP
rm .M3OVERRIDES

Fatal Error: duplicate unit: ../m3-games/fours/src/Main.m3 ../m3-games/tetris/src/Main.m3


 seconds  #times  operation
    1.08      74  garbage collection
    3.70          other
---------------------------------------------------
    4.78          TOTAL

cd ..

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

brakmic avatar brakmic commented on September 14, 2024

Ok, I understand. Will now search for CTZ<anything>.o file.

no, you have to run cm3 where there is ONE thing you are building. cm3 contains dozens if not hundreds of things to build. cit_util is one library, so you can run cm3 there. You can't run it higher up in the directory tree.

On Fri, Mar 15, 2019 at 9:53 AM Harris Brakmić @.***> wrote: Now got this error. Not sure if I am doing something wrong. gnoring ../m3-tools/m3totex/src/m3overrides (not a directory) ignoring ../m3-tools/m3totex/src/Example.tex (not a directory) ignoring ../m3-tools/m3totex/src/COPYRIGHT (not a directory) ignoring ../m3-tools/m3totex/src/m3totex.1 (not a directory) EVAL ("m3make.args") rm .M3SHIP rm .M3OVERRIDES Fatal Error: duplicate unit: ../m3-games/fours/src/Main.m3 ../m3-games/tetris/src/Main.m3 seconds #times operation 1.08 74 garbage collection 3.70 other --------------------------------------------------- 4.78 TOTAL cd .. — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#46 (comment)>, or mute the thread https://github.com/notifications/unsubscribe-auth/AFWGpQi1J47dW6vLCMe8-ipZ9ykO-Q2jks5vW22EgaJpZM4b1aCr .

from cm3.

brakmic avatar brakmic commented on September 14, 2024

Here are two of them:

CTZ_i.oand CTZ.o

I assume object files for implementations and interfaces?

Here the results of nm for each one:

$ nm CTZ.o
0000000000000070 T __Z10CTZ__setTZPKc
0000000000000000 T __Z31CTZ__setenv_TZ_America_New_Yorkv
                 U ___assert_rtn
                 U _setenv
                 U _tzset
$ nm CTZ_i.o
00000000000000f0 s EH_frame1
0000000000000000 T _CTZ_I3
                 U _Ctypes_I3
00000000000000c0 s _L_1
0000000000000020 d _MI_CTZ
                 U _RTHooks_I3

from cm3.

brakmic avatar brakmic commented on September 14, 2024

One speculation:

As Apple is no longer supporting x86 architecture, and I have the latest XCode + toolchain installed, maybe it's because your C compiler only generates x86 binaries?

from cm3.

brakmic avatar brakmic commented on September 14, 2024

However, both of the object files are for x64, so my assumption is wrong.

CTZ_i.o: Mach-O 64-bit object x86_64

from cm3.

brakmic avatar brakmic commented on September 14, 2024

After having removed the caltech_ files as you recommended I was able to successfully compile the distribution. Many thanks for your help! 👍

cm3 --version
Critical Mass Modula-3 version d5.10.0
  last updated: 2016-10-05
  compiled: 2019-03-15 11:40:07
  configuration: /usr/local/cm3/bin/cm3.cfg
  host: AMD64_DARWIN
  target: AMD64_DARWIN

Here's the patch file and tarballs for other macOS x64 users to save their time. :)

Downloads are located on my server. Fingerprints and malware reports are from virustotal.com.

EDIT: scroll down for updated links!

Best regards,

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

brakmic avatar brakmic commented on September 14, 2024

The compilation is being done with g++ but there is actually no g++ under macOS. It's always clang even if you type g++ or gcc, because Apple wants it so.

This is the compilation call in cit_util.

g++ -g -fPIC -Wall -Werror -Wno-return-type -Wno-missing-braces -m64 -arch x86_64 -dynamiclib -multiply_defined error -twolevel_namespace -compatibility_version 5 -current_version 5.2 -install_name @executable_path/../lib/libcit_util.5.dylib -headerpad_max_install_names -o libcit_util.5.2.dylib -dead_strip DblRefany_i.o Debug_i.o Debug_m.o DebugStream_i.o DebugStreamList_i.o DebugStreamList_m.o DebugClass_i.o DebugClass_m.o DebugFmtPointer_m.o BreakHere_i.o BreakHere_m.o TextUtils_i.o TextUtils_m.o WordUtils_i.o WordUtils_m.o TextUtilsFmt_m.o PrefixDB_i.o PrefixDB_m.o TextLongRealTbl_i.o TextLongRealTbl_m.o 

LongrealList_i.o LongrealList_m.o LongrealPQ_i.o LongrealPQRep_i.o LongrealPQ_m.o ScanList_i.o ScanList_m.o LockedTextRefTbl_i.o LockedTextRefTbl_m.o LockedTextSetDef_i.o LockedTextSetDef_m.o LockedTextBooleanTbl_i.o LockedTextBooleanTbl_m.o RTBrand_i.o RefRecord_i.o SchedulerIndirection_i.o RTBrandCM3_m.o RefRecordCM3_m.o SchedulerIndirectionCM3_m.o printf.o Cprintf_i.o RTRefStats_i.o RTRefStats_m.o RTName_i.o RTName_m.o SIsuffix_i.o SIsuffix_m.o SuffixTbl_i.o SuffixTbl_m.o IntPair_i.o IntPair_m.o RefPair_i.o RefPair_m.o TextCardPair_i.o TextCardPair_m.o TextIntPair_i.o TextIntPair_m.o TextIntPairRefTbl_i.o TextIntPairRefTbl_m.o RefPairSeq_i.o RefPairSeqRep_i.o RefPairSeq_m.o IntPairSeq_i.o IntPairSeqRep_i.o IntPairSeq_m.o IntPairList_i.o IntPairList_m.o IntTriple_i.o Int_IntTripleTbl_i.o Int_IntTripleTbl_m.o CardPair_i.o CardPair_m.o CardPairSet_i.o CardPairSet_m.o CardPairSetDef_i.o CardPairSetDef_m.o CardPairRefTbl_i.o CardPairRefTbl_m.o CardCardTbl_i.o CardCardTbl_m.o CardPairList_i.o CardPairList_m.o TextPair_i.o TextPair_m.o LongRealPair_i.o LongRealPair_m.o 

TextPairList_i.o TextPairList_m.o CardList_i.o CardList_m.o CardSet_i.o CardSet_m.o CardSetDef_i.o CardSetDef_m.o CardSetArray_i.o CardSetArray_m.o CardRefTbl_i.o CardRefTbl_m.o LongrealSet_i.o LongrealSet_m.o LongrealSetDef_i.o LongrealSetDef_m.o IntArrayRef_i.o IntArrayRef_m.o ToRefany_i.o ToRefany_m.o ToRefanyClass_i.o ToRefanyTbl_i.o ToRefanyTbl_m.o IntRef_i.o IntRef_m.o IntRefToRefany_i.o IntRefToRefany_m.o BoolRef_i.o BoolRef_m.o BoolRefToRefany_i.o BoolRefToRefany_m.o CharRef_i.o CharRef_m.o CharRefToRefany_i.o CharRefToRefany_m.o 

RealRef_i.o RealRef_m.o RealRefToRefany_i.o RealRefToRefany_m.o IntPairSet_i.o IntPairSet_m.o IntPairSetDef_i.o IntPairSetDef_m.o IntPairRefTbl_i.o IntPairRefTbl_m.o TextSubs_i.o TextSubs_m.o TextTextListTbl_i.o TextTextListTbl_m.o TextEquivalence_i.o TextEquivalence_m.o TextTextTblExtras_i.o TextTextTblExtras_m.o TextTextListTblExtras_i.o TextTextListTblExtras_m.o FewerDotsTextPref_i.o FewerDotsTextPref_m.o TextBooleanTbl_i.o TextBooleanTbl_m.o MapError_i.o LRVector_i.o LRVector_m.o LRPoint_i.o LRPt_i.o LRPt_m.o LRInterval_i.o LRInterval_m.o LongRealRef_i.o LongRealRef_m.o LongRealRefList_i.o LongRealRefList_m.o TextLongRealRefTbl_i.o TextLongRealRefTbl_m.o Threadd_i.o ThreadSeq_i.o ThreadSeqRep_i.o ThreadSeq_m.o MyLongrealType_i.o MyLongrealType_m.o LRFunction_i.o LRFunction_m.o LRScalarField_i.o LRScalarField_m.o LRVectorField_i.o LRVectorField_m.o LRParametricCurve_i.o 

LRParametricCurve_m.o Pointe_i.o Pointe_m.o BoolF_i.o TextFF_i.o TextFF_m.o TextListF_i.o TextListF_m.o BrandedRd_i.o RdList_i.o RdList_m.o CharF_i.o RefanyF_i.o RefanyF_m.o CharList_i.o CharList_m.o BoolList_i.o BoolList_m.o Cardinal_i.o Cardinal_m.o CardSeq_i.o CardSeqRep_i.o CardSeq_m.o CharSeq_i.o CharSeqRep_i.o CharSeq_m.o IntForRat_i.o IntForRat_m.o BigInt_i.o BigInt_m.o IntRational_i.o IntRational_m.o BigRational_i.o BigRational_m.o TextBigIntTbl_i.o TextBigIntTbl_m.o LilIntOps_i.o LilIntOps_m.o BigIntOps_i.o BigIntOps_m.o UnsafeMutex_i.o UnsafeMutex_m.o CatRd_i.o CatRd_m.o FileReWr_i.o FileReWr_m.o ObjectFactory_i.o ObjectFactory_m.o ObjectFactoryClass_i.o IntArrayHash_i.o IntArrayHash_m.o CITRandom_i.o CITRandom_m.o ProcUtils_i.o ProcUtils_m.o RemoteFileRd_i.o RemoteFileRd_m.o PathnameUtils_i.o PathnameUtils_m.o Config_i.o Config_m.o FlagList_i.o FlagList_m.o UnixUtils_i.o UnixUtils_m.o Stuff_i.o Stuff_m.o StuffSet_i.o StuffSet_m.o StuffSetDef_i.o StuffSetDef_m.o StuffRefTbl_i.o StuffRefTbl_m.o FmtScanVar_i.o FmtScanVar_m.o PMPTimer_i.o PMPTimer_m.o PointList_i.o 

PointList_m.o IntIntCache_i.o IntIntCache_m.o IDGen_i.o IDGen_m.o IDTextTbl_i.o IDTextTbl_m.o IDTextQueueTbl_i.o IDTextQueueTbl_m.o KeyObject_i.o KeyObject_m.o KeyObjectRefTbl_i.o KeyObjectRefTbl_m.o TextSetUtils_i.o TextSetUtils_m.o TextTextListMultiTblListMultiTbl_i.o TextTextListMultiTblListMultiTbl_m.o BrandedWr_i.o UnixFilter_i.o UnixFilter_m.o SlowTextCompress_i.o SlowTextCompress_m.o TextFifo_i.o TextFifo_m.o RefFifo_i.o RefFifo_m.o CharFifo_i.o CharFifo_m.o IntFifo_i.o IntFifo_m.o LongRealFifo_i.o LongRealFifo_m.o LongrealArraySort_i.o LongrealArraySort_m.o RefanyArraySort_i.o RefanyArraySort_m.o CardArraySort_i.o CardArraySort_m.o LongRealSeq_i.o LongRealSeqRep_i.o LongRealSeq_m.o LongrealSort_i.o LongrealSort_m.o Chmod_i.o Chmod_m.o LongRealSharedSeq_i.o LongRealSharedSeq_m.o LRArrayOps_i.o LRArrayOps_m.o PersistentIntRefTbl_i.o PersistentIntRefTbl_m.o FileSharing_i.o FileSharingPOSIX_m.o SysPerf_m.o c_SysPerf_i.o getloadavg_glue.o diskAvail.o SysPerf_i.o FileUtils_i.o FileUtils_m.o IntInt_i.o IntInt_m.o IntIntArraySort_i.o IntIntArraySort_m.o AL_i.o AL_m.o LineMatcher_i.o LineMatcher_m.o StepFunction_i.o StepFunction_m.o TCPMaker_i.o TCPMaker_m.o LimitFmt_i.o LimitFmt_m.o FancyFmt_i.o FancyFmt_m.o AttrWr_i.o AttrWr_m.o AttrWrSeq_i.o AttrWrSeqRep_i.o AttrWrSeq_m.o UCTime_i.o UCTime_m.o IntSetBits_i.o IntSetBits_m.o Hashable_i.o Hashable_m.o HashRefTbl_i.o 

HashRefTbl_m.o HashTextTbl_i.o HashTextTbl_m.o HashIntTbl_i.o HashIntTbl_m.o HashSet_i.o HashSet_m.o HashSetDef_i.o HashSetDef_m.o CTZ_i.o CTZ.o TZ_i.o TZ_m.o SafeTZ_m.o FinDate_i.o FinDate_m.o HMTime_i.o HMTime_m.o HMTimeToday_m.o IntFinDateTbl_i.o IntFinDateTbl_m.o FinDateArraySort_i.o FinDateArraySort_m.o AscTimeParse_i.o AscTimeParse_m.o TZRefTbl_i.o TZRefTbl_m.o LongrealRefTbl_i.o LongrealRefTbl_m.o SortedLongrealRefTbl_i.o SortedLongrealRefTbl_m.o SloppyTimeConverter_i.o SloppyTimeConverter_m.o XTime_i.o XTime_m.o LRElem_i.o LRElem_m.o LRElemArraySort_i.o LRElemArraySort_m.o UtimeOpsC_i.o UtimeOpsC_m.o UtimeWrap_i.o UtimeWrap_m.o UtimeOpsC.o FastNumParse_i.o FastNumParse_m.o -L/usr/local/cm3/pkg/patternmatching/AMD64_DARWIN -lpatternmatching -L/usr/local/cm3/pkg/libbuf/AMD64_DARWIN -llibbuf -L/usr/local/cm3/pkg/rdwr/AMD64_DARWIN -lrdwr -L/usr/local/cm3/pkg/set/AMD64_DARWIN -lset -L/usr/local/cm3/pkg/cit_common/AMD64_DARWIN -lcit_common -L/usr/local/cm3/pkg/netobj/AMD64_DARWIN -lm3netobj -L/usr/local/cm3/pkg/tcp/AMD64_DARWIN -lm3tcp -L/usr/local/cm3/pkg/libm3/AMD64_DARWIN -lm3 -L/usr/local/cm3/pkg/m3core/AMD64_DARWIN -lm3core -lSystem
Undefined symbols for architecture x86_64:

My clang is:

clang version 7.0.1 (tags/RELEASE_701/final)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /usr/local/opt/llvm/bin

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

brakmic avatar brakmic commented on September 14, 2024

If I only knew where I could find compiler commands there? If it's in the same output then I can search for it, no problem.
Regarding clang, well, I assume that the compiler flags are the same, but what I have experienced so far in other projects is that the subsequent linking sometimes fails when certain flags are present. Like those I mentioned before: -dn and -dy
I don't mean that these must have been the reason for this problem, just that I once had to deal with those macOS-extras.

from cm3.

brakmic avatar brakmic commented on September 14, 2024

Thanks!
Here the grep output for CTZ:

g++ -g -fPIC -Wall -Werror -Wno-return-type -Wno-missing-braces -m64 -arch x86_64 -x c++ -funwind-tables -I/usr/local/cm3/pkg/m3core/src/unix/Common -I/usr/local/cm3/pkg/m3core/src -I/usr/local/cm3/pkg/m3core/src/Csupport/Common -I/usr/local/cm3/pkg/m3core/src/Csupport/little-endian -I/usr/local/cm3/pkg/m3core/src/Csupport/libgcc -I/usr/local/cm3/pkg/m3core/src/runtime/common -I/usr/local/cm3/pkg/m3core/src/runtime/POSIX -I/usr/local/cm3/pkg/m3core/src/runtime/ex_frame -I/usr/local/cm3/pkg/m3core/src/thread/Common -I/usr/local/cm3/pkg/m3core/src/thread/PTHREAD -I/usr/local/cm3/pkg/m3core/src/C/Common -I/usr/local/cm3/pkg/m3core/src/float/C99 -I/usr/local/cm3/pkg/m3core/src/time/POSIX -I/usr/local/cm3/pkg/libm3/src/os/POSIX -I/usr/local/cm3/pkg/libm3/src/uid/POSIX -I/usr/local/cm3/pkg/tcp/src/POSIX -I/usr/local/cm3/pkg/patternmatching/src/libglob -I../src -g -c ../src/CTZ.c -o CTZ.o

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

brakmic avatar brakmic commented on September 14, 2024

Have tried it, but same error:

      _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)
rm libcit_util.a
  make_lib => 1
  make_lib => 1
librarian failed building: cit_util
Fatal Error: package build failed

from cm3.

brakmic avatar brakmic commented on September 14, 2024

But I think this has to do with the fact that macOS always uses clang even if one types gcc. One must separately install GCC.

Will try it now and report the results.

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

brakmic avatar brakmic commented on September 14, 2024

I've only tried it with GCC no G++.
Have also tried it with explicitly installed GCC-7, but still the same error.

from cm3.

brakmic avatar brakmic commented on September 14, 2024

This was the last call I made:

gcc-7 -g -fPIC -Wall -Werror -Wno-return-type -Wno-missing-braces -m64 -arch x86_64 -x c++ -funwind-tables -I/usr/local/cm3/pkg/m3core/src/unix/Common -I/usr/local/cm3/pkg/m3core/src -I/usr/local/cm3/pkg/m3core/src/Csupport/Common -I/usr/local/cm3/pkg/m3core/src/Csupport/little-endian -I/usr/local/cm3/pkg/m3core/src/Csupport/libgcc -I/usr/local/cm3/pkg/m3core/src/runtime/common -I/usr/local/cm3/pkg/m3core/src/runtime/POSIX -I/usr/local/cm3/pkg/m3core/src/runtime/ex_frame -I/usr/local/cm3/pkg/m3core/src/thread/Common -I/usr/local/cm3/pkg/m3core/src/thread/PTHREAD -I/usr/local/cm3/pkg/m3core/src/C/Common -I/usr/local/cm3/pkg/m3core/src/float/C99 -I/usr/local/cm3/pkg/m3core/src/time/POSIX -I/usr/local/cm3/pkg/libm3/src/os/POSIX -I/usr/local/cm3/pkg/libm3/src/uid/POSIX -I/usr/local/cm3/pkg/tcp/src/POSIX -I/usr/local/cm3/pkg/patternmatching/src/libglob -I../src -g -c ../src/CTZ.c -o CTZ.o

from cm3.

brakmic avatar brakmic commented on September 14, 2024

Btw. I just saw this flag here (in the above line): -x c++
Not sure what its meaning is.

from cm3.

brakmic avatar brakmic commented on September 14, 2024

The compilation with G++7 fails the same way.

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

brakmic avatar brakmic commented on September 14, 2024

OK, I will try to find a way. So far no compiler was able to generate the binaries. Must be some flag/option that allows name mangling.

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

brakmic avatar brakmic commented on September 14, 2024

I will try them all. Many thanks! 👍

from cm3.

brakmic avatar brakmic commented on September 14, 2024

So far it seems that we have to do with "C name mangling" and "C++ name mangling".

When I add extern "C" to prevent C++ name mangling we then get:

0000000000000054 T _CTZ__setTZ
0000000000000000 T _CTZ__setenv_TZ_America_New_York

This is what I added to CTZ.c to deactivate C++ name mangling:

extern "C" {
	void CTZ__setenv_TZ_America_New_York(void);
	void CTZ__setTZ(const char *tzname);
}

Without extern C the exported functions would look like this:

0000000000000054 T __Z10CTZ__setTZPKc
0000000000000000 T __Z31CTZ__setenv_TZ_America_New_Yorkv

So I've tried to make it compile by changing CTZ.i3 to accept C-mangled functions by adding the underscore:

<*EXTERNAL _CTZ__setTZ *>
PROCEDURE setTZ(name : const_char_star);

<*OBSOLETE*>
<*EXTERNAL _CTZ__setenv_TZ_America_New_York *>
PROCEDURE setenv_TZ_America_New_York();

...sadly, it throws yet another error:

checking UtimeOpsC.c
checking libcit_util.a

****  PARALLEL BACK-END BUILD, M3_PARALLEL_BACK = 20
rm libcit_util.5.dylib
ln -s libcit_util.5.2.dylib libcit_util.5.dylib
rm libcit_util.dylib
ln -s libcit_util.5.dylib libcit_util.dylib
  skip_lib => 0

compilation failed => not building library "libcit_util.a"
Fatal Error: package build failed

 seconds  #times  operation
    0.04      10  inhaling library link info
    0.18       1  getting derived timestamps
    0.01     378  checking old link info
    0.01     363  merging new link info
    0.03       2  compiling Modula-3 -> IL
    0.05       3  garbage collection
---------------------------------------------------
    0.35          TOTAL

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

brakmic avatar brakmic commented on September 14, 2024

When I compile it with GCC I get the same C-mangled functions.

0000000000000054 T _CTZ__setTZ
0000000000000000 T _CTZ__setenv_TZ_America_New_York

I think I should simply try to compile everything again, but with prepended underscores and "extern C". Just to see if it works.

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

brakmic avatar brakmic commented on September 14, 2024

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).

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

brakmic avatar brakmic commented on September 14, 2024

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.

from cm3.

brakmic avatar brakmic commented on September 14, 2024

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

voronoi caltech-other

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

brakmic avatar brakmic commented on September 14, 2024

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

from cm3.

brakmic avatar brakmic commented on September 14, 2024

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?

from cm3.

brakmic avatar brakmic commented on September 14, 2024

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.

from cm3.

brakmic avatar brakmic commented on September 14, 2024

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 ***

from cm3.

brakmic avatar brakmic commented on September 14, 2024

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.

from cm3.

brakmic avatar brakmic commented on September 14, 2024

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

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

brakmic avatar brakmic commented on September 14, 2024

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?

from cm3.

brakmic avatar brakmic commented on September 14, 2024

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

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

brakmic avatar brakmic commented on September 14, 2024

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

from cm3.

mikanystrom avatar mikanystrom commented on September 14, 2024

from cm3.

brakmic avatar brakmic commented on September 14, 2024

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!

from cm3.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.