Kaldi installation on Majave: Compiler error - xcode

I am tryting to install Kaldi, for which I installed relevant things (such as gcc, automakers, autoconf, etc...).
However, because of compiling errors, I could not go further...
The error message was as follows...
(base) C-MacBook-Pro:tools ninackjeong$ extras/check_dependencies.sh
extras/check_dependencies.sh: all OK.
(base) C-MacBook-Pro:tools ninackjeong$ make -j 6
extras/check_dependencies.sh
cd sph2pipe_v2.5/ && \
x86_64-apple-darwin13.4.0-clang -o sph2pipe *.c -lm
if [ -d "" ]; then \
cp -p "/cub-1.8.0.zip" .; \
else \
wget -T 10 -t 3 -O cub-1.8.0.zip https://github.com/NVlabs/cub/archive/1.8.0.zip; \
fi
--2020-02-03 09:44:29-- https://github.com/NVlabs/cub/archive/1.8.0.zip
Resolving github.com (github.com)... extras/check_dependencies.sh: all OK.
tar xojf sctk-2.4.10-20151007-1312Z.tar.bz2 || \
tar --exclude '*NONE*html' -xvojf sctk-2.4.10-20151007-1312Z.tar.bz2
cd openfst-1.6.7/ && \
./configure --prefix=`pwd` --enable-static --enable-shared --enable-far --enable-ngram-fsts CXX="x86_64-apple-darwin13.4.0-clang++" CXXFLAGS="-march=core2 -mtune=haswell -mssse3 -ftree-vectorize -fPIC -fPIE -fstack-protector-strong -O2 -pipe -stdlib=libc++ -fvisibility-inlines-hidden -std=c++14 -fmessage-length=0 " LDFLAGS="-Wl,-pie -Wl,-headerpad_max_install_names -Wl,-dead_strip_dylibs" LIBS="-ldl"
192.30.255.112
Connecting to github.com (github.com)|192.30.255.112|:443... file_headers.c:149:24: warning: format specifies type 'int' but the argument has type 'off_t' (aka 'long long') [-Wformat]
inpname, sampcount, statbuf.st_size );
^~~~~~~~~~~~~~~
file_headers.c:579:1: warning: type specifier missing, defaults to 'int' [-Wimplicit-int]
ConvertToIeeeExtended(num, bytes)
^
file_headers.c:629:1: warning: control reaches end of non-void function [-Wreturn-type]
}
^
3 warnings generated.
connected.
shorten_x.c:187:29: warning: too many arguments in call to 'word_get'
gbuffer = word_get(fpin);
~~~~~~~~ ^
shorten_x.c:325:22: warning: implicit declaration of function 'pcm2alaw' is invalid in C99 [-Wimplicit-function-declaration]
*writebufp++ = pcm2alaw( ulaw2pcm[data0[i]] );
^
shorten_x.c:381:24: warning: implicit declaration of function 'pcm2ulaw' is invalid in C99 [-Wimplicit-function-declaration]
*writebufp++ = pcm2ulaw( data0[i] );
^
HTTP request sent, awaiting response... 3 warnings generated.
sph2pipe.c:191:18: warning: implicit declaration of function 'getopt' is invalid in C99 [-Wimplicit-function-declaration]
while (( i = getopt( ac, av, "daupf:c:t:s:h:" )) != EOF )
^
sph2pipe.c:530:11: warning: assigning to 'unsigned char *' from 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
cptr = inpbuf;
^ ~~~~~~
sph2pipe.c:545:8: warning: assigning to 'unsigned char *' from 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
cptr = inpbuf;
^ ~~~~~~
sph2pipe.c:547:15: warning: assigning to 'unsigned char *' from 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
wptr = cptr = outbuf;
^ ~~~~~~
sph2pipe.c:547:8: warning: assigning to 'char *' from 'unsigned char *' converts between pointers to integer types with different sign [-Wpointer-sign]
wptr = cptr = outbuf;
^ ~~~~~~~~~~~~~
sph2pipe.c:561:11: warning: assigning to 'unsigned char *' from 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
cptr = inpbuf;
^ ~~~~~~
sph2pipe.c:568:11: warning: assigning to 'unsigned char *' from 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
cptr = inpbuf;
^ ~~~~~~
sph2pipe.c:616:7: warning: assigning to 'unsigned char *' from 'char *' converts between pointers to integer types with different sign [-Wpointer-sign]
cptr = inpbuf;
^ ~~~~~~
8 warnings generated.
ld: warning: ld: warning: ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libm.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libm.tbd
ignoring file /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd, file was built for unsupported file format ( 0x2D 0x2D 0x2D 0x20 0x21 0x74 0x61 0x70 0x69 0x2D 0x74 0x62 0x64 0x2D 0x76 0x33 ) which is not the architecture being linked (x86_64): /Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/lib/libSystem.tbd
Undefined symbols for architecture x86_64:
"___sprintf_chk", referenced from:
_writeSphHeader in file_headers-d8b2d2.o
"___stack_chk_fail", referenced from:
_readSphHeader in file_headers-d8b2d2.o
_writeSphHeader in file_headers-d8b2d2.o
_writeAIFFHeader in file_headers-d8b2d2.o
"___stack_chk_guard", referenced from:
_readSphHeader in file_headers-d8b2d2.o
_writeSphHeader in file_headers-d8b2d2.o
_writeAIFFHeader in file_headers-d8b2d2.o
"___stderrp", referenced from:
_readSphHeader in file_headers-d8b2d2.o
_writeSphHeader in file_headers-d8b2d2.o
_writeAUHeader in file_headers-d8b2d2.o
_writeRIFFHeader in file_headers-d8b2d2.o
_writeAIFFHeader in file_headers-d8b2d2.o
_word_get in shorten_x-0926aa.o
_init_offset in shorten_x-0926aa.o
...
"___stdoutp", referenced from:
_doConversion in sph2pipe-035023.o
"___strncpy_chk", referenced from:
_writeSphHeader in file_headers-d8b2d2.o
"_exit", referenced from:
_writeSphHeader in file_headers-d8b2d2.o
_writeAUHeader in file_headers-d8b2d2.o
_writeRIFFHeader in file_headers-d8b2d2.o
_writeAIFFHeader in file_headers-d8b2d2.o
_fwrite_type in shorten_x-0926aa.o
_shortenXtract in shorten_x-0926aa.o
_main in sph2pipe-035023.o
...
"_fclose", referenced from:
_readSphHeader in file_headers-d8b2d2.o
_doConversion in sph2pipe-035023.o
"_fileno", referenced from:
_readSphHeader in file_headers-d8b2d2.o
"_floor", referenced from:
_ConvertToIeeeExtended in file_headers-d8b2d2.o
"_fopen", referenced from:
_readSphHeader in file_headers-d8b2d2.o
_doConversion in sph2pipe-035023.o
"_fprintf", referenced from:
_readSphHeader in file_headers-d8b2d2.o
_writeSphHeader in file_headers-d8b2d2.o
_writeAUHeader in file_headers-d8b2d2.o
_writeRIFFHeader in file_headers-d8b2d2.o
_writeAIFFHeader in file_headers-d8b2d2.o
_word_get in shorten_x-0926aa.o
_init_offset in shorten_x-0926aa.o
...
"_fputs", referenced from:
_main in sph2pipe-035023.o
"_fread", referenced from:
_readSphHeader in file_headers-d8b2d2.o
_word_get in shorten_x-0926aa.o
_copySamples in sph2pipe-035023.o
"_free", referenced from:
_fwrite_type in shorten_x-0926aa.o
"_frexp", referenced from:
_ConvertToIeeeExtended in file_headers-d8b2d2.o
"_fseek", referenced from:
_readSphHeader in file_headers-d8b2d2.o
_copySamples in sph2pipe-035023.o
"_fstat$INODE64", referenced from:
_readSphHeader in file_headers-d8b2d2.o
"_fwrite", referenced from:
_writeSphHeader in file_headers-d8b2d2.o
_writeAUHeader in file_headers-d8b2d2.o
_writeRIFFHeader in file_headers-d8b2d2.o
_writeAIFFHeader in file_headers-d8b2d2.o
_fwrite_type in shorten_x-0926aa.o
_copySamples in sph2pipe-035023.o
(maybe you meant: _fwrite_type)
"_getc", referenced from:
_shortenXtract in shorten_x-0926aa.o
"_getopt", referenced from:
_getUserOpts in sph2pipe-035023.o
"_index", referenced from:
_getUserOpts in sph2pipe-035023.o
"_ldexp", referenced from:
_ConvertToIeeeExtended in file_headers-d8b2d2.o
"_malloc", referenced from:
_long2d in shorten_x-0926aa.o
_fwrite_type in shorten_x-0926aa.o
_shortenXtract in shorten_x-0926aa.o
_main in sph2pipe-035023.o
"_optarg", referenced from:
_getUserOpts in sph2pipe-035023.o
"_optind", referenced from:
_getUserOpts in sph2pipe-035023.o
"_putc", referenced from:
_shortenXtract in shorten_x-0926aa.o
"_sscanf", referenced from:
_readSphHeader in file_headers-d8b2d2.o
_writeSphHeader in file_headers-d8b2d2.o
_getUserOpts in sph2pipe-035023.o
"_strcmp", referenced from:
_readSphHeader in file_headers-d8b2d2.o
_writeSphHeader in file_headers-d8b2d2.o
_copylong in file_headers-d8b2d2.o
_copyshort in file_headers-d8b2d2.o
_fwrite_type in shorten_x-0926aa.o
_getUserOpts in sph2pipe-035023.o
_doConversion in sph2pipe-035023.o
...
"_strdup", referenced from:
_readSphHeader in file_headers-d8b2d2.o
_getUserOpts in sph2pipe-035023.o
"_strlen", referenced from:
_readSphHeader in file_headers-d8b2d2.o
"_strncasecmp", referenced from:
_getUserOpts in sph2pipe-035023.o
"_strncmp", referenced from:
_readSphHeader in file_headers-d8b2d2.o
_writeSphHeader in file_headers-d8b2d2.o
"_strtok", referenced from:
_readSphHeader in file_headers-d8b2d2.o
_writeSphHeader in file_headers-d8b2d2.o
"_swab", referenced from:
_copyshort in file_headers-d8b2d2.o
_fwrite_type in shorten_x-0926aa.o
_copySamples in sph2pipe-035023.o
ld: symbol(s) not found for architecture x86_64
clang-4.0: error: linker command failed with exit code 1 (use -v to see invocation)
make: *** [sph2pipe_v2.5/sph2pipe] Error 1
make: *** Waiting for unfinished jobs....
302 Found
Location: https://codeload.github.com/NVlabs/cub/zip/1.8.0 [following]
--2020-02-03 09:44:30-- https://codeload.github.com/NVlabs/cub/zip/1.8.0
Resolving codeload.github.com (codeload.github.com)... 192.30.255.121
Connecting to codeload.github.com (codeload.github.com)|192.30.255.121|:443... connected.
HTTP request sent, awaiting response... checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a thread-safe mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
200 OK
Length: 602396 (588K) [application/zip]
Saving to: ‘cub-1.8.0.zip’
cub-1.8.0.zip 0%[ ] 0 --.-KB/s checking for style of include used by make... GNU
checking for gcc... x86_64-apple-darwin13.4.0-clang
cub-1.8.0.zip 37%[======> ] 220.43K 1.07MB/s checking whether the C compiler works... no
configure: error: in `/Users/ninackjeong/kaldi/tools/openfst-1.6.7':
configure: error: C compiler cannot create executables
See `config.log' for more details
make: *** [openfst-1.6.7/Makefile] Error 77
cub-1.8.0.zip 100%[===================>] 588.28K 1.93MB/s in 0.3s
2020-02-03 09:44:30 (1.93 MB/s) - ‘cub-1.8.0.zip’ saved [602396/602396]
unzip -oq cub-1.8.0.zip
rm -f cub
ln -s cub-1.8.0 cub
rm -rf sctk && ln -s sctk-2.4.10 sctk
When I typed more specific command "make CXX=g++-4.8," the error message was follows. It seems that this needs g++ 4.8.3., Apple Xcode 5.0 or clang 3.3, but mine are gcc and gcc#4.9 (installed through brew) and my Xcode and clang are far beyond 5.0 and 3.3. If these are problems, I would like to ask how to install them (I tried to install g++ 4.8.3, but "gcc48" seems not to be provided on brew, and I could not find Xcode 5.0 installation file...).
I do apologize for any inconvenience, and I really appreciate all your time!
<< gcc -v check >>
(base) C-MacBook-Pro:~ ninackjeong$ gcc -v
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple clang version 11.0.0 (clang-1100.0.33.17)
Target: x86_64-apple-darwin18.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
<< possible problems when the more specific command was put>>
(base) C-MacBook-Pro:tools ninackjeong$ make CXX=g++-4.8
extras/check_dependencies.sh
extras/check_dependencies.sh: Compiler 'g++-4.8' is not installed.
extras/check_dependencies.sh: You need g++ >= 4.8.3, Apple Xcode >= 5.0 or clang >= 3.3.
extras/check_dependencies.sh: The following prerequisites are missing; install them first:
g++
make: *** [check_required_programs] Error 1

Related

GCC error: Undefined symbols for architecture x86_64

Today I experimented with GCC/G++ :(
I was not sure which c++ standards were installed (completely new to c++), so I updated gcc to the latest version with brew (brew install gcc --HEAD) but now it seems that the latest version is unfortunately unstable for my setup.
clang version before: Apple clang version 12.0.0 (clang-1200.0.32.27)
clang version after: Apple clang version 12.0.0 (clang-1200.0.32.27) but with following error:
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
OS: macOS#11.0.1
Does anyone knows how to solve this? I am still able to use g++, only gcc is not working at all, no matter of -std= flag or not. Is installing the latest stable version a proper solution or will this make it worse ;-) ?
gcc helloworld.cc -v -o out
Apple clang version 12.0.0 (clang-1200.0.32.27)
Target: x86_64-apple-darwin20.1.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/c++/v1"
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang" -cc1 -triple x86_64-apple-macosx11.0.0 -Wdeprecated-objc-isa-usage -Werror=deprecated-objc-isa-usage -Werror=implicit-function-declaration -emit-obj -mrelax-all -disable-free -disable-llvm-verifier -discard-value-names -main-file-name helloworld.cc -mrelocation-model pic -pic-level 2 -mthread-model posix -mframe-pointer=all -fno-strict-return -masm-verbose -munwind-tables -target-sdk-version=11.0 -target-cpu penryn -dwarf-column-info -debugger-tuning=lldb -target-linker-version 609.6 -v -resource-dir /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0 -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -I/usr/local/include -stdlib=libc++ -internal-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1 -internal-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include -internal-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include -internal-externc-isystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include -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 -fdeprecated-macro -fdebug-compilation-dir "/Users/user/x/y/z/zz/zzz" -ferror-limit 19 -fmessage-length 167 -stack-protector 1 -fstack-check -mdarwin-stkchk-strong-link -fblocks -fencode-extended-block-signature -fregister-global-dtors-with-atexit -fgnuc-version=4.2.1 -fobjc-runtime=macosx-11.0.0 -fcxx-exceptions -fexceptions -fmax-type-align=16 -fdiagnostics-show-option -fcolor-diagnostics -o /var/folders/rq/6cbshbgd2bdbpl3tqf7cg27c0000gn/T/helloworld-3e60f0.o -x c++ helloworld.cc
clang -cc1 version 12.0.0 (clang-1200.0.32.27) default target x86_64-apple-darwin20.1.0
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/local/include"
ignoring nonexistent directory "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/Library/Frameworks"
#include "..." search starts here:
#include <...> search starts here:
/usr/local/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/../include/c++/v1
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include
/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include
/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks (framework directory)
End of search list.
"/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld" -demangle -lto_library /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/libLTO.dylib -no_deduplicate -dynamic -arch x86_64 -platform_version macos 11.0.0 11.0 -syslibroot /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk -o out -L/usr/local/lib /var/folders/rq/6cbshbgd2bdbpl3tqf7cg27c0000gn/T/helloworld-3e60f0.o -lSystem /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/lib/clang/12.0.0/lib/darwin/libclang_rt.osx.a
Undefined symbols for architecture x86_64:
"std::__1::locale::use_facet(std::__1::locale::id&) const", referenced from:
std::__1::ctype<char> const& std::__1::use_facet<std::__1::ctype<char> >(std::__1::locale const&) in helloworld-3e60f0.o
"std::__1::ios_base::getloc() const", referenced from:
std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const in helloworld-3e60f0.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::__init(unsigned long, char)", referenced from:
std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::basic_string(unsigned long, char) in helloworld-3e60f0.o
"std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char> >::~basic_string()", referenced from:
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in helloworld-3e60f0.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::put(char)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in helloworld-3e60f0.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::flush()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::endl<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in helloworld-3e60f0.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::sentry(std::__1::basic_ostream<char, std::__1::char_traits<char> >&)", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in helloworld-3e60f0.o
"std::__1::basic_ostream<char, std::__1::char_traits<char> >::sentry::~sentry()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in helloworld-3e60f0.o
"std::__1::cout", referenced from:
_main in helloworld-3e60f0.o
"std::__1::ctype<char>::id", referenced from:
std::__1::ctype<char> const& std::__1::use_facet<std::__1::ctype<char> >(std::__1::locale const&) in helloworld-3e60f0.o
"std::__1::locale::~locale()", referenced from:
std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const in helloworld-3e60f0.o
"std::__1::ios_base::__set_badbit_and_consider_rethrow()", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in helloworld-3e60f0.o
"std::__1::ios_base::clear(unsigned int)", referenced from:
std::__1::ios_base::setstate(unsigned int) in helloworld-3e60f0.o
"std::terminate()", referenced from:
___clang_call_terminate in helloworld-3e60f0.o
"___cxa_begin_catch", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in helloworld-3e60f0.o
___clang_call_terminate in helloworld-3e60f0.o
"___cxa_call_unexpected", referenced from:
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >::ostreambuf_iterator(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in helloworld-3e60f0.o
"___cxa_end_catch", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in helloworld-3e60f0.o
"___gxx_personality_v0", referenced from:
std::__1::basic_ostream<char, std::__1::char_traits<char> >& std::__1::__put_character_sequence<char, std::__1::char_traits<char> >(std::__1::basic_ostream<char, std::__1::char_traits<char> >&, char const*, unsigned long) in helloworld-3e60f0.o
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> > std::__1::__pad_and_output<char, std::__1::char_traits<char> >(std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >, char const*, char const*, char const*, std::__1::ios_base&, char) in helloworld-3e60f0.o
std::__1::ostreambuf_iterator<char, std::__1::char_traits<char> >::ostreambuf_iterator(std::__1::basic_ostream<char, std::__1::char_traits<char> >&) in helloworld-3e60f0.o
std::__1::basic_ios<char, std::__1::char_traits<char> >::widen(char) const in helloworld-3e60f0.o
Dwarf Exception Unwind Info (__eh_frame) in helloworld-3e60f0.o
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)
You cannot compile C++ code with gcc or clang. You need to use a C++ compiler, such as clang++ or g++.
Check what you are actually running. If you use gcc file.c, at least run:
type gcc
to se what you are running. If it's /bin/something or /usr/bin/something or /Applications/something, it's from Apple. If it's /usr/local/something it's homebrew.
If you are using homebrew, firstly check you are doing everything right by running:
brew doctor
And secondly, make sure your PATH starts with /usr/local/bin which is where homebrew puts its binaries:
export PATH=/usr/local/bin:$PATH

How to solve linker command failed when building my SDL2 project in CLION MAC?

I am trying to switch to CLion IDE in my Mac. My CMakeLists.txt works but while building the project, I get linker command failed error. I first tried with FindSDL2 and FindSDL2_IMAGE, but I removed it because I got the same error both with and without. I have a doubt about the SDL_LIBRARY and SDL2_IMAGE_LIBRARY, where it is declared?.
CMakeLists.txt
cmake_minimum_required(VERSION 3.14)
project(OxEngine)
set(CMAKE_CXX_STANDARD 11)
set(SOURCE_FILES main.cpp engine.cpp sprite.cpp classes.h inventory.cpp vector.cpp)
MESSAGE(${SDL_INCLUDE_DIR} " Image: " ${SDL2_IMAGE_INCLUDE_DIR})
include_directories(${SDL_INCLUDE_DIR})
include_directories(${SDL2_IMAGE_INCLUDE_DIR})
add_executable(${CMAKE_PROJECT_NAME} ${SOURCE_FILES})
MESSAGE(${SDL_LIBRARY} " HH " ${SDL2_IMAGE_LIBRARY})
target_link_libraries(${CMAKE_PROJECT_NAME} ${SDL_LIBRARY} ${SDL2_IMAGE_LIBRARY})
When loaded in CLion I get the following CMake output:
"/Applications/CLion 2.app/Contents/bin/cmake/mac/bin/cmake" -DCMAKE_BUILD_TYPE= -DCMAKE_C_COMPILER=/usr/bin/gcc -DCMAKE_CXX_COMPILER=/usr/bin/g++ -G "CodeBlocks - Unix Makefiles" /Users/nantha/Projc/my_projects/OxEngine/src
/Library/Frameworks/SDL2.framework/Headers Image: /usr/local/include/SDL2
/usr/local/lib/libSDL.dylib-framework Cocoa HH /usr/local/lib/libSDL2_image.dylib
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/nantha/Projc/my_projects/OxEngine/src/cmake-build-runit
[Finished]
When I run the project I get
====================[ Build | OxEngine | Runit ]================================
"/Applications/CLion 2.app/Contents/bin/cmake/mac/bin/cmake" --build /Users/nantha/Projc/my_projects/OxEngine/src/cmake-build-runit --target OxEngine -- -lSDL2 -lSDL2_image
[ 16%] Linking CXX executable OxEngine
Undefined symbols for architecture x86_64:
"_SDL_CreateRenderer", referenced from:
Engine::init(Game&) in engine.cpp.o
"_SDL_CreateTexture", referenced from:
Inventory::render_itemButtons() in inventory.cpp.o
Inventory::render_categoryButtons() in inventory.cpp.o
Inventory::draw() in inventory.cpp.o
"_SDL_CreateTextureFromSurface", referenced from:
Engine::loadMedia() in engine.cpp.o
Button::load_images() in engine.cpp.o
Sprite::load_images() in sprite.cpp.o
InventoryButton::load_icon() in inventory.cpp.o
"_SDL_CreateWindow", referenced from:
Engine::init(Game&) in engine.cpp.o
"_SDL_DestroyRenderer", referenced from:
Engine::close() in engine.cpp.o
"_SDL_DestroyTexture", referenced from:
Inventory::draw() in inventory.cpp.o
"_SDL_DestroyWindow", referenced from:
Engine::close() in engine.cpp.o
"_SDL_QueryTexture", referenced from:
Inventory::draw() in inventory.cpp.o
"_SDL_RenderClear", referenced from:
Engine::drawisoworld() in engine.cpp.o
"_SDL_RenderCopy", referenced from:
Engine::renderit(std::__1::vector<std::__1::vector<bool, std::__1::allocator<bool> >, std::__1::allocator<std::__1::vector<bool, std::__1::allocator<bool> > > >&, int, int, int) in engine.cpp.o
Engine::draw_selected_tiles() in engine.cpp.o
Button::drawButton() in engine.cpp.o
Engine::drawisoworld() in engine.cpp.o
InventoryButton::draw() in inventory.cpp.o
Inventory::draw() in inventory.cpp.o
"_SDL_RenderFillRect", referenced from:
Inventory::render_itemButtons() in inventory.cpp.o
Inventory::render_categoryButtons() in inventory.cpp.o
Inventory::draw() in inventory.cpp.o
"_SDL_RenderPresent", referenced from:
Engine::update() in engine.cpp.o
"_SDL_SetRenderDrawColor", referenced from:
Engine::loadMedia() in engine.cpp.o
Engine::drawisoworld() in engine.cpp.o
Inventory::render_itemButtons() in inventory.cpp.o
Inventory::render_categoryButtons() in inventory.cpp.o
Inventory::draw() in inventory.cpp.o
"_SDL_SetRenderTarget", referenced from:
Inventory::render_itemButtons() in inventory.cpp.o
Inventory::render_categoryButtons() in inventory.cpp.o
Inventory::draw() in inventory.cpp.o
"_SDL_SetTextureBlendMode", referenced from:
Inventory::draw() in inventory.cpp.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[3]: *** [OxEngine] Error 1
make[2]: *** [CMakeFiles/OxEngine.dir/all] Error 2
make[1]: *** [CMakeFiles/OxEngine.dir/rule] Error 2
make: *** [OxEngine] Error 2
Project Structure:
Thank You

Point Cloud Library Undefined symbols for architecture x86_64

i'm trying to do an iterative closest point but since I'm a noob I'm trying starting from this tutorial:
http://pointclouds.org/documentation/tutorials/iterative_closest_point.php
all required dependencies are installed, Operative System is MacOs High Sierra, I have this error when I execute make command :
Undefined symbols for architecture x86_64:
"pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> >::setInputCloud(boost::shared_ptr<pcl::PointCloud<pcl::PointXYZ> const> const&, boost::shared_ptr<std::__1::vector<int, std::__1::allocator<int> > const> const&)", referenced from:
vtable for pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> > in iterative_closest_point.cpp.o
"pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> >::radiusSearch(pcl::PointXYZ const&, double, std::__1::vector<int, std::__1::allocator<int> >&, std::__1::vector<float, std::__1::allocator<float> >&, unsigned int) const", referenced from:
vtable for pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> > in iterative_closest_point.cpp.o
"pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> >::nearestKSearch(pcl::PointXYZ const&, int, std::__1::vector<int, std::__1::allocator<int> >&, std::__1::vector<float, std::__1::allocator<float> >&) const", referenced from:
vtable for pcl::KdTreeFLANN<pcl::PointXYZ, flann::L2_Simple<float> > in iterative_closest_point.cpp.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[2]: *** [iterative_closest_point] Error 1
make[1]: *** [CMakeFiles/iterative_closest_point.dir/all] Error 2
make: *** [all] Error 2
I can not understand what I'm wrong

Failed to install Otcl-1.14 for NS-2

I'm trying to install NS-2 on Mac OS X 10.9.x Mavericks with ns-allinone
Everytime I run the install script, it fails in a step installing Otcl with the errors:
rm -f libotcl otcl.o so_locations
gcc -c -g -O2 -DNDEBUG -DUSE_SHM -DHAVE_UNISTD_H=1 -fPIC -I. -I/Users/songsong/Downloads/ns-allinone-2.35/include -I/Users/songsong/Downloads/ns-allinone-2.35/include -I/Users/songsong/Downloads/ns-allinone-2.35/include -I/usr/X11R6/include -I/include otcl.c
otcl.c:784:14: warning: cast to 'Proc *' (aka 'struct Proc *') from smaller
integer type 'int' [-Wint-to-pointer-cast]
return Tcl_CmdInfoGetProc(co);
^
otcl.c:74:32: note: expanded from macro 'Tcl_CmdInfoGetProc'
#define Tcl_CmdInfoGetProc(co) (Proc *)(co->isNativeObjectProc) ? co->ob...
^
1 warning generated.
o libotcl otcl.o
make: o: No such file or directory
make: [libotcl] Error 1 (ignored)
rm -f libotcl
gcc -o otclsh -g -O2 -I. -I/Users/songsong/Downloads/ns-allinone-2.35/include -I/Users/songsong/Downloads/ns-allinone-2.35/include -I/Users/songsong/Downloads/ns-allinone-2.35/include -I/usr/X11R6/include -I/include otclAppInit.c \
-L. -lotcl -L/Users/songsong/Downloads/ns-allinone-2.35/lib -ltk8.5 -L/Users/songsong/Downloads/ns-allinone-2.35/lib -ltcl8.5 -L/usr/X11R6/lib -lXext -lX11 -lm
Undefined symbols for architecture x86_64:
"_CFAbsoluteTimeGetCurrent", referenced from:
_Tcl_SetTimer in libtcl8.5.a(tclMacOSXNotify.o)
_Tcl_ServiceModeHook in libtcl8.5.a(tclMacOSXNotify.o)
_Tcl_Sleep in libtcl8.5.a(tclMacOSXNotify.o)
"_CFBundleCopyBundleURL", referenced from:
_Tcl_MacOSXOpenVersionedBundleResources in libtcl8.5.a(tclMacOSXBundle.o)
"_CFBundleCopyResourceURL", referenced from:
_Tcl_MacOSXOpenVersionedBundleResources in libtcl8.5.a(tclMacOSXBundle.o)
"_CFBundleCreate", referenced from:
_Tcl_MacOSXOpenVersionedBundleResources in libtcl8.5.a(tclMacOSXBundle.o)
"_CFBundleGetBundleWithIdentifier", referenced from:
_Tcl_MacOSXOpenVersionedBundleResources in libtcl8.5.a(tclMacOSXBundle.o)
"_CFLocaleCopyCurrent", referenced from:
_TclpSetVariables in libtcl8.5.a(tclUnixInit.o)
"_CFLocaleGetIdentifier", referenced from:
_TclpSetVariables in libtcl8.5.a(tclUnixInit.o)
"_CFRelease", referenced from:
_Tcl_FinalizeNotifier in libtcl8.5.a(tclMacOSXNotify.o)
_TclpSetVariables in libtcl8.5.a(tclUnixInit.o)
_Tcl_MacOSXOpenVersionedBundleResources in libtcl8.5.a(tclMacOSXBundle.o)
"_CFRunLoopAddObserver", referenced from:
_Tcl_InitNotifier in libtcl8.5.a(tclMacOSXNotify.o)
_TclMacOSXNotifierAddRunLoopMode in libtcl8.5.a(tclMacOSXNotify.o)
"_CFRunLoopAddSource", referenced from:
_Tcl_InitNotifier in libtcl8.5.a(tclMacOSXNotify.o)
_TclMacOSXNotifierAddRunLoopMode in libtcl8.5.a(tclMacOSXNotify.o)
"_CFRunLoopAddTimer", referenced from:
_TclMacOSXNotifierAddRunLoopMode in libtcl8.5.a(tclMacOSXNotify.o)
_Tcl_ServiceModeHook in libtcl8.5.a(tclMacOSXNotify.o)
"_CFRunLoopGetCurrent", referenced from:
_Tcl_InitNotifier in libtcl8.5.a(tclMacOSXNotify.o)
"_CFRunLoopObserverCreate", referenced from:
_Tcl_InitNotifier in libtcl8.5.a(tclMacOSXNotify.o)
"_CFRunLoopObserverInvalidate", referenced from:
_Tcl_FinalizeNotifier in libtcl8.5.a(tclMacOSXNotify.o)
"_CFRunLoopRunInMode", referenced from:
_Tcl_WaitForEvent in libtcl8.5.a(tclMacOSXNotify.o)
_Tcl_Sleep in libtcl8.5.a(tclMacOSXNotify.o)
"_CFRunLoopSourceCreate", referenced from:
_Tcl_InitNotifier in libtcl8.5.a(tclMacOSXNotify.o)
"_CFRunLoopSourceInvalidate", referenced from:
_Tcl_FinalizeNotifier in libtcl8.5.a(tclMacOSXNotify.o)
"_CFRunLoopSourceSignal", referenced from:
_Tcl_AlertNotifier in libtcl8.5.a(tclMacOSXNotify.o)
_NotifierThreadProc in libtcl8.5.a(tclMacOSXNotify.o)
"_CFRunLoopTimerCreate", referenced from:
_Tcl_ServiceModeHook in libtcl8.5.a(tclMacOSXNotify.o)
"_CFRunLoopTimerGetNextFireDate", referenced from:
_Tcl_Sleep in libtcl8.5.a(tclMacOSXNotify.o)
"_CFRunLoopTimerInvalidate", referenced from:
_Tcl_FinalizeNotifier in libtcl8.5.a(tclMacOSXNotify.o)
"_CFRunLoopTimerSetNextFireDate", referenced from:
_Tcl_SetTimer in libtcl8.5.a(tclMacOSXNotify.o)
_Tcl_Sleep in libtcl8.5.a(tclMacOSXNotify.o)
"_CFRunLoopWakeUp", referenced from:
_Tcl_AlertNotifier in libtcl8.5.a(tclMacOSXNotify.o)
_NotifierThreadProc in libtcl8.5.a(tclMacOSXNotify.o)
"_CFStringCompare", referenced from:
_Tcl_MacOSXOpenVersionedBundleResources in libtcl8.5.a(tclMacOSXBundle.o)
"_CFStringCreateWithCString", referenced from:
_Tcl_MacOSXOpenVersionedBundleResources in libtcl8.5.a(tclMacOSXBundle.o)
"_CFStringGetCString", referenced from:
_TclpSetVariables in libtcl8.5.a(tclUnixInit.o)
"_CFURLCopyLastPathComponent", referenced from:
_Tcl_MacOSXOpenVersionedBundleResources in libtcl8.5.a(tclMacOSXBundle.o)
"_CFURLCreateCopyAppendingPathComponent", referenced from:
_Tcl_MacOSXOpenVersionedBundleResources in libtcl8.5.a(tclMacOSXBundle.o)
"_CFURLGetFileSystemRepresentation", referenced from:
_Tcl_MacOSXOpenVersionedBundleResources in libtcl8.5.a(tclMacOSXBundle.o)
"___CFConstantStringClassReference", referenced from:
CFString in libtcl8.5.a(tclMacOSXNotify.o)
CFString in libtcl8.5.a(tclMacOSXBundle.o)
CFString in libtcl8.5.a(tclMacOSXBundle.o)
"_kCFRunLoopCommonModes", referenced from:
_Tcl_InitNotifier in libtcl8.5.a(tclMacOSXNotify.o)
_Tcl_ServiceModeHook in libtcl8.5.a(tclMacOSXNotify.o)
"_kCFRunLoopDefaultMode", referenced from:
_Tcl_WaitForEvent in libtcl8.5.a(tclMacOSXNotify.o)
_Tcl_Sleep in libtcl8.5.a(tclMacOSXNotify.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: *** [otclsh] Error 1
I found that CF in _CF* things does mean CoreFoundation Framework (might be a part of Xcode)
And the installer doesn't recognize it.
Thus, I put -framework CoreFoundation to $CFLAGS in Makefile
If you run ./configure before make, Makefile will be modified and your modification will be lost. In that case, replace CFLAGS="-g -O2" with CFLAGS="-g -O2 -framework CoreFoundation" in ./configure
In the otcl directory in the configure exe file change this
if test "$GCC" = yes; then CFLAGS="-g -O2"
to this
if test "$GCC" = yes; then CFLAGS="-g -O2 -framework CoreFoundation"

gcc and clang giving me an error while compiling

Here is my simple test code,
#include <iostream>
int main(){
std::cout << "SAO" << std::endl;
return 0;
}
and compile command below
gcc -o test test.cpp
and I am having a compile error below.
Undefined symbols for architecture x86_64:
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::size() const", referenced from:
std::__verify_grouping(char const*, unsigned long, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in ccMFcxIz.o
"std::basic_string<char, std::char_traits<char>, std::allocator<char> >::operator[](unsigned long) const", referenced from:
std::__verify_grouping(char const*, unsigned long, std::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)in ccMFcxIz.o
"std::basic_ostream<char, std::char_traits<char> >::operator<<(std::basic_ostream<char, std::char_traits<char> >& (*)(std::basic_ostream<char, std::char_traits<char> >&))", referenced from:
_main in ccMFcxIz.o
"std::ios_base::Init::Init()", referenced from:
__static_initialization_and_destruction_0(int, int)in ccMFcxIz.o
"std::ios_base::Init::~Init()", referenced from:
___tcf_0 in ccMFcxIz.o
"std::cout", referenced from:
_main in ccMFcxIz.o
"std::basic_ostream<char, std::char_traits<char> >& std::endl<char, std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&)", referenced from:
_main in ccMFcxIz.o
"std::basic_ostream<char, std::char_traits<char> >& std::operator<< <std::char_traits<char> >(std::basic_ostream<char, std::char_traits<char> >&, char const*)", referenced from:
_main in ccMFcxIz.o
"___gxx_personality_v0", referenced from:
Dwarf Exception Unwind Info (__eh_frame) in ccMFcxIz.o
ld: symbol(s) not found for architecture x86_64
collect2: ld returned 1 exit status
I've tried putting -m32 just in case but still give me error below.
ld: symbol(s) not found for architecture i386
collect2: ld returned 1 exit status
Version of gcc is 4.2 which is installed by XCode "command line tool".
OS is Mac OSX Mountain Lion.
I've tried with gcc 4.7 or clang 3.1 but same error..
Ofcourse, compiling cpp code with gcc will give you error. You should use g++

Resources