tkdnd icon indicating copy to clipboard operation
tkdnd copied to clipboard

Not compilining on arm64 (macOS M1)

Open fantinuoli opened this issue 3 years ago • 71 comments

TKDND can not be compiled on macOS ARM (M1), I get the following error:

ld: symbol(s) not found for architecture arm64 clang: error: linker command failed with exit code 1 (use -v to see invocation) make: *** [libtkdnd2.9.3.dylib] Error 1

fantinuoli avatar Jul 19 '21 12:07 fantinuoli

Can you provide more information? Like the full build log?

petasis avatar Jul 19 '21 13:07 petasis

This is the output of tclsh tcl-conf

TkDND sources: /Users/fc/Downloads/tkdnd-master
Tcllib's package "fileutil" found!

Found "tclConfig.sh" in "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current".
Found "tcl.h" in "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current/Headers".
Found "tk.h"  in "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tk.framework/Versions/Current/Headers".

+++ Running 'bash configure -srcdir=/Users/fc/Downloads/tkdnd-master
                  --prefix=/Users/fc/Downloads/tkdnd-master/cmake/runtime
                  --exec-prefix=/Users/fc/Downloads/tkdnd-master/cmake/runtime
                  --with-tcl=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current
                  --with-tk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tk.framework/Versions/Current
                  --with-tclinclude=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current/Headers
                  --with-tkinclude=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tk.framework/Versions/Current/Headers
                  PKG_INCLUDES=-I"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tk.framework/Versions/Current/Headers/tk-private"
                  --disable-64bit'
             in directory /Users/fc/Downloads/tkdnd-master...
checking TEA configuration... ok (TEA 3.13)
configure: configuring tkdnd 2.9.3
checking system version... Darwin-20.5.0
checking for Tcl configuration... found /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current/tclConfig.sh
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables... 
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for existence of /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current/tclConfig.sh... loading
checking platform... unix
checking for Tk configuration... found /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tk.framework/Versions/Current/tkConfig.sh
checking for existence of /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tk.framework/Versions/Current/tkConfig.sh... loading
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking how to run the C preprocessor... gcc -E
checking whether make sets $(MAKE)... yes
checking for ranlib... ranlib
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking if the compiler understands -pipe... yes
checking whether byte ordering is bigendian... no
checking for Tcl public headers... /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current/Headers
checking for Tk public headers... /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tk.framework/Versions/Current/Headers
checking for X11 header files... /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tk.framework/Versions/Current/Headers
checking for Tk private include files... Using -I"/Library/Caches/com.apple.xbs/Sources/tcl/tcl-129.100.1/tk/tk/generic" -I"/Library/Caches/com.apple.xbs/Sources/tcl/tcl-129.100.1/tk/tk/unix" -I""/Library/Caches/com.apple.xbs/Sources/tcl/tcl-129.100.1/tk/tk/xlib"" -I"/Library/Caches/com.apple.xbs/Sources/tcl/tcl-129.100.1/tk/tk/macosx" -iwithsysroot /System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -iwithsysroot /System/Library/Frameworks/Tk.framework/Versions/8.5/PrivateHeaders
checking for pthread_mutex_init in -lpthread... yes
checking for building with threads... yes (default)
checking how to build libraries... shared
checking for ranlib... (cached) ranlib
checking if 64bit support is requested... no
checking if 64bit Sparc VIS support is requested... no
checking if compiler supports visibility "hidden"... yes
checking if rpath support is requested... yes
checking system version... (cached) Darwin-20.5.0
checking for ar... ar
checking if ld accepts -single_module flag... yes
checking if ld accepts -search_paths_first flag... yes
checking for cast to union support... yes
checking for required early compiler flags... none
checking for 64-bit integer type... using long
checking for build with symbols... no
checking for tclsh... /usr/bin/tclsh8.5
checking for wish... /usr/bin/wish8.5
checking for intptr_t... no
checking for pointer-size signed integer type... none
checking for uintptr_t... no
checking for pointer-size unsigned integer type... none
configure: creating ./config.status
config.status: creating Makefile
config.status: creating pkgIndex.tcl

Output of make install in file, since too long. makeoutput.txt

fantinuoli avatar Jul 20 '21 18:07 fantinuoli

What I understood from the logs, is that the libs you are building tkdnd to, are not the correct ones.

The real problem is in these two lines:

gcc -dynamiclib -pipe  -Os -DNDEBUG -Wall -fno-common -I/usr/local/opt/[email protected]/include  -L/usr/local/opt/[email protected]/lib -prebind -headerpad_max_install_names -Wl,-search_paths_first  -Wl,-single_module -current_version 2.9.3 -compatibility_version 2.9.3 -o libtkdnd2.9.3.dylib TkDND_Cursors.o macdnd.o -framework Cocoa -framework Carbon  -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current -ltclstub8.5 -L/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tk.framework/Versions/Current -ltkstub8.5 
ld: warning: directory not found for option '-L/usr/local/opt/[email protected]/lib'
ld: warning: option -prebind is obsolete and being ignored
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tk.framework/Versions/Current/libtkstub8.5.a, file is universal (2 slices) but does not contain the arm64 architecture: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tk.framework/Versions/Current/libtkstub8.5.a
ld: warning: ignoring file /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current/libtclstub8.5.a, file is universal (2 slices) but does not contain the arm64 architecture: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current/libtclstub8.5.a

It seems that the tcl/tk stubs libraries installed in your system, are not compatible for the ARM architecture.

Either there is an error in the build tools (not for your laptop?), or you need to download and build Tcl/Tk from another source (homebrew ?) and try to link with that libraries instead of the ones inside xcode.

petasis avatar Sep 01 '21 21:09 petasis

same issue here, I was successful compiling on M1 Max once, but meet same issue afterwards, need help please

ghost avatar Oct 06 '22 15:10 ghost

What is the error you are getting?

petasis avatar Oct 09 '22 06:10 petasis

if use following

tclsh tclconf
make install

it gives error

ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libtkdnd2.9.3.dylib] Error 1

if use Cmake method

it give error

[ 33%] Building C object CMakeFiles/tkdnd2.9.3.dir/generic/TkDND_Cursors.c.o
clang: error: unknown argument: '-fobjc-gc'
make[2]: *** [CMakeFiles/tkdnd2.9.3.dir/generic/TkDND_Cursors.c.o] Error 1
make[1]: *** [CMakeFiles/tkdnd2.9.3.dir/all] Error 2
make: *** [all] Error 2

if use Github Action workflow and use Cmake method, it gives the same error, so i guess it is not issue about arch.

ghost avatar Oct 09 '22 06:10 ghost

In the CMake case, if you comment line 90 of CMakelists.txt (in the main folder of tkdnd), does it compile?

petasis avatar Oct 09 '22 06:10 petasis

progress come up to 66% and gives new error

15 warnings generated.
[ 66%] Building C object CMakeFiles/tkdnd2.9.3.dir/macosx/macdnd.m.o
/Users/chenzhiyu/Downloads/tkdnd-master/macosx/macdnd.m:22:9: fatal error: 'tkInt.h' file not found
#import <tkInt.h>
        ^~~~~~~~~
1 error generated.
make[2]: *** [CMakeFiles/tkdnd2.9.3.dir/macosx/macdnd.m.o] Error 1
make[1]: *** [CMakeFiles/tkdnd2.9.3.dir/all] Error 2
make: *** [all] Error 2

ghost avatar Oct 09 '22 06:10 ghost

Is anywhere in your system this file? This file and tkMacOSXInt.h should come with tcl/tk. Maybe you need to install some kind of "dev" package?

petasis avatar Oct 09 '22 06:10 petasis

I install tck-tk from homebrew and export lib into PATH, I made compile suceessful once, dont know whats going wrong

ghost avatar Oct 09 '22 06:10 ghost

In which folder is you tcl-tk installed? What are the contents of the include directory in there?

petasis avatar Oct 09 '22 06:10 petasis

export PATH="/opt/homebrew/opt/tcl-tk/bin:$PATH"

❯ tree /opt/homebrew/opt/tcl-tk/bin
/opt/homebrew/opt/tcl-tk/bin
├── critcl
├── dtplite
├── nns
├── nnsd
├── nnslog
├── page
├── pt
├── tcldocstrip
├── tclsh -> tclsh8.6
├── tclsh8.6
├── wish -> wish8.6
└── wish8.6

0 directories, 12 files

ghost avatar Oct 09 '22 06:10 ghost

there is no include folder in there

ghost avatar Oct 09 '22 06:10 ghost

What are the contents of /opt/homebrew/opt/tcl-tk/include?

petasis avatar Oct 09 '22 06:10 petasis

❯ tree -R /opt/homebrew/opt/tcl-tk/include
/opt/homebrew/opt/tcl-tk/include
├── X11
│   ├── DECkeysym.h
│   ├── HPkeysym.h
│   ├── Sunkeysym.h
│   ├── X.h
│   ├── XF86keysym.h
│   ├── Xatom.h
│   ├── Xfuncproto.h
│   ├── Xlib.h
│   ├── Xutil.h
│   ├── ap_keysym.h
│   ├── cursorfont.h
│   ├── keysym.h
│   ├── keysymdef.h
│   └── xbytes.h
├── fakemysql.h
├── fakepq.h
├── fakesql.h
├── itcl.h
├── itcl2TclOO.h
├── itclDecls.h
├── itclInt.h
├── itclIntDecls.h
├── itclMigrate2TclCore.h
├── itclTclIntStubsFcn.h
├── itk.h
├── itkInt.h
├── mysqlStubs.h
├── odbcStubs.h
├── pqStubs.h
├── tcl.h
├── tclDecls.h
├── tclInt.h
├── tclIntDecls.h
├── tclIntPlatDecls.h
├── tclOO.h
├── tclOODecls.h
├── tclOOInt.h
├── tclOOIntDecls.h
├── tclPlatDecls.h
├── tclPort.h
├── tclThread.h
├── tclTomMath.h
├── tclTomMathDecls.h
├── tclUnixPort.h
├── tdbc.h
├── tdbcDecls.h
├── tdbcInt.h
├── tk.h
├── tkDecls.h
├── tkInt.h
├── tkIntDecls.h
├── tkIntPlatDecls.h
├── tkIntXlibDecls.h
├── tkMacOSX.h
├── tkMacOSXInt.h
├── tkMacOSXPort.h
├── tkPlatDecls.h
├── tkPort.h
├── ttkDecls.h
└── ttkTheme.h

1 directory, 60 files

ghost avatar Oct 09 '22 06:10 ghost

I also export include folder in .zshrc file

export LDFLAGS="-L/opt/homebrew/opt/tcl-tk/lib"
export CPPFLAGS="-I/opt/homebrew/opt/tcl-tk/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/tcl-tk/lib/pkgconfig"

ghost avatar Oct 09 '22 06:10 ghost

So, you have the needed files. But CMake doesn't seem to find this tcl/tk installation. If you go inside the cmake directory of tkdnd, and run build64.sh, what is the output?

petasis avatar Oct 09 '22 06:10 petasis

Is your CMake version above 3.19?

petasis avatar Oct 09 '22 06:10 petasis

❯ sh build64.sh
-- The C compiler identification is AppleClang 14.0.0.14000029
-- The CXX compiler identification is AppleClang 14.0.0.14000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- TKDND version: 2.9.3
-- ===========================================================
--  Welcome to the tkdnd 2.9.3 build system!
--   * Selected generator:  Unix Makefiles
--   * Operating System ID: Darwin-21.6.0-arm64
--   * Installation Directory: /Users/username/Downloads/tkdnd-master/cmake/runtime
-- ===========================================================
-- Searching for Tcl/Tk...
-- Found Tclsh: /usr/bin/tclsh (found version "8.5")
-- Found TCL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/tcl.framework
-- Found TCLTK: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/tcl.framework
-- Found TK: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/tk.framework
--   TCL_TCLSH:               /usr/bin/tclsh
--   TCL_INCLUDE_PATH:        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tcl.framework/Headers
--   TCL_STUB_LIBRARY:        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/lib/libtclstub8.5.a
--   TCL_LIBRARY:             /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/tcl.framework
--   TK_WISH:                 /usr/bin/wish
--   TK_INCLUDE_PATH:         /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tk.framework/Headers
--   TK_STUB_LIBRARY:         /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/lib/libtkstub8.5.a
--   TK_LIBRARY:              /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/tk.framework
--       + Shared Library: tkdnd
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    PKG_OS_ARCH


-- Build files have been written to: /Users/username/Downloads/tkdnd-master/cmake/debug-nmake-x86_64
-- The C compiler identification is AppleClang 14.0.0.14000029
-- The CXX compiler identification is AppleClang 14.0.0.14000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- TKDND version: 2.9.3
-- ===========================================================
--  Welcome to the tkdnd 2.9.3 build system!
--   * Selected generator:  Unix Makefiles
--   * Operating System ID: Darwin-21.6.0-arm64
--   * Installation Directory: /Users/username/Downloads/tkdnd-master/cmake/runtime
-- ===========================================================
-- Searching for Tcl/Tk...
-- Found Tclsh: /usr/bin/tclsh (found version "8.5")
-- Found TCL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/tcl.framework
-- Found TCLTK: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/tcl.framework
-- Found TK: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/tk.framework
--   TCL_TCLSH:               /usr/bin/tclsh
--   TCL_INCLUDE_PATH:        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tcl.framework/Headers
--   TCL_STUB_LIBRARY:        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/lib/libtclstub8.5.a
--   TCL_LIBRARY:             /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/tcl.framework
--   TK_WISH:                 /usr/bin/wish
--   TK_INCLUDE_PATH:         /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tk.framework/Headers
--   TK_STUB_LIBRARY:         /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/usr/lib/libtkstub8.5.a
--   TK_LIBRARY:              /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/tk.framework
--       + Shared Library: tkdnd
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    PKG_OS_ARCH


-- Build files have been written to: /Users/username/Downloads/tkdnd-master/cmake/release-nmake-x86_64

ghost avatar Oct 09 '22 07:10 ghost

after sh build64.sh 2 new folders made in cmake folder

❯ tree -R
.
├── build.bat
├── build.sh
├── build64.bat
├── build64.sh
├── debug-nmake-x86_64
│   ├── CMakeCache.txt
│   ├── CMakeFiles
│   │   ├── 3.24.2
│   │   │   ├── CMakeCCompiler.cmake
│   │   │   ├── CMakeCXXCompiler.cmake
│   │   │   ├── CMakeDetermineCompilerABI_C.bin
│   │   │   ├── CMakeDetermineCompilerABI_CXX.bin
│   │   │   ├── CMakeSystem.cmake
│   │   │   ├── CompilerIdC
│   │   │   │   ├── CMakeCCompilerId.c
│   │   │   │   ├── CMakeCCompilerId.o
│   │   │   │   └── tmp
│   │   │   └── CompilerIdCXX
│   │   │       ├── CMakeCXXCompilerId.cpp
│   │   │       ├── CMakeCXXCompilerId.o
│   │   │       └── tmp
│   │   ├── CMakeDirectoryInformation.cmake
│   │   ├── CMakeError.log
│   │   ├── CMakeOutput.log
│   │   ├── CMakeTmp
│   │   ├── Makefile.cmake
│   │   ├── Makefile2
│   │   ├── TargetDirectories.txt
│   │   ├── cmake.check_cache
│   │   ├── pkgRedirects
│   │   ├── progress.marks
│   │   └── tkdnd2.9.3.dir
│   │       ├── DependInfo.cmake
│   │       ├── build.make
│   │       ├── cmake_clean.cmake
│   │       ├── compiler_depend.make
│   │       ├── compiler_depend.ts
│   │       ├── depend.make
│   │       ├── flags.make
│   │       ├── generic
│   │       ├── link.txt
│   │       ├── macosx
│   │       └── progress.make
│   ├── Makefile
│   ├── cmake_install.cmake
│   └── library
│       └── pkgIndex.tcl
└── release-nmake-x86_64
    ├── CMakeCache.txt
    ├── CMakeFiles
    │   ├── 3.24.2
    │   │   ├── CMakeCCompiler.cmake
    │   │   ├── CMakeCXXCompiler.cmake
    │   │   ├── CMakeDetermineCompilerABI_C.bin
    │   │   ├── CMakeDetermineCompilerABI_CXX.bin
    │   │   ├── CMakeSystem.cmake
    │   │   ├── CompilerIdC
    │   │   │   ├── CMakeCCompilerId.c
    │   │   │   ├── CMakeCCompilerId.o
    │   │   │   └── tmp
    │   │   └── CompilerIdCXX
    │   │       ├── CMakeCXXCompilerId.cpp
    │   │       ├── CMakeCXXCompilerId.o
    │   │       └── tmp
    │   ├── CMakeDirectoryInformation.cmake
    │   ├── CMakeError.log
    │   ├── CMakeOutput.log
    │   ├── CMakeTmp
    │   ├── Makefile.cmake
    │   ├── Makefile2
    │   ├── TargetDirectories.txt
    │   ├── cmake.check_cache
    │   ├── pkgRedirects
    │   ├── progress.marks
    │   └── tkdnd2.9.3.dir
    │       ├── DependInfo.cmake
    │       ├── build.make
    │       ├── cmake_clean.cmake
    │       ├── compiler_depend.make
    │       ├── compiler_depend.ts
    │       ├── depend.make
    │       ├── flags.make
    │       ├── generic
    │       ├── link.txt
    │       ├── macosx
    │       └── progress.make
    ├── Makefile
    ├── cmake_install.cmake
    └── library
        └── pkgIndex.tcl

26 directories, 64 files

ghost avatar Oct 09 '22 07:10 ghost

Ok, CMake picks the default tcl-tk installation that comes with Xcode, and not the one you installed with homebrew.

petasis avatar Oct 09 '22 07:10 petasis

so export to PATH is not working properly?

update: my fault, i comment the export comands

ghost avatar Oct 09 '22 07:10 ghost

If you run CMake with -Dwith-tcl=/opt/homebrew/opt/tcl-tk, does it pick the homebrew tcl-tk?

petasis avatar Oct 09 '22 07:10 petasis

now it looks like following in zshrc file and i try above steps again

export PATH="/opt/homebrew/opt/tcl-tk/bin:$PATH"
export LDFLAGS="-L/opt/homebrew/opt/tcl-tk/lib"
export CPPFLAGS="-I/opt/homebrew/opt/tcl-tk/include"
export PKG_CONFIG_PATH="/opt/homebrew/opt/tcl-tk/lib/pkgconfig"
❯ sh build64.sh
-- The C compiler identification is AppleClang 14.0.0.14000029
-- The CXX compiler identification is AppleClang 14.0.0.14000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- TKDND version: 2.9.3
-- ===========================================================
--  Welcome to the tkdnd 2.9.3 build system!
--   * Selected generator:  Unix Makefiles
--   * Operating System ID: Darwin-21.6.0-arm64
--   * Installation Directory: /Users/chenzhiyu/Downloads/tkdnd-master/cmake/runtime
-- ===========================================================
-- Searching for Tcl/Tk...
-- Found Tclsh: /opt/homebrew/opt/tcl-tk/bin/tclsh (found version "8.6")
-- Found TCL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/tcl.framework
-- Found TCLTK: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/tcl.framework
-- Found TK: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/tk.framework
--   TCL_TCLSH:               /opt/homebrew/opt/tcl-tk/bin/tclsh
--   TCL_INCLUDE_PATH:        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tcl.framework/Headers
--   TCL_STUB_LIBRARY:        /opt/homebrew/opt/tcl-tk/lib/libtclstub8.6.a
--   TCL_LIBRARY:             /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/tcl.framework
--   TK_WISH:                 /opt/homebrew/opt/tcl-tk/bin/wish
--   TK_INCLUDE_PATH:         /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tk.framework/Headers
--   TK_STUB_LIBRARY:         /opt/homebrew/opt/tcl-tk/lib/libtkstub8.6.a
--   TK_LIBRARY:              /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/tk.framework
--       + Shared Library: tkdnd
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    PKG_OS_ARCH


-- Build files have been written to: /Users/chenzhiyu/Downloads/tkdnd-master/cmake/debug-nmake-x86_64
-- The C compiler identification is AppleClang 14.0.0.14000029
-- The CXX compiler identification is AppleClang 14.0.0.14000029
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- TKDND version: 2.9.3
-- ===========================================================
--  Welcome to the tkdnd 2.9.3 build system!
--   * Selected generator:  Unix Makefiles
--   * Operating System ID: Darwin-21.6.0-arm64
--   * Installation Directory: /Users/chenzhiyu/Downloads/tkdnd-master/cmake/runtime
-- ===========================================================
-- Searching for Tcl/Tk...
-- Found Tclsh: /opt/homebrew/opt/tcl-tk/bin/tclsh (found version "8.6")
-- Found TCL: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/tcl.framework
-- Found TCLTK: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/tcl.framework
-- Found TK: /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/tk.framework
--   TCL_TCLSH:               /opt/homebrew/opt/tcl-tk/bin/tclsh
--   TCL_INCLUDE_PATH:        /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tcl.framework/Headers
--   TCL_STUB_LIBRARY:        /opt/homebrew/opt/tcl-tk/lib/libtclstub8.6.a
--   TCL_LIBRARY:             /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/tcl.framework
--   TK_WISH:                 /opt/homebrew/opt/tcl-tk/bin/wish
--   TK_INCLUDE_PATH:         /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tk.framework/Headers
--   TK_STUB_LIBRARY:         /opt/homebrew/opt/tcl-tk/lib/libtkstub8.6.a
--   TK_LIBRARY:              /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/tk.framework
--       + Shared Library: tkdnd
-- Configuring done
-- Generating done
CMake Warning:
  Manually-specified variables were not used by the project:

    PKG_OS_ARCH


-- Build files have been written to: /Users/chenzhiyu/Downloads/tkdnd-master/cmake/release-nmake-x86_64

ghost avatar Oct 09 '22 07:10 ghost

It still gets the wrong include paths. Can you run CMake with -Dwith-tcl=/opt/homebrew/opt/tcl-tk?

petasis avatar Oct 09 '22 07:10 petasis

tried cmake -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=Release -D PKG_OS_ARCH=x86_64 -Dwith-tcl=/opt/homebrew/opt/tcl-tk -D CMAKE_INSTALL_PREFIX=../runtime ../..

include path is still wrong as before

ghost avatar Oct 09 '22 07:10 ghost

Ok, lets see if we can get to build with:

/opt/homebrew/opt/tcl-tk/tclsh tcl-conf

tcl-conf is in the root of tkdnd folder.

Also, try with adding a space between -D and with-tcl in cmake.

petasis avatar Oct 09 '22 07:10 petasis

i tred "/opt/homebrew/Cellar/tcl-tk/8.6.12_1/bin/tclsh tcl-conf" in root of tkdnd folder, and run "make install" again, gives same error as "tclsh tcl-conf"

i edit build64.sh to following

mkdir debug-nmake-x86_64
cd    debug-nmake-x86_64
cmake -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug -D PKG_OS_ARCH=x86_64 -D with-tcl=/opt/homebrew/opt/tcl-tk -D CMAKE_INSTALL_PREFIX=../runtime ../..
cd ..

mkdir release-nmake-x86_64
cd    release-nmake-x86_64
cmake -G "Unix Makefiles" -D CMAKE_BUILD_TYPE=Release -D PKG_OS_ARCH=x86_64 -D with-tcl=/opt/homebrew/opt/tcl-tk  -D CMAKE_INSTALL_PREFIX=../runtime ../..
cd ..

but include and lib directory still from Xcode

too wired

ghost avatar Oct 09 '22 07:10 ghost

What is the error from /opt/homebrew/Cellar/tcl-tk/8.6.12_1/bin/tclsh tcl-conf? Can you post what is printed on the terminal?

petasis avatar Oct 09 '22 07:10 petasis

❯ sudo /opt/homebrew/Cellar/tcl-tk/8.6.12_1/bin/tclsh tcl-conf
Password:
TkDND sources: /Users/username/Downloads/tkdnd-master
Tcllib's package "fileutil" found!

Found "tclConfig.sh" in "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current".
Found "tcl.h" in "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current/Headers".
Found "tk.h"  in "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tk.framework/Versions/Current/Headers".

+++ Running 'bash configure -srcdir=/Users/username/Downloads/tkdnd-master
                  --prefix=/Users/username/Downloads/tkdnd-master/cmake/runtime
                  --exec-prefix=/Users/username/Downloads/tkdnd-master/cmake/runtime
                  --with-tcl=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current
                  --with-tk=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tk.framework/Versions/Current
                  --with-tclinclude=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current/Headers
                  --with-tkinclude=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tk.framework/Versions/Current/Headers
                  PKG_INCLUDES=-I"/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tk.framework/Versions/Current/Headers/tk-private"
                  --disable-64bit'
             in directory /Users/username/Downloads/tkdnd-master...
checking TEA configuration... ok (TEA 3.13)
configure: configuring tkdnd 2.9.3
checking system version... Darwin-21.6.0
checking for Tcl configuration... found /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current/tclConfig.sh
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether we are using the GNU C compiler... yes
checking whether gcc accepts -g... yes
checking for gcc option to accept ISO C89... none needed
checking for existence of /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current/tclConfig.sh... loading
checking platform... unix
checking for Tk configuration... found /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tk.framework/Versions/Current/tkConfig.sh
checking for existence of /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tk.framework/Versions/Current/tkConfig.sh... loading
checking for gcc... (cached) gcc
checking whether we are using the GNU C compiler... (cached) yes
checking whether gcc accepts -g... (cached) yes
checking for gcc option to accept ISO C89... (cached) none needed
checking how to run the C preprocessor... gcc -E
checking whether make sets $(MAKE)... yes
checking for ranlib... ranlib
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for ANSI C header files... yes
checking for sys/types.h... yes
checking for sys/stat.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for memory.h... yes
checking for strings.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for unistd.h... yes
checking if the compiler understands -pipe... yes
checking whether byte ordering is bigendian... no
checking for Tcl public headers... /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tcl.framework/Versions/Current/Headers
checking for Tk public headers... /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tk.framework/Versions/Current/Headers
checking for X11 header files... /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX12.3.sdk/System/Library/Frameworks/Tk.framework/Versions/Current/Headers
checking for Tk private include files... Using -I"/AppleInternal/Library/BuildRoots/66382bca-8bca-11ec-aade-6613bcf0e2ee/Library/Caches/com.apple.xbs/Sources/tcl/tk/tk/generic" -I"/AppleInternal/Library/BuildRoots/66382bca-8bca-11ec-aade-6613bcf0e2ee/Library/Caches/com.apple.xbs/Sources/tcl/tk/tk/unix" -I""/AppleInternal/Library/BuildRoots/66382bca-8bca-11ec-aade-6613bcf0e2ee/Library/Caches/com.apple.xbs/Sources/tcl/tk/tk/xlib"" -I"/AppleInternal/Library/BuildRoots/66382bca-8bca-11ec-aade-6613bcf0e2ee/Library/Caches/com.apple.xbs/Sources/tcl/tk/tk/macosx" -iwithsysroot /System/Library/Frameworks/Tk.framework/Versions/8.5/Headers -iwithsysroot /System/Library/Frameworks/Tk.framework/Versions/8.5/PrivateHeaders
checking for pthread_mutex_init in -lpthread... yes
checking for building with threads... yes (default)
checking how to build libraries... shared
checking for ranlib... (cached) ranlib
checking if 64bit support is requested... no
checking if 64bit Sparc VIS support is requested... no
checking if compiler supports visibility "hidden"... yes
checking if rpath support is requested... yes
checking system version... (cached) Darwin-21.6.0
checking for ar... ar
checking if ld accepts -single_module flag... yes
checking if ld accepts -search_paths_first flag... yes
checking for cast to union support... yes
checking for required early compiler flags... none
checking for 64-bit integer type... using long
checking for build with symbols... no
checking for tclsh... /usr/bin/tclsh8.5
checking for wish... /usr/bin/wish8.5
checking for intptr_t... no
checking for pointer-size signed integer type... none
checking for uintptr_t... no
checking for pointer-size unsigned integer type... none
configure: creating ./config.status
config.status: creating Makefile
config.status: creating pkgIndex.tcl

and then run make install print following error again

ld: symbol(s) not found for architecture arm64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [libtkdnd2.9.3.dylib] Error 1

ghost avatar Oct 09 '22 08:10 ghost