Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails on macOS 10.14 (Mojave) #92

Open
pozix604 opened this issue Feb 6, 2019 · 3 comments
Open

Build fails on macOS 10.14 (Mojave) #92

pozix604 opened this issue Feb 6, 2019 · 3 comments
Assignees

Comments

@pozix604
Copy link

pozix604 commented Feb 6, 2019

The build of Critcl using the standard instructions fails on macOS 10.14. It turns out the reason is that the detection of the SDK path does not work on new versions of macOS and Xcode. Defining the SDKROOT environment variable fixes the problem but the code should be fixed to automatically detect the SDK path.

Here is the failure:

andreas-kupries-critcl-0841990 $ /usr/local/opt/tcl-tk/bin/tclsh `pwd`/build.tcl install
Installing into:
	Packages:	/usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6
	Application:	/usr/local/Cellar/tcl-tk/8.6.9/bin

Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-app3.1.17
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl3.1.17
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-bitmap1.0.1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-class1.0.7
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-cutil0.1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-emap1.1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-enum1.0.1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-iassoc1.0.2
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-literals1.2
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-platform1.0.15
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-util1.1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/dict841
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/lassign841.0.1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/lmap841
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/stubs_container1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/stubs_gen_decl1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/stubs_gen_header1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/stubs_gen_init1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/stubs_gen_lib1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/stubs_gen_macro1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/stubs_gen_slot1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/stubs_genframe1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/stubs_reader1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/stubs_writer1
Installed application:  /usr/local/Cellar/tcl-tk/8.6.9/bin/critcl
expected version number but got ""
    while executing
"package vcompare $ver 10.4"
    ("foreach" body line 3)
    invoked from within
"foreach dir [glob -nocomplain -tails  -directory $base/SDKs MacOSX*] {
            set ver [string trimright  [file rootname [string range $dir $pos e..."
    invoked from within
"if {[string match macosx-* $platform]} {
    if {[info exists ::env(SDKROOT)] && $::env(SDKROOT) ne ""} {
        set SDKROOT $::env(SDKROOT)
    } el..."
    invoked from within
"interp eval $run $line"
    (procedure "readconfig" line 84)
    invoked from within
"readconfig [file join $mydir Config]"
    (procedure "::critcl::Initialize" line 39)
    invoked from within
"::critcl::Initialize"
    (file "/usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl3.1.17/critcl.tcl" line 5924)
    invoked from within
"source /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl3.1.17/critcl.tcl"
    ("package ifneeded critcl 3.1.17" script)
    invoked from within
"package require critcl"
    (file "/usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-app3.1.17/critcl.tcl" line 22)
    invoked from within
"source /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-app3.1.17/critcl.tcl"
    ("package ifneeded critcl::app 3.1.17" script)
    invoked from within
"package require critcl::app"
    (file "/usr/local/Cellar/tcl-tk/8.6.9/bin/critcl" line 9)
child process exited abnormally
    while executing
"exec >@ stdout 2>@ stderr /usr/local/Cellar/tcl-tk/8.6.9/bin/critcl -libdir /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/tmp -pkg /Users/first/Downloads/..."
    ("eval" body line 1)
    invoked from within
"eval $cmd"
    invoked from within
"_install"
    ("eval" body line 1)
    invoked from within
"eval _$argv"

Here is the new way to identify the SDK path:

$ xcrun --sdk macosx --show-sdk-path
/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk

And here it is working after defining the SDKROOT variable. Ideally, the build script would automatically run the above command, get the right path and build correctly.

andreas-kupries-critcl-0841990 $ export SDKROOT=/Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk
andreas-kupries-critcl-0841990 $ /usr/local/opt/tcl-tk/bin/tclsh `pwd`/build.tcl install
Installing into:
	Packages:	/usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6
	Application:	/usr/local/Cellar/tcl-tk/8.6.9/bin

Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-app3.1.17
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl3.1.17
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-bitmap1.0.1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-class1.0.7
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-cutil0.1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-emap1.1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-enum1.0.1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-iassoc1.0.2
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-literals1.2
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-platform1.0.15
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl-util1.1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/dict841
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/lassign841.0.1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/lmap841
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/stubs_container1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/stubs_gen_decl1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/stubs_gen_header1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/stubs_gen_init1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/stubs_gen_lib1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/stubs_gen_macro1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/stubs_gen_slot1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/stubs_genframe1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/stubs_reader1
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/stubs_writer1
Installed application:  /usr/local/Cellar/tcl-tk/8.6.9/bin/critcl
Config:   macosx-x86_64
Build:    macosx-x86_64-gcc
Target:   macosx-x86_64
Source:   md5c.tcl  (provide critcl_md5c 0.12)
Library:  md5c.dylib
 (tclStubsPtr     =>  TclStubs *tclStubsPtr;)
 (tclPlatStubsPtr =>  TclPlatStubs *tclPlatStubsPtr;)
Package:  /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/tmp/md5c
Installed package:      /usr/local/Cellar/tcl-tk/8.6.9/lib/tcl8.6/critcl_md5c0.12
@pozix604 pozix604 changed the title Build fails on macOS 10.4 Build fails on macOS 10.14 Feb 7, 2019
@pozix604 pozix604 changed the title Build fails on macOS 10.14 Build fails on macOS 10.14 (Mojave) Feb 7, 2019
@andreas-kupries
Copy link
Owner

andreas-kupries commented Jan 8, 2020

Does the xcrun --sdk macosx --show-sdk-path work before Mojave as well ?
If yes, how far back ?
Would it make sense to simply try it when SDKROOT is missing ?

@andreas-kupries andreas-kupries self-assigned this Jan 8, 2020
@andreas-kupries
Copy link
Owner

andreas-kupries commented Jan 10, 2020

Some more information. Your error stack contains

expected version number but got ""
    while executing
"package vcompare $ver 10.4"

indicated that the variable ver contains the empty string.

The code I am looking at however (https://github.com/andreas-kupries/critcl/blob/master/lib/critcl/Config#L97) checks for the empty string and prevent the vcompare from being run in that case.

Ah! That was issue #84, and the change is not in a release yet. What happens on your system when you put that change in ?

Right now I suspect that while the stack trace goes away SDKROOT still has to be set manually to make it work. Not sure, I do not have a Mojave system to test with.

@juster
Copy link

juster commented Aug 25, 2024

I did not have this issue with Mac OS 14.6 but I have been tinkering with the Config in order to use Apple Silicon (arm64) compilation.

Does the xcrun --sdk macosx --show-sdk-path work before Mojave as well ?
If yes, how far back ?

This Technical Note (TN2339) from Apple says that xcrun has been available since 10.9:

https://developer.apple.com/library/archive/technotes/tn2339/_index.html

The 10.9 release was codenamed Mavericks and released in 2013.

Would it make sense to simply try it when SDKROOT is missing ?

Yes it looks that way.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants