Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

compiling under Mac OS with g++ #124

Closed
chtlp opened this issue Mar 1, 2015 · 2 comments
Closed

compiling under Mac OS with g++ #124

chtlp opened this issue Mar 1, 2015 · 2 comments

Comments

@chtlp
Copy link

chtlp commented Mar 1, 2015

Hi, I am trying to compile cppformat with g++-4.9 (installed using homebrew) and met some problems. Compiling with clang works fine. Any idea how to solve this?

linpengt@linpengt-mbp:~/workspace/cppformat$ g++ --version
g++ (Homebrew gcc 4.9.1) 4.9.1
Copyright (C) 2014 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.

linpengt@linpengt-mbp:~/workspace/cppformat$ CXX=g++ CC=gcc cmake .
-- CMake version: 3.0.2
-- The C compiler identification is GNU 4.9.1
-- The CXX compiler identification is GNU 4.9.1
-- Checking whether C compiler has -isysroot
-- Checking whether C compiler has -isysroot - yes
-- Checking whether C compiler supports OSX deployment target flag
-- Checking whether C compiler supports OSX deployment target flag - yes
-- Check for working C compiler: /usr/bin/gcc
-- Check for working C compiler: /usr/bin/gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Checking whether CXX compiler has -isysroot
-- Checking whether CXX compiler has -isysroot - yes
-- Checking whether CXX compiler supports OSX deployment target flag
-- Checking whether CXX compiler supports OSX deployment target flag - yes
-- Check for working CXX compiler: /usr/bin/g++
-- Check for working CXX compiler: /usr/bin/g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Build type: Release
-- Performing Test HAVE_STD_CPP11_FLAG
-- Performing Test HAVE_STD_CPP11_FLAG - Success
-- Looking for open
-- Looking for open - found
-- Target 'doc' disabled (requires doxygen)
-- Looking for include file pthread.h
-- Looking for include file pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - found
-- Found Threads: TRUE
-- Performing Test FMT_VARIADIC_TEMPLATES
-- Performing Test FMT_VARIADIC_TEMPLATES - Success
-- Performing Test HAVE_TYPE_TRAITS
-- Performing Test HAVE_TYPE_TRAITS - Success
-- Performing Test HAVE_FNO_EXCEPTIONS_FLAG
-- Performing Test HAVE_FNO_EXCEPTIONS_FLAG - Success
-- Configuring done
-- Generating done
-- Build files have been written to: /Users/linpengt/workspace/cppformat
linpengt@linpengt-mbp:~/workspace/cppformat$ make
Scanning dependencies of target format
[  3%] Building CXX object CMakeFiles/format.dir/format.cc.o
[  7%] Building CXX object CMakeFiles/format.dir/posix.cc.o
Linking CXX static library libformat.a
[  7%] Built target format
Scanning dependencies of target gmock
[ 11%] Building CXX object CMakeFiles/gmock.dir/gmock/gmock-gtest-all.cc.o
Linking CXX static library libgmock.a
[ 11%] Built target gmock
Scanning dependencies of target test-main
[ 14%] Building CXX object test/CMakeFiles/test-main.dir/test-main.cc.o
[ 18%] Building CXX object test/CMakeFiles/test-main.dir/gtest-extra.cc.o
[ 22%] Building CXX object test/CMakeFiles/test-main.dir/util.cc.o
Linking CXX static library libtest-main.a
[ 22%] Built target test-main
Scanning dependencies of target format-impl-test
[ 25%] Building CXX object test/CMakeFiles/format-impl-test.dir/format-impl-test.cc.o
Linking CXX executable format-impl-test
[ 25%] Built target format-impl-test
Scanning dependencies of target format-test
[ 29%] Building CXX object test/CMakeFiles/format-test.dir/format-test.cc.o
Linking CXX executable format-test
[ 29%] Built target format-test
Scanning dependencies of target gtest-extra-test
[ 33%] Building CXX object test/CMakeFiles/gtest-extra-test.dir/gtest-extra-test.cc.o
Linking CXX executable gtest-extra-test
[ 33%] Built target gtest-extra-test
Scanning dependencies of target header-only-test
[ 37%] Building CXX object test/CMakeFiles/header-only-test.dir/header-only-test.cc.o
[ 40%] Building CXX object test/CMakeFiles/header-only-test.dir/header-only-test2.cc.o
[ 44%] Building CXX object test/CMakeFiles/header-only-test.dir/test-main.cc.o
Linking CXX executable header-only-test
duplicate symbol int fmt::internal::CharTraits<char>::format_float<double>(char*, unsigned long, char const*, unsigned int, int, double) in:
    CMakeFiles/header-only-test.dir/header-only-test.cc.o
    CMakeFiles/header-only-test.dir/header-only-test2.cc.o
duplicate symbol int fmt::internal::CharTraits<char>::format_float<long double>(char*, unsigned long, char const*, unsigned int, int, long double) in:
    CMakeFiles/header-only-test.dir/header-only-test.cc.o
    CMakeFiles/header-only-test.dir/header-only-test2.cc.o
duplicate symbol int fmt::internal::CharTraits<wchar_t>::format_float<double>(wchar_t*, unsigned long, wchar_t const*, unsigned int, int, double) in:
    CMakeFiles/header-only-test.dir/header-only-test.cc.o
    CMakeFiles/header-only-test.dir/header-only-test2.cc.o
duplicate symbol int fmt::internal::CharTraits<wchar_t>::format_float<long double>(wchar_t*, unsigned long, wchar_t const*, unsigned int, int, long double) in:
    CMakeFiles/header-only-test.dir/header-only-test.cc.o
    CMakeFiles/header-only-test.dir/header-only-test2.cc.o
duplicate symbol fmt::BasicFormatter<char>::format(char const*&, fmt::internal::Arg const&) in:
    CMakeFiles/header-only-test.dir/header-only-test.cc.o
    CMakeFiles/header-only-test.dir/header-only-test2.cc.o
duplicate symbol fmt::BasicFormatter<char>::format(fmt::BasicStringRef<char>, fmt::ArgList const&) in:
    CMakeFiles/header-only-test.dir/header-only-test.cc.o
    CMakeFiles/header-only-test.dir/header-only-test2.cc.o
duplicate symbol fmt::internal::PrintfFormatter<char>::format(fmt::BasicWriter<char>&, fmt::BasicStringRef<char>, fmt::ArgList const&) in:
    CMakeFiles/header-only-test.dir/header-only-test.cc.o
    CMakeFiles/header-only-test.dir/header-only-test2.cc.o
duplicate symbol fmt::BasicFormatter<wchar_t>::format(wchar_t const*&, fmt::internal::Arg const&) in:
    CMakeFiles/header-only-test.dir/header-only-test.cc.o
    CMakeFiles/header-only-test.dir/header-only-test2.cc.o
duplicate symbol fmt::BasicFormatter<wchar_t>::format(fmt::BasicStringRef<wchar_t>, fmt::ArgList const&) in:
    CMakeFiles/header-only-test.dir/header-only-test.cc.o
    CMakeFiles/header-only-test.dir/header-only-test2.cc.o
duplicate symbol fmt::internal::PrintfFormatter<wchar_t>::format(fmt::BasicWriter<wchar_t>&, fmt::BasicStringRef<wchar_t>, fmt::ArgList const&) in:
    CMakeFiles/header-only-test.dir/header-only-test.cc.o
    CMakeFiles/header-only-test.dir/header-only-test2.cc.o
ld: 10 duplicate symbols for architecture x86_64
collect2: error: ld returned 1 exit status
make[2]: *** [test/header-only-test] Error 1
make[1]: *** [test/CMakeFiles/header-only-test.dir/all] Error 2
make: *** [all] Error 2
@vitaut
Copy link
Contributor

vitaut commented Mar 1, 2015

Thanks for reporting. Does c09c42f fix the issue?

@chtlp
Copy link
Author

chtlp commented Mar 1, 2015

Yes. That's a quick fix :)

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

No branches or pull requests

2 participants