C++20 standard library compile error for module on macOS - c++

Here are my test code and build scripts.
testmodule.cpp
#include <iostream>
export module testmodule;
export int add(int a, int b)
{
return a + b;
}
main.cpp
#include <iostream>
import testmodule;
using namespace std;
int main() {
cout << "Test Modules" << endl;
cout << "add 1 and 2 is " << add(1,2) << endl;
}
build.sh
rm *.o
rm *.pcm
clang++ -fmodules-ts -Wall -v -c -ferror-limit=1 -Xclang -emit-module-interface testmodule.cpp -o testmodule.pcm
clang++ -fmodules-ts -Wall -v -c -ferror-limit=1 -fprebuilt-module-path=. main.cpp -o main.o
clang++ -fmodules-ts -o main main.o *.pcm
When I run the build.sh, I got the following compile errors:
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: x86_64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
"/Library/Developer/CommandLineTools/usr/bin/clang" -cc1 -triple x86_64-apple-macosx12.0.0 -Wundef-prefix=TARGET_OS_ -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fno-strict-return -fno-rounding-math -funwind-tables=2 -target-sdk-version=12.3 -fvisibility-inlines-hidden-static-local-var -target-cpu penryn -tune-cpu generic -debugger-tuning=lldb -target-linker-version 819.6 -v -resource-dir /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -stdlib=libc++ -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1 -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include -internal-externc-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem /Library/Developer/CommandLineTools/usr/include -Wall -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-elaborated-enum-base -Wno-reserved-identifier -Wno-gnu-folding-constant -Wno-cast-function-type -Wno-bitwise-instead-of-logical -fdeprecated-macro -fdebug-compilation-dir=/Users/bf/Workspaces/C-plus-plus-Playground/validateC++20 -ferror-limit 1 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fno-cxx-modules -fmodules-ts -fno-implicit-modules -fprebuilt-module-path=. -fcxx-exceptions -fexceptions -fmax-type-align=16 -fcommon -fcolor-diagnostics -clang-vendor-feature=+messageToSelfInClassMethodIdReturnType -clang-vendor-feature=+disableInferNewAvailabilityFromInit -clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation -fno-odr-hash-protocols -clang-vendor-feature=+enableAggressiveVLAFolding -clang-vendor-feature=+revert09abecef7bbf -clang-vendor-feature=+thisNoAlignAttr -clang-vendor-feature=+thisNoNullAttr -mllvm -disable-aligned-alloc-awareness=1 -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o main.o -x c++ main.cpp
clang -cc1 version 14.0.0 (clang-1400.0.29.102) default target x86_64-apple-darwin21.6.0
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
/Library/Developer/CommandLineTools/usr/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
In module 'testmodule' imported from main.cpp:3:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/ostream:216:20: error: 'std::basic_ostream<char>::operator<<' from module 'testmodule.<global>' is not present in definition of 'std::ostream' provided earlier
basic_ostream& operator<<(nullptr_t)
^
If I comment out the line #1 in testmodule.cpp and run build.sh, I'll get a main binary as expected.
% ./main
Test Modules
add 1 and 2 is 3
It seems that I cannot include std libraries in both main.cpp and testmodule.cpp.
Any idea where I can start to look into this?
[Update 2022-10-18]
With Remy's suggestion, I tried import <iostream>; in testmodule.cpp, and got the following errors,
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: x86_64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
"/Library/Developer/CommandLineTools/usr/bin/clang" -cc1 -triple x86_64-apple-macosx12.0.0 -Wundef-prefix=TARGET_OS_ -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name testmodule.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fno-strict-return -fno-rounding-math -funwind-tables=2 -target-sdk-version=12.3 -fvisibility-inlines-hidden-static-local-var -target-cpu penryn -tune-cpu generic -debugger-tuning=lldb -target-linker-version 819.6 -v -resource-dir /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -stdlib=libc++ -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1 -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include -internal-externc-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem /Library/Developer/CommandLineTools/usr/include -Wall -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-elaborated-enum-base -Wno-reserved-identifier -Wno-gnu-folding-constant -Wno-cast-function-type -Wno-bitwise-instead-of-logical -fdeprecated-macro -fdebug-compilation-dir=/Users/bf/Workspaces/C-plus-plus-Playground/validateC++20 -ferror-limit 1 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fno-cxx-modules -fmodules-ts -fno-implicit-modules -fcxx-exceptions -fexceptions -fmax-type-align=16 -fcommon -fcolor-diagnostics -emit-module-interface -clang-vendor-feature=+messageToSelfInClassMethodIdReturnType -clang-vendor-feature=+disableInferNewAvailabilityFromInit -clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation -fno-odr-hash-protocols -clang-vendor-feature=+enableAggressiveVLAFolding -clang-vendor-feature=+revert09abecef7bbf -clang-vendor-feature=+thisNoAlignAttr -clang-vendor-feature=+thisNoNullAttr -mllvm -disable-aligned-alloc-awareness=1 -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o testmodule.pcm -x c++ testmodule.cpp
clang -cc1 version 14.0.0 (clang-1400.0.29.102) default target x86_64-apple-darwin21.6.0
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
/Library/Developer/CommandLineTools/usr/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
testmodule.cpp:2:8: error: expected a module name after 'import'
import <iostream>;
^
[update Tue Oct 18 2:38PM]
Thanks for sigma's comments. I moved [export] section to the beginning of the code. I added cout statement in testmodule.cpp to make iostream required in testmodule.cpp. After the modification I still see compile errors when compile main.cpp
1 // testmodule.cpp
2 export module testmodule;
3 #include <iostream>
4 export int add(int a, int b)
5 {
6 std::cout << "in add()\n";
7 return a + b;
8 }
1 // main.cpp
2 #include <iostream>
3
4 import testmodule;
5
6 using namespace std;
7
8 int main() {
9 cout << "Test Modules" << endl;
10 cout << "add 1 and 2 is " << add(1,2) << endl;
11 }
% clang++ -fmodules-ts -Wall -c -ferror-limit=1 -Xclang -emit-module-interface testmodule.cpp -o testmodule.pcm
% clang++ -fmodules-ts -Wall -v -c -ferror-limit=1 -fprebuilt-module-path=. main.cpp -o main.o
Apple clang version 14.0.0 (clang-1400.0.29.102)
Target: x86_64-apple-darwin21.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
"/Library/Developer/CommandLineTools/usr/bin/clang" -cc1 -triple x86_64-apple-macosx12.0.0 -Wundef-prefix=TARGET_OS_ -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -mrelax-all --mrelax-relocations -disable-free -clear-ast-before-backend -disable-llvm-verifier -discard-value-names -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mframe-pointer=all -fno-strict-return -fno-rounding-math -funwind-tables=2 -target-sdk-version=12.3 -fvisibility-inlines-hidden-static-local-var -target-cpu penryn -tune-cpu generic -debugger-tuning=lldb -target-linker-version 819.6 -v -resource-dir /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0 -isysroot /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk -I/usr/local/include -stdlib=libc++ -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1 -internal-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include -internal-externc-isystem /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem /Library/Developer/CommandLineTools/usr/include -Wall -Wno-reorder-init-list -Wno-implicit-int-float-conversion -Wno-c99-designator -Wno-final-dtor-non-final-class -Wno-extra-semi-stmt -Wno-misleading-indentation -Wno-quoted-include-in-framework-header -Wno-implicit-fallthrough -Wno-enum-enum-conversion -Wno-enum-float-conversion -Wno-elaborated-enum-base -Wno-reserved-identifier -Wno-gnu-folding-constant -Wno-cast-function-type -Wno-bitwise-instead-of-logical -fdeprecated-macro -fdebug-compilation-dir=/Users/bf/Workspaces/C-plus-plus-Playground/validateC++20/try001 -ferror-limit 1 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fno-cxx-modules -fmodules-ts -fno-implicit-modules -fprebuilt-module-path=. -fcxx-exceptions -fexceptions -fmax-type-align=16 -fcommon -fcolor-diagnostics -clang-vendor-feature=+messageToSelfInClassMethodIdReturnType -clang-vendor-feature=+disableInferNewAvailabilityFromInit -clang-vendor-feature=+disableNonDependentMemberExprInCurrentInstantiation -fno-odr-hash-protocols -clang-vendor-feature=+enableAggressiveVLAFolding -clang-vendor-feature=+revert09abecef7bbf -clang-vendor-feature=+thisNoAlignAttr -clang-vendor-feature=+thisNoNullAttr -mllvm -disable-aligned-alloc-awareness=1 -D__GCC_HAVE_DWARF2_CFI_ASM=1 -o main.o -x c++ main.cpp
clang -cc1 version 14.0.0 (clang-1400.0.29.102) default target x86_64-apple-darwin21.6.0
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1
/Library/Developer/CommandLineTools/usr/lib/clang/14.0.0/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include
/Library/Developer/CommandLineTools/usr/include
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
In module 'testmodule' imported from main.cpp:3:
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:436:43: error: 'std::integral_constant<bool, false>::value' from module 'testmodule' is not present in definition of 'std::integral_constant<bool, false>' provided earlier
static _LIBCPP_CONSTEXPR const _Tp value = __v;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/c++/v1/type_traits:436:43: note: declaration of 'value' does not match
static _LIBCPP_CONSTEXPR const _Tp value = __v;
^
fatal error: too many errors emitted, stopping now [-ferror-limit=]
2 errors generated.
[update 2022-10-19]
Thanks sigma. I did some further tests on module fragment test. It seems the clang++ on macOS does not fully support c++ module.
Code,
// interface_part.cppm
export module M:interface_part;
export void World();
Compile command and output,
% clang++ -std=c++20 -fmodules-ts interface_part.cppm --precompile -o M-interface_part.pcm
interface_part.cppm:2:16: error: sorry, module partitions are not yet supported
export module M:interface_part;
^~~~~~~~~~~~~~~
1 error generated.

Related

How to include ft2build.h in SDL2 CMake project

I want to compile a CMake project using SDL2 and SDL_ttf library.
I copied "SDL_ttf.c" & "SDL_ttf.h" into my src folder.
(EDIT: removed it, see comments)
I also added this to my CMakeLists.txt:
include_directories(${SDL2_TTF_INCLUDE_DIR})
freetype2 is also installed
but i get the error after calling make
src/SDL_ttf.c:28:10: fatal error: ft2build.h: No such file or directory
28 | #include <ft2build.h>
How do i properly install SDL_ttf to my system?
(https://github.com/libsdl-org/SDL_ttf/blob/main/CMakeLists.txt)
EDIT:
my CMakeLists.txt:
cmake_minimum_required(VERSION 3.7)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
add_definitions(-std=c++17)
set(CXX_FLAGS "-Wall")
set(CMAKE_CXX_FLAGS, "${CXX_FLAGS}")
project(SDL2Test)
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmake/")
find_package(SDL2 REQUIRED)
find_package(SDL2_ttf REQUIRED)
include_directories(${SDL2_INCLUDE_DIRS} src)
include_directories(${SDL2_TTF_INCLUDE_DIR})
add_executable(Zokoban src/main.cpp src/game.cpp src/controller.cpp src/renderer.cpp src/hero.cpp src/level.cpp)
string(STRIP ${SDL2_LIBRARIES} SDL2_LIBRARIES)
target_link_libraries(Zokoban ${SDL2_LIBRARIES} ${SDL2_TTF_INCLUDE_DIR})
EDIT2:
after sudo make install (SDL_ttf source) and removing the SDL-source files from my repo:
[ 57%] Building CXX object CMakeFiles/Zokoban.dir/src/renderer.cpp.o
/07_Capstone/Zokoban/src/renderer.cpp:9:10: fatal error: SDL_ttf.h: No such file or directory
9 | #include <SDL_ttf.h>
EDIT3
On another machine (debian11) i couldn't even compile the SDL_ttf - source
19:46 $
✔ ~/ThirdParty/SDL_ttf/build [main|✚ 3…1]
19:46 $ make
/bin/bash ./libtool --tag=CC --mode=compile gcc -DPACKAGE_NAME=\"SDL2_ttf\" -DPACKAGE_TARNAME=\"SDL2_ttf\" -DPACKAGE_VERSION=\"2.21.0\" -DPACKAGE_STRING=\"SDL2_ttf\ 2.21.0\" -DPACKAGE_BUGREPORT=\"https://github.com/libsdl-org/SDL_ttf/issues\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DSDL_BUILD_MAJOR_VERSION=2 -DSDL_BUILD_MINOR_VERSION=21 -DSDL_BUILD_MICRO_VERSION=0 -DPACKAGE=\"SDL2_ttf\" -DVERSION=\"2.21.0\" -DTTF_USE_HARFBUZZ=1 -DHAVE_CXX11=1 -DALIGNOF_STRUCT_CHAR__=1 -I. -I.. -I../external/freetype/include -DFT2_BUILD_LIBRARY -DFT_PUBLIC_FUNCTION_ATTRIBUTE= -I../external/harfbuzz -I../external/harfbuzz/src -DHAVE_CONFIG_H -DFT_CONFIG_OPTION_USE_HARFBUZZ -g -O2 -D_REENTRANT -I/usr/include/SDL2 -Wall -fvisibility=hidden -DHAVE_OPENGL -MT libSDL2_ttf_la-SDL_ttf.lo -MD -MP -MF .deps/libSDL2_ttf_la-SDL_ttf.Tpo -c -o libSDL2_ttf_la-SDL_ttf.lo `test -f 'SDL_ttf.c' || echo '../'`SDL_ttf.c
libtool: compile: gcc -DPACKAGE_NAME=\"SDL2_ttf\" -DPACKAGE_TARNAME=\"SDL2_ttf\" -DPACKAGE_VERSION=\"2.21.0\" "-DPACKAGE_STRING=\"SDL2_ttf 2.21.0\"" -DPACKAGE_BUGREPORT=\"https://github.com/libsdl-org/SDL_ttf/issues\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DSDL_BUILD_MAJOR_VERSION=2 -DSDL_BUILD_MINOR_VERSION=21 -DSDL_BUILD_MICRO_VERSION=0 -DPACKAGE=\"SDL2_ttf\" -DVERSION=\"2.21.0\" -DTTF_USE_HARFBUZZ=1 -DHAVE_CXX11=1 -DALIGNOF_STRUCT_CHAR__=1 -I. -I.. -I../external/freetype/include -DFT2_BUILD_LIBRARY -DFT_PUBLIC_FUNCTION_ATTRIBUTE= -I../external/harfbuzz -I../external/harfbuzz/src -DHAVE_CONFIG_H -DFT_CONFIG_OPTION_USE_HARFBUZZ -g -O2 -D_REENTRANT -I/usr/include/SDL2 -Wall -fvisibility=hidden -DHAVE_OPENGL -MT libSDL2_ttf_la-SDL_ttf.lo -MD -MP -MF .deps/libSDL2_ttf_la-SDL_ttf.Tpo -c ../SDL_ttf.c -fPIC -DPIC -o .libs/libSDL2_ttf_la-SDL_ttf.o
../SDL_ttf.c:28:10: fatal error: ft2build.h: No such file or directory
28 | #include <ft2build.h>
| ^~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:1539: libSDL2_ttf_la-SDL_ttf.lo] Error 1
.. although ft2build.h is obviously installed:
ls /usr/include/freetype2/
freetype ft2build.h
EDIT4:
I downloaded from https://github.com/libsdl-org/SDL_ttf/releases "SDL2_ttf-2.20.0.tar.gz". And could configure, make and sudo make install SDL_ttf.
... but make my project is still not possible
18:03 $ make
[ 14%] Building CXX object CMakeFiles/Zokoban.dir/src/main.cpp.o
[ 28%] Building CXX object CMakeFiles/Zokoban.dir/src/game.cpp.o
[ 42%] Building CXX object CMakeFiles/Zokoban.dir/src/controller.cpp.o
[ 57%] Building CXX object CMakeFiles/Zokoban.dir/src/renderer.cpp.o
/home/Zokoban/src/renderer.cpp:9:10: fatal error: SDL_ttf.h: No such file or directory
9 | #include <SDL_ttf.h>
| ^~~~~~~~~~~
When i tried it with the released sourcecode i get still the error.
~/learning/ThirdParty/SDL_ttf-release-2.20.0/build$ make
depbase=`echo showfont.o | sed 's|[^/]*$|.deps/&|;s|\.o$||'`;\
gcc -DPACKAGE_NAME=\"SDL2_ttf\" -DPACKAGE_TARNAME=\"SDL2_ttf\" -DPACKAGE_VERSION=\"2.20.0\" -DPACKAGE_STRING=\"SDL2_ttf\ 2.20.0\" -DPACKAGE_BUGREPORT=\"https://github.com/libsdl-org/SDL_ttf/issues\" -DPACKAGE_URL=\"\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DSDL_BUILD_MAJOR_VERSION=2 -DSDL_BUILD_MINOR_VERSION=20 -DSDL_BUILD_MICRO_VERSION=0 -DPACKAGE=\"SDL2_ttf\" -DVERSION=\"2.20.0\" -DTTF_USE_HARFBUZZ=1 -DHAVE_CXX11=1 -DALIGNOF_STRUCT_CHAR__=1 -I. -I.. -g -O2 -D_REENTRANT -I/usr/include/SDL2 -Wall -fvisibility=hidden -DHAVE_OPENGL -MT showfont.o -MD -MP -MF $depbase.Tpo -c -o showfont.o ../showfont.c &&\
mv -f $depbase.Tpo $depbase.Po
/bin/bash ./libtool --tag=CC --mode=compile gcc -DPACKAGE_NAME=\"SDL2_ttf\" -DPACKAGE_TARNAME=\"SDL2_ttf\" -DPACKAGE_VERSION=\"2.20.0\" -DPACKAGE_STRING=\"SDL2_ttf\ 2.20.0\" -DPACKAGE_BUGREPORT=\"https://github.com/libsdl-org/SDL_ttf/issues\" -DPACKAGE_URL=\"\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DSDL_BUILD_MAJOR_VERSION=2 -DSDL_BUILD_MINOR_VERSION=20 -DSDL_BUILD_MICRO_VERSION=0 -DPACKAGE=\"SDL2_ttf\" -DVERSION=\"2.20.0\" -DTTF_USE_HARFBUZZ=1 -DHAVE_CXX11=1 -DALIGNOF_STRUCT_CHAR__=1 -I. -I.. -I../external/freetype/include -DFT2_BUILD_LIBRARY -DFT_PUBLIC_FUNCTION_ATTRIBUTE= -I../external/harfbuzz -I../external/harfbuzz/src -DHAVE_CONFIG_H -DFT_CONFIG_OPTION_USE_HARFBUZZ -g -O2 -D_REENTRANT -I/usr/include/SDL2 -Wall -fvisibility=hidden -DHAVE_OPENGL -MT libSDL2_ttf_la-SDL_ttf.lo -MD -MP -MF .deps/libSDL2_ttf_la-SDL_ttf.Tpo -c -o libSDL2_ttf_la-SDL_ttf.lo `test -f 'SDL_ttf.c' || echo '../'`SDL_ttf.c
libtool: compile: gcc -DPACKAGE_NAME=\"SDL2_ttf\" -DPACKAGE_TARNAME=\"SDL2_ttf\" -DPACKAGE_VERSION=\"2.20.0\" "-DPACKAGE_STRING=\"SDL2_ttf 2.20.0\"" -DPACKAGE_BUGREPORT=\"https://github.com/libsdl-org/SDL_ttf/issues\" -DPACKAGE_URL=\"\" -DHAVE_STDIO_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_STRINGS_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_UNISTD_H=1 -DSTDC_HEADERS=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DSDL_BUILD_MAJOR_VERSION=2 -DSDL_BUILD_MINOR_VERSION=20 -DSDL_BUILD_MICRO_VERSION=0 -DPACKAGE=\"SDL2_ttf\" -DVERSION=\"2.20.0\" -DTTF_USE_HARFBUZZ=1 -DHAVE_CXX11=1 -DALIGNOF_STRUCT_CHAR__=1 -I. -I.. -I../external/freetype/include -DFT2_BUILD_LIBRARY -DFT_PUBLIC_FUNCTION_ATTRIBUTE= -I../external/harfbuzz -I../external/harfbuzz/src -DHAVE_CONFIG_H -DFT_CONFIG_OPTION_USE_HARFBUZZ -g -O2 -D_REENTRANT -I/usr/include/SDL2 -Wall -fvisibility=hidden -DHAVE_OPENGL -MT libSDL2_ttf_la-SDL_ttf.lo -MD -MP -MF .deps/libSDL2_ttf_la-SDL_ttf.Tpo -c ../SDL_ttf.c -fPIC -DPIC -o .libs/libSDL2_ttf_la-SDL_ttf.o
../SDL_ttf.c:28:10: fatal error: ft2build.h: No such file or directory
28 | #include <ft2build.h>
| ^~~~~~~~~~~~
compilation terminated.
make: *** [Makefile:1536: libSDL2_ttf_la-SDL_ttf.lo] Error 1
My ideas run out :(

how to configure bazel toolchain for cross compile use rules_foreign_cc

my project need cross compile for arm aarch64 on ubuntu x86_64, but failed at configure stage, below is log
log
# Execution platform: //platforms:linux_gcc9_aarch64
SUBCOMMAND: # #boost//:filesystem [action 'Linking external/boost/libfilesystem.so', configuration: fc89852de14da3c51e8226c7c5e3087929e4f56710d05ed9ab86ed21b8eb16d4, execution platform: //platforms:linux_gcc9_aarch64]
(cd /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo && \
exec env - \
PATH=/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/root/src/go/bin:/usr/local/jdk-11.0.15/bin:/root/.ft:/data/.cache/npm/global/bin \
PWD=/proc/self/cwd \
external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc -shared -o bazel-out/k8-fastbuild/bin/external/boost/libfilesystem.so bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/codecvt_error_category.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/directory.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/exception.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/operations.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/path.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/path_traits.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/portability.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/unique_path.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/utf8_codecvt_facet.o bazel-out/k8-fastbuild/bin/external/boost/_objs/filesystem/windows_file_codecvt.o -Wl,-S -lstdc++ -lm -Wl,-no-as-needed -Wl,-z,relro,-z,now -Wall -pass-exit-codes '-fuse-ld=gold')
# Configuration: fc89852de14da3c51e8226c7c5e3087929e4f56710d05ed9ab86ed21b8eb16d4
# Execution platform: //platforms:linux_gcc9_aarch64
ERROR: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/external/rules_foreign_cc/toolchains/BUILD.bazel:130:10: BootstrapGNUMake external/rules_foreign_cc/toolchains/make failed: (Exit 1): bash failed: error executing command
(cd /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo && \
exec env - \
PATH=/root/.cargo/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/local/go/bin:/root/src/go/bin:/usr/local/jdk-11.0.15/bin:/root/.ft:/data/.cache/npm/global/bin \
/bin/bash -c bazel-out/k8-opt-exec-277332AD/bin/external/rules_foreign_cc/toolchains/make_tool_foreign_cc/wrapper_build_script.sh)
# Configuration: 920514b75167e08aaf5b08b6fc5ff1721a7e3be841d2c442cd3624a15e568e52
# Execution platform: //platforms:linux_gcc9_aarch64
rules_foreign_cc: Build failed!
rules_foreign_cc: Keeping temp build directory and dependencies directory for debug.
rules_foreign_cc: Please note that the directories inside a sandbox are still cleaned unless you specify --sandbox_debug Bazel command line flag.
rules_foreign_cc: Printing build logs:
_____ BEGIN BUILD LOGS _____
+ AR=/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc-ar
+ ARFLAGS=rcsD
+ CC=/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc
+ CFLAGS='-fPIC -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -march=armv8-a -g0 -O3 -DNDEBUG -D_FORTIFY_SOURCE=2 -ffunction-sections -fdata-sections -funsafe-math-optimizations -ftree-vectorize -std=c99 -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined -D__DATE__=redacted -D__TIMESTAMP__=redacted -D__TIME__=redacted'
+ LD=/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc
+ LDFLAGS='-lstdc++ -lm -Wl,-no-as-needed -Wl,-z,relro,-z,now -Wall -pass-exit-codes -fuse-ld=gold -Wl,--gc-sections'
+ ./configure --without-guile --with-guile=no --disable-dependency-tracking --prefix=/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-opt-exec-277332AD/bin/external/rules_foreign_cc/toolchains/make
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... /bin/mkdir -p
checking for gawk... gawk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking whether make supports the include directive... yes (GNU style)
checking for gcc... /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-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... configure: error: in `/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-opt-exec-277332AD/bin/external/rules_foreign_cc/toolchains/make.build_tmpdir':
config.log
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by gperftools configure 2.9.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/com_github_gperftools_gperftools/configure --prefix=/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-fastbuild/bin/external/com_github_gperftools_gperftools/gperftools_build.build_tmpdir/gperftools_build --enable-shared=no --enable-frame-pointers --disable-libunwind
## --------- ##
## Platform. ##
## --------- ##
hostname = ubuntu
uname -m = x86_64
uname -r = 5.4.0-109-generic
uname -s = Linux
uname -v = #123-Ubuntu SMP Fri Apr 8 09:10:54 UTC 2022
/usr/bin/uname -p = unknown
/bin/uname -X = unknown
/bin/arch = unknown
/usr/bin/arch -k = unknown
/usr/convex/getsysinfo = unknown
/usr/bin/hostinfo = unknown
/bin/machine = unknown
/usr/bin/oslevel = unknown
/bin/universe = unknown
PATH: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-fastbuild/bin/external/com_github_gperftools_gperftools/gperftools_build.ext_build_deps/bin
PATH: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo
PATH: /root/.cargo/bin
PATH: /usr/local/sbin
PATH: /usr/local/bin
PATH: /usr/sbin
PATH: /usr/bin
PATH: /sbin
PATH: /bin
PATH: /usr/games
PATH: /usr/local/games
PATH: /snap/bin
PATH: /usr/local/go/bin
PATH: /root/src/go/bin
PATH: /usr/local/jdk-11.0.15/bin
PATH: /root/.ft
PATH: /data/.cache/npm/global/bin
PATH: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-fastbuild/bin/external/com_github_gperftools_gperftools/gperftools_build.ext_build_deps/bin/toolchains
## ----------- ##
## Core tests. ##
## ----------- ##
configure:2617: checking build system type
configure:2631: result: x86_64-pc-linux-gnu
configure:2651: checking host system type
configure:2664: result: x86_64-pc-linux-gnu
configure:2700: checking for a BSD-compatible install
configure:2768: result: /usr/bin/install -c
configure:2779: checking whether build environment is sane
configure:2834: result: yes
configure:2978: checking for a thread-safe mkdir -p
configure:3017: result: /bin/mkdir -p
configure:3024: checking for gawk
configure:3040: found /usr/bin/gawk
configure:3051: result: gawk
configure:3062: checking whether /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/make/bin/make sets $(MAKE)
configure:3084: result: yes
configure:3113: checking whether /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/make/bin/make supports nested variables
configure:3130: result: yes
configure:3260: checking whether to enable maintainer-specific portions of Makefiles
configure:3269: result: no
configure:3296: checking for git
configure:3314: found /usr/local/bin/git
configure:3327: result: /usr/local/bin/git
configure:3400: checking whether /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/make/bin/make supports the include directive
configure:3415: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-opt-exec-2B5CBBC6/bin/external/rules_foreign_cc/toolchains/make/bin/make -f confmf.GNU && cat confinc.out
this is the am__doit target
configure:3418: $? = 0
configure:3437: result: yes (GNU style)
configure:3507: checking for gcc
configure:3534: result: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc
configure:3763: checking for C compiler version
configure:3772: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc --version >&5
aarch64-none-linux-gnu-gcc (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)) 9.2.1 20191025
Copyright (C) 2019 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
configure:3783: $? = 0
configure:3772: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc -v >&5
Using built-in specs.
COLLECT_GCC=/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc
COLLECT_LTO_WRAPPER=/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/external/gcc9_arm_aarch64/bin/../libexec/gcc/aarch64-none-linux-gnu/9.2.1/lto-wrapper
Target: aarch64-none-linux-gnu
Configured with: /tmp/dgboter/bbs/rhev-vm2--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-linux-gnu/build/src/gcc/configure --target=aarch64-none-linux-gnu --prefix= --with-sysroot=/aarch64-none-linux-gnu/libc --with-build-sysroot=/tmp/dgboter/bbs/rhev-vm2--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-linux-gnu/build/build-aarch64-none-linux-gnu/install//aarch64-none-linux-gnu/libc --with-bugurl=https://bugs.linaro.org/ --enable-gnu-indirect-function --enable-shared --disable-libssp --disable-libmudflap --enable-checking=release --enable-languages=c,c++,fortran --with-gmp=/tmp/dgboter/bbs/rhev-vm2--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-linux-gnu/build/build-aarch64-none-linux-gnu/host-tools --with-mpfr=/tmp/dgboter/bbs/rhev-vm2--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-linux-gnu/build/build-aarch64-none-linux-gnu/host-tools --with-mpc=/tmp/dgboter/bbs/rhev-vm2--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-linux-gnu/build/build-aarch64-none-linux-gnu/host-tools --with-isl=/tmp/dgboter/bbs/rhev-vm2--rhe6x86_64/buildbot/rhe6x86_64--aarch64-none-linux-gnu/build/build-aarch64-none-linux-gnu/host-tools --enable-fix-cortex-a53-843419 --with-pkgversion='GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10)'
Thread model: posix
gcc version 9.2.1 20191025 (GNU Toolchain for the A-profile Architecture 9.2-2019.12 (arm-9.10))
configure:3783: $? = 0
configure:3772: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc -V >&5
aarch64-none-linux-gnu-gcc: error: unrecognized command line option '-V'
aarch64-none-linux-gnu-gcc: fatal error: no input files
compilation terminated.
configure:3783: $? = 1
configure:3772: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc -qversion >&5
aarch64-none-linux-gnu-gcc: error: unrecognized command line option '-qversion'; did you mean '--version'?
aarch64-none-linux-gnu-gcc: fatal error: no input files
compilation terminated.
configure:3783: $? = 1
configure:3803: checking whether the C compiler works
configure:3825: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc -fPIC -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -std=c99 -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined -D__DATE__=redacted -D__TIMESTAMP__=redacted -D__TIME__=redacted -lstdc++ -lm -Wl,-no-as-needed -Wl,-z,relro,-z,now -Wall -pass-exit-codes -fuse-ld=gold -lpthread conftest.c >&5
configure:3829: $? = 0
configure:3877: result: yes
configure:3880: checking for C compiler default output file name
configure:3882: result: a.out
configure:3888: checking for suffix of executables
configure:3895: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc -o conftest -fPIC -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -std=c99 -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined -D__DATE__=redacted -D__TIMESTAMP__=redacted -D__TIME__=redacted -lstdc++ -lm -Wl,-no-as-needed -Wl,-z,relro,-z,now -Wall -pass-exit-codes -fuse-ld=gold -lpthread conftest.c >&5
configure:3899: $? = 0
configure:3921: result:
configure:3943: checking whether we are cross compiling
configure:3951: /root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/gcc9_arm_aarch64/bin/aarch64-none-linux-gnu-gcc -o conftest -fPIC -U_FORTIFY_SOURCE -fstack-protector -Wall -Wunused-but-set-parameter -Wno-free-nonheap-object -fno-omit-frame-pointer -std=c99 -no-canonical-prefixes -fno-canonical-system-headers -Wno-builtin-macro-redefined -D__DATE__=redacted -D__TIMESTAMP__=redacted -D__TIME__=redacted -lstdc++ -lm -Wl,-no-as-needed -Wl,-z,relro,-z,now -Wall -pass-exit-codes -fuse-ld=gold -lpthread conftest.c >&5
configure:3955: $? = 0
configure:3962: ./conftest
/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/external/com_github_gperftools_gperftools/configure: line 3964: ./conftest: cannot execute binary file: Exec format error
configure:3966: $? = 126
configure:3973: error: in `/root/.cache/bazel/_bazel_root/dbf178c3b436e7b271af34e78939cab5/execroot/bazel_simple_demo/bazel-out/k8-fastbuild/bin/external/com_github_gperftools_gperftools/gperftools_build.build_tmpdir':
configure:3975: error: cannot run C compiled programs.
If you meant to cross compile, use `--host'.
See `config.log' for more details
bazel toolchain configuration:
toolchain:
http_archive(
name = "gcc9_arm_aarch64",
build_file = "#bazel_build_file_repo//bazel:gcc_arm_aarch64.BUILD",
sha256 = "8dfe681531f0bd04fb9c53cf3c0a3368c616aa85d48938eebe2b516376e06a66",
strip_prefix = "gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu",
#urls = ["https://developer.arm.com/-/media/Files/downloads/gnu-a/9.2-2019.12/binrel/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz"],
urls = ["file:///root/src/cpp/toolchains/gcc-arm-9.2-2019.12-x86_64-aarch64-none-linux-gnu.tar.xz"],
)
platform config
constraint_setting(name = "gcc_version")
constraint_value(
name = "gcc_9",
constraint_setting = ":gcc_version",
)
constraint_value(
name = "gcc_10",
constraint_setting = ":gcc_version",
)
constraint_value(
name = "gcc_11",
constraint_setting = ":gcc_version",
)
platform(
name = "linux_gcc9_aarch64",
constraint_values = [
"#platforms//cpu:aarch64",
"#platforms//os:linux",
":gcc_9",
],
)
toolchain config
toolchain(
name = "gcc9_arm_aarch64_xcompile_toolchain",
exec_compatible_with = [
"#platforms//cpu:x86_64",
"#platforms//os:linux",
],
target_compatible_with = [
"#platforms//cpu:aarch64",
"#platforms//os:linux",
"//platforms:gcc_9",
],
toolchain = "#gcc9_arm_aarch64//:cc_toolchain",
toolchain_type = "#bazel_tools//tools/cpp:toolchain_type",
)
here is a very tiny demo to reproduce it:
[enter link description here][https://github.com/xiedeacc/bazel_simple_demo.git]

why bazel not search system include paths

The error is
.../demo.cc:5:10: fatal error: 'city.h' file not found
#include <city.h>
cityhash is installed by brew install cityhash.
city.h can be found in /usr/local/include.
And, it is actually in the search path of clang.
$ clang -E -xc++ - -v
Apple LLVM version 10.0.1 (clang-1001.0.46.3)
Target: x86_64-apple-darwin18.2.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.14.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -E -disable-free -disable-llvm-verifier -discard-value-names -main-file-name - -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -fno-strict-return -masm-verbose -munwind-tables -target-sdk-version=10.14 -target-cpu penryn -dwarf-column-info -debugger-tuning=lldb -target-linker-version 450.3 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.1 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk -I/usr/local/include -stdlib=libc++ -Wno-atomic-implicit-seq-cst -Wno-framework-include-private-from-public -Wno-atimport-in-framework-header -Wno-quoted-include-in-framework-header -fdeprecated-macro -fdebug-compilation-dir /Users/formath/git/mlp -ferror-limit 19 -fmessage-length 202 -stack-protector 1 -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fobjc-runtime=macosx-10.14.0 -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o - -x c++ -
clang -cc1 version 10.0.1 (clang-1001.0.46.3) default target x86_64-apple-darwin18.2.0
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include/c++/v1"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include/c++/v1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/10.0.1/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.14.sdk/System/Library/Frameworks (framework directory)
My Bazel version is 1.1.0.
I have saw a same question which is not fixed right now.
https://github.com/bazelbuild/bazel/issues/5391
As a workaround you could add a cc_library for a new_local_repository that wraps a view on /usr/local.
In your WORKSPACE file define a new_local_repository with the path attribute set to /usr/local and the build_file pointing to a BUILD file local to the workspace, for example:
# WORKSPACE
new_local_repository(
name = "usr_local",
path = "/usr/local",
build_file = "third_party/usr_local.BUILD",
)
The third_party/usr_local.BUILD file could have different rules for different libraries you want to wrap. For cityhash you could do something like this (I don't know the structure of the cityhash library, so I'm guessing here about the .so):
# third_party/usr_local.BUILD
cc_library(
name = "cityhash",
hdrs = glob(["include/cityhash/**"]),
srcs = [
"lib64/cityhash.so",
],
includes = [
"include/cityhash",
],
visibility = ["//visibility:public"],
)
Notice that the paths will be relative to the new local repository location (so in this case /usr/local).
Finally in your BUILD file you can reference the cityhash targetu using:
# BUILD
cc_binary(
name = "main",
srcs = [
"main.cc",
],
deps = [
"#usr_local//:cityhash",
],
)
Hope this helps.

std::terminate() linker error on a small clang project

I'm getting the following error on a project that links with clang (verbose output):
clang++ `/usr/local/Cellar/llvm/3.6.2/bin/llvm-config --cxxflags --ldflags --libs --system-libs` -lc++ -fno-rtti -o gen -lclangFrontendTool -lclangFrontend -lclangDriver -lclangSerialization -lclangCodeGen -lclangParse -lclangSema -lclangStaticAnalyzerFrontend -lclangStaticAnalyzerCheckers -lclangStaticAnalyzerCore -lclangAnalysis -lclangARCMigrate -lclangRewriteFrontend -lclangEdit -lclangAST -lclangLex -lclangBasic -I /usr/local/Cellar/llvm/3.6.2/include src/main.cpp -v
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin14.5.0
Thread model: posix
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx10.10.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -main-file-name main.cpp -mrelocation-model pic -pic-level 2 -mthread-model posix -mdisable-fp-elim -masm-verbose -munwind-tables -target-cpu core2 -target-linker-version 253.9 -v -dwarf-column-info -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2 -D __STDC_CONSTANT_MACROS -D __STDC_FORMAT_MACROS -D __STDC_LIMIT_MACROS -I /usr/local/Cellar/llvm/3.6.2/include -I /usr/local/Cellar/llvm/3.6.2/include -stdlib=libc++ -Wall -W -Wno-unused-parameter -Wwrite-strings -Wcast-qual -Wmissing-field-initializers -Wno-long-long -Wcovered-switch-default -Wnon-virtual-dtor -pedantic -std=c++11 -fdeprecated-macro -fdebug-compilation-dir /Users/samvv/Projects/ffi-enhanced/xfi-gen -ferror-limit 19 -fmessage-length 142 -fvisibility-inlines-hidden -stack-protector 1 -mstackrealign -fblocks -fno-rtti -fobjc-runtime=macosx-10.10.0 -fencode-extended-block-signature -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/9g/8c11l8090p524v5r7873yghc0000gn/T/main-918e82.o -x c++ src/main.cpp
clang -cc1 version 7.0.2 based upon LLVM 3.7.0svn default target x86_64-apple-darwin14.5.0
ignoring nonexistent directory "/usr/include/c++/v1"
ignoring duplicate directory "/usr/local/Cellar/llvm/3.6.2/include"
> #include "..." search starts here:
> #include <...> search starts here:
/usr/local/Cellar/llvm/3.6.2/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/usr/include
/System/Library/Frameworks (framework directory)
/Library/Frameworks (framework directory)
End of search list.
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -dynamic -arch x86_64 -macosx_version_min 10.10.0 -o gen -L/usr/local/Cellar/llvm/3.6.2/lib -search_paths_first -headerpad_max_install_names -lLLVMLTO -lLLVMObjCARCOpts -lLLVMLinker -lLLVMBitWriter -lLLVMIRReader -lLLVMAsmParser -lLLVMXCoreDisassembler -lLLVMXCoreCodeGen -lLLVMXCoreDesc -lLLVMXCoreInfo -lLLVMXCoreAsmPrinter -lLLVMSystemZDisassembler -lLLVMSystemZCodeGen -lLLVMSystemZAsmParser -lLLVMSystemZDesc -lLLVMSystemZInfo -lLLVMSystemZAsmPrinter -lLLVMSparcDisassembler -lLLVMSparcCodeGen -lLLVMSparcAsmParser -lLLVMSparcDesc -lLLVMSparcInfo -lLLVMSparcAsmPrinter -lLLVMR600CodeGen -lLLVMipo -lLLVMVectorize -lLLVMR600AsmParser -lLLVMR600Desc -lLLVMR600Info -lLLVMR600AsmPrinter -lLLVMPowerPCDisassembler -lLLVMPowerPCCodeGen -lLLVMPowerPCAsmParser -lLLVMPowerPCDesc -lLLVMPowerPCInfo -lLLVMPowerPCAsmPrinter -lLLVMNVPTXCodeGen -lLLVMNVPTXDesc -lLLVMNVPTXInfo -lLLVMNVPTXAsmPrinter -lLLVMMSP430CodeGen -lLLVMMSP430Desc -lLLVMMSP430Info -lLLVMMSP430AsmPrinter -lLLVMMipsDisassembler -lLLVMMipsCodeGen -lLLVMMipsAsmParser -lLLVMMipsDesc -lLLVMMipsInfo -lLLVMMipsAsmPrinter -lLLVMHexagonDisassembler -lLLVMHexagonCodeGen -lLLVMHexagonDesc -lLLVMHexagonInfo -lLLVMCppBackendCodeGen -lLLVMCppBackendInfo -lLLVMARMDisassembler -lLLVMARMCodeGen -lLLVMARMAsmParser -lLLVMARMDesc -lLLVMARMInfo -lLLVMARMAsmPrinter -lLLVMAArch64Disassembler -lLLVMAArch64CodeGen -lLLVMAArch64AsmParser -lLLVMAArch64Desc -lLLVMAArch64Info -lLLVMAArch64AsmPrinter -lLLVMAArch64Utils -lLLVMTableGen -lLLVMDebugInfo -lLLVMOption -lLLVMX86Disassembler -lLLVMX86AsmParser -lLLVMX86CodeGen -lLLVMSelectionDAG -lLLVMAsmPrinter -lLLVMX86Desc -lLLVMMCDisassembler -lLLVMX86Info -lLLVMX86AsmPrinter -lLLVMX86Utils -lLLVMMCJIT -lLLVMLineEditor -lLLVMInstrumentation -lLLVMInterpreter -lLLVMExecutionEngine -lLLVMRuntimeDyld -lLLVMCodeGen -lLLVMScalarOpts -lLLVMProfileData -lLLVMObject -lLLVMMCParser -lLLVMBitReader -lLLVMInstCombine -lLLVMTransformUtils -lLLVMipa -lLLVMAnalysis -lLLVMTarget -lLLVMMC -lLLVMCore -lLLVMSupport -lcurses -lpthread -lz -lm -lc++ -lclangFrontendTool -lclangFrontend -lclangDriver -lclangSerialization -lclangCodeGen -lclangParse -lclangSema -lclangStaticAnalyzerFrontend -lclangStaticAnalyzerCheckers -lclangStaticAnalyzerCore -lclangAnalysis -lclangARCMigrate -lclangRewriteFrontend -lclangEdit -lclangAST -lclangLex -lclangBasic /var/folders/9g/8c11l8090p524v5r7873yghc0000gn/T/main-918e82.o -lc++ -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../lib/clang/7.0.2/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
"std::terminate()", referenced from:
___clang_call_terminate in main-918e82.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: *** [all] Error 1
According to this question, linking with -lc++ should fix the issue, but in my case it doesn't. I've managed to reduce the issue down to this flag, which is added by llvm-config --ldflags:
-L/usr/local/Cellar/llvm/3.6.2/lib
Any idea why this flag is causing the error and how to fix it?
I found the problem: I was linking to non-default stdlibs using -L/usr/local/opt/llvm/lib/. By prepending -L/usr/lib, it made sure that OS X's default stdlib goes above the homebrewn version.

Where is my symbol

ALL,
I'm trying to manually compile wxWidgets library - trying to add a new file source to it.
I successfully did compilation:
/Users/AlenaKorot/wxWidgets3.0/buildMac/bk-deps g++ -mmacosx-version-min=10.6 -c -o coredll_desktopenvcmn.o -I./.pch/wxprec_coredll -D__WXOSX_COCOA__ -DWXBUILDING -I/Users/AlenaKorot/wxWidgets3.0/buildMac/src/tiff/libtiff -I../src/tiff/libtiff -I../src/jpeg -I../src/png -I../src/regex -DWXUSINGDLL -DWXMAKINGDLL_CORE -DwxUSE_BASE=0 -dynamic -fPIC -DPIC -Wall -Wundef -Wunused-parameter -Wno-ctor-dtor-privacy -Woverloaded-virtual -Wno-deprecated-declarations -D_FILE_OFFSET_BITS=64 -I/Users/AlenaKorot/wxWidgets3.0/buildMac/lib/wx/include/osx_cocoa-unicode-3.0 -I../include -arch i386 -DWX_PRECOMP -ggdb -O0 -arch i386 -fno-common -fvisibility=hidden -fvisibility-inlines-hidden ../src/common/desktopenvcmn.cpp
/Users/AlenaKorot/wxWidgets3.0/buildMac/bk-deps g++ -mmacosx-version-min=10.6 -c -o coredll_osx_cocoa_desktopenv.o -I./.pch/wxprec_coredll -D__WXOSX_COCOA__ -DWXBUILDING -I/Users/AlenaKorot/wxWidgets3.0/buildMac/src/tiff/libtiff -I../src/tiff/libtiff -I../src/jpeg -I../src/png -I../src/regex -DWXUSINGDLL -DWXMAKINGDLL_CORE -DwxUSE_BASE=0 -dynamic -fPIC -DPIC -D_FILE_OFFSET_BITS=64 -I/Users/AlenaKorot/wxWidgets3.0/buildMac/lib/wx/include/osx_cocoa-unicode-3.0 -I../include -arch i386 -ggdb -O0 -arch i386 -fvisibility=hidden -fvisibility-inlines-hidden ../src/osx/cocoa/desktopenv.mm
And linking:
g++ -mmacosx-version-min=10.6 -dynamiclib -single_module -headerpad_max_install_names -o /Users/AlenaKorot/wxWidgets3.0/buildMac/lib/libwx_osx_cocoau_core-3.0.0.3.0.dylib coredll_desktopenvcmn.o coredll_osx_cocoa_desktopenv.o coredll_event.o coredll_fs_mem.o coredll_msgout.o coredll_utilscmn.o coredll_osx_cocoa_utils.o coredll_artmac.o coredll_osx_brush.o coredll_dialog_osx.o coredll_osx_fontutil.o coredll_osx_imaglist.o coredll_osx_minifram.o coredll_nonownedwnd_osx.o coredll_osx_palette.o coredll_osx_pen.o coredll_toplevel_osx.o coredll_uiaction_osx.o coredll_utils_osx.o coredll_window_osx.o coredll_core_bitmap.o coredll_core_colour.o coredll_core_dcmemory.o coredll_core_display.o coredll_core_fontenum.o coredll_hid.o coredll_printmac.o coredll_core_timer.o coredll_utilsexc_cf.o coredll_apptraits.o coredll_anybutton_osx.o coredll_bmpbuttn_osx.o coredll_button_osx.o coredll_checkbox_osx.o coredll_checklst_osx.o coredll_choice_osx.o coredll_combobox_osx.o coredll_dnd_osx.o coredll_gauge_osx.o coredll_listbox_osx.o coredll_menu_osx.o coredll_menuitem_osx.o coredll_notebook_osx.o coredll_printdlg_osx.o coredll_radiobox_osx.o coredll_radiobut_osx.o coredll_scrolbar_osx.o coredll_slider_osx.o coredll_spinbutt_osx.o coredll_srchctrl_osx.o coredll_statbox_osx.o coredll_statline_osx.o coredll_stattext_osx.o coredll_textentry_osx.o coredll_textctrl_osx.o coredll_tglbtn_osx.o coredll_toolbar_osx.o coredll_webkit.o coredll_colordlgosx.o coredll_fontdlgosx.o coredll_osx_accel.o coredll_carbon_clipbrd.o coredll_carbon_cursor.o coredll_carbon_fontdlg.o coredll_carbon_gdiobj.o coredll_carbon_icon.o coredll_carbon_app.o coredll_carbon_combobox.o coredll_carbon_control.o coredll_carbon_dataobj.o coredll_carbon_dcclient.o coredll_carbon_dcprint.o coredll_carbon_dcscreen.o coredll_glgrab.o coredll_carbon_graphics.o coredll_carbon_font.o coredll_carbon_frame.o coredll_carbon_mdi.o coredll_carbon_metafile.o coredll_carbon_overlay.o coredll_carbon_popupwin.o coredll_carbon_renderer.o coredll_carbon_settings.o coredll_statbrma.o coredll_carbon_region.o coredll_utilscocoa.o coredll_generic_caret.o coredll_clrpickerg.o coredll_collpaneg.o coredll_colrdlgg.o coredll_dirdlgg.o coredll_generic_fdrepdlg.o coredll_filedlgg.o coredll_filepickerg.o coredll_fontdlgg.o coredll_fontpickerg.o coredll_generic_listctrl.o coredll_prntdlgg.o coredll_generic_statusbr.o coredll_generic_textmeasure.o coredll_cocoa_anybutton.o coredll_osx_cocoa_button.o coredll_osx_cocoa_checkbox.o coredll_osx_cocoa_choice.o coredll_osx_cocoa_colour.o coredll_osx_cocoa_combobox.o coredll_osx_cocoa_dialog.o coredll_osx_cocoa_dirdlg.o coredll_cocoa_dnd.o coredll_osx_cocoa_evtloop.o coredll_osx_cocoa_filedlg.o coredll_osx_cocoa_gauge.o coredll_osx_cocoa_listbox.o coredll_osx_cocoa_menu.o coredll_osx_cocoa_menuitem.o coredll_osx_cocoa_msgdlg.o coredll_cocoa_nonownedwnd.o coredll_osx_cocoa_notebook.o coredll_osx_cocoa_radiobut.o coredll_preferences.o coredll_cocoa_printdlg.o coredll_osx_cocoa_scrolbar.o coredll_osx_cocoa_slider.o coredll_osx_cocoa_spinbutt.o coredll_cocoa_srchctrl.o coredll_osx_cocoa_statbox.o coredll_cocoa_statline.o coredll_osx_cocoa_stattext.o coredll_osx_cocoa_textctrl.o coredll_cocoa_tglbtn.o coredll_osx_cocoa_toolbar.o coredll_osx_cocoa_tooltip.o coredll_osx_cocoa_window.o coredll_accelcmn.o coredll_accesscmn.o coredll_anidecod.o coredll_affinematrix2d.o coredll_appcmn.o coredll_artprov.o coredll_artstd.o coredll_arttango.o coredll_bmpbase.o coredll_bmpbtncmn.o coredll_bookctrl.o coredll_btncmn.o coredll_cairo.o coredll_checkboxcmn.o coredll_checklstcmn.o coredll_choiccmn.o coredll_clipcmn.o coredll_clrpickercmn.o coredll_colourcmn.o coredll_colourdata.o coredll_combocmn.o coredll_cmdproc.o coredll_cmndata.o coredll_containr.o coredll_cshelp.o coredll_ctrlcmn.o coredll_ctrlsub.o coredll_dcbase.o coredll_dcbufcmn.o coredll_dcgraph.o coredll_dcsvg.o coredll_dirctrlcmn.o coredll_dlgcmn.o coredll_dndcmn.o coredll_dobjcmn.o coredll_docmdi.o coredll_docview.o coredll_dpycmn.o coredll_dseldlg.o coredll_effects.o coredll_fddlgcmn.o coredll_filectrlcmn.o coredll_filehistorycmn.o coredll_filepickercmn.o coredll_fontpickercmn.o coredll_fldlgcmn.o coredll_fontcmn.o coredll_fontdata.o coredll_graphicc.o coredll_fontenumcmn.o coredll_fontmap.o coredll_fontutilcmn.o coredll_framecmn.o coredll_gaugecmn.o coredll_gbsizer.o coredll_gdicmn.o coredll_geometry.o coredll_gifdecod.o coredll_graphcmn.o coredll_headercolcmn.o coredll_headerctrlcmn.o coredll_helpbase.o coredll_iconbndl.o coredll_imagall.o coredll_imagbmp.o coredll_image.o coredll_imagfill.o coredll_imaggif.o coredll_imagiff.o coredll_imagjpeg.o coredll_imagpcx.o coredll_imagpng.o coredll_imagpnm.o coredll_imagtga.o coredll_imagtiff.o coredll_imagxpm.o coredll_layout.o coredll_lboxcmn.o coredll_listctrlcmn.o coredll_markupparser.o coredll_matrix.o coredll_menucmn.o coredll_modalhook.o coredll_mousemanager.o coredll_nbkbase.o coredll_overlaycmn.o coredll_ownerdrwcmn.o coredll_paper.o coredll_panelcmn.o coredll_persist.o coredll_pickerbase.o coredll_popupcmn.o coredll_preferencescmn.o coredll_prntbase.o coredll_quantize.o coredll_radiobtncmn.o coredll_radiocmn.o coredll_rearrangectrl.o coredll_rendcmn.o coredll_rgncmn.o coredll_scrolbarcmn.o coredll_settcmn.o coredll_sizer.o coredll_slidercmn.o coredll_spinbtncmn.o coredll_spinctrlcmn.o coredll_srchcmn.o coredll_statbar.o coredll_statbmpcmn.o coredll_statboxcmn.o coredll_statlinecmn.o coredll_stattextcmn.o coredll_stockitem.o coredll_tbarbase.o coredll_textcmn.o coredll_textentrycmn.o coredll_textmeasurecmn.o coredll_toplvcmn.o coredll_treebase.o coredll_uiactioncmn.o coredll_valgen.o coredll_validate.o coredll_valtext.o coredll_valnum.o coredll_wincmn.o coredll_windowid.o coredll_wrapsizer.o coredll_xpmdecod.o coredll_busyinfo.o coredll_buttonbar.o coredll_choicdgg.o coredll_choicbkg.o coredll_combog.o coredll_dcpsg.o coredll_dirctrlg.o coredll_dragimgg.o coredll_filectrlg.o coredll_headerctrlg.o coredll_generic_infobar.o coredll_listbkg.o coredll_logg.o coredll_markuptext.o coredll_msgdlgg.o coredll_numdlgg.o coredll_progdlgg.o coredll_preferencesg.o coredll_printps.o coredll_renderg.o coredll_richmsgdlgg.o coredll_scrlwing.o coredll_selstore.o coredll_spinctlg.o coredll_splitter.o coredll_srchctlg.o coredll_statbmpg.o coredll_stattextg.o coredll_textdlgg.o coredll_tipwin.o coredll_toolbkg.o coredll_treectlg.o coredll_treebkg.o coredll_vlbox.o coredll_vscroll.o coredll_xmlreshandler.o -L/Users/AlenaKorot/wxWidgets3.0/buildMac/lib -L/Users/AlenaKorot/wxWidgets3.0/buildMac/lib -install_name /usr/local/lib/libwx_osx_cocoau_core-3.0.0.dylib -compatibility_version 4.0 -current_version 4.0 -arch i386 -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL -lwxtiff-3.0 -lwxjpeg-3.0 -lwxpng-3.0 -framework WebKit -lwxregexu-3.0 -arch i386 -framework IOKit -framework Carbon -framework Cocoa -framework AudioToolbox -framework System -framework OpenGL -lz -lpthread -liconv -lwx_baseu-3.0 -lz -lpthread -liconv
Now, here is the strange thing:
Alena-Korots-MacBook:buildMac AlenaKorot$ nm -g coredll_osx_cocoa_desktopenv.o | grep -i desktopenv000001ca T __ZN12wxDesktopEnv15MoveFileToTrashERK8wxString
00019dc8 S __ZN12wxDesktopEnv15MoveFileToTrashERK8wxString.eh
00000444 T __ZN12wxDesktopEnv20MoveDirectoryToTrashERK8wxString
00019df8 S __ZN12wxDesktopEnv20MoveDirectoryToTrashERK8wxString.eh
000000aa T __ZN12wxDesktopEnv20MoveFileToRecycleBinERK8wxString
00019c10 S __ZN12wxDesktopEnv20MoveFileToRecycleBinERK8wxString.eh
0000015a T __ZN12wxDesktopEnvC1Ev
00000000 T __ZN12wxDesktopEnvC2Ev
00000070 T __ZN12wxDesktopEnvD0Ev
00000036 T __ZN12wxDesktopEnvD1Ev
00000190 T __ZN12wxDesktopEnvD2Ev
U __ZN16wxDesktopEnvBase20MoveFileToRecycleBinERK8wxString
0001976c S __ZN16wxDesktopEnvBaseC2Ev
00019ba0 S __ZTI12wxDesktopEnv
U __ZTI16wxDesktopEnvBase
00019b5a S __ZTS12wxDesktopEnv
00019b88 S __ZTV12wxDesktopEnv
U __ZTV16wxDesktopEnvBase
In the object file there are wxDesktopEnv constructor and wxDesktopEnvBase constructor. However:
Alena-Korots-MacBook:lib AlenaKorot$ nm -g libwx_osx_cocoau_core-3.0.dylib | grep -i desktop
Alena-Korots-MacBook:lib AlenaKorot$
those symbols are missing from the dylib.
As you can see I'm linking against the appropriate *.o files.
What do I do to fix it? And where my symbols are?
Thank you.
P.S.: Sorry for such a long post with a bit code quote.
Problem solved.
I tried to do the build with mixed directories.
Sorry for the noise.