Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Build error on macOS #153

Open
remcg opened this issue Sep 13, 2024 · 5 comments
Open

Build error on macOS #153

remcg opened this issue Sep 13, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@remcg
Copy link

remcg commented Sep 13, 2024

Describe the bug
Running the build with the default configuration using build.sh fails with the error

ld: unknown options: --push-state --no-as-needed --whole-archive --pop-state
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/testServer] Error 1
make[1]: *** [tests/testServer/CMakeFiles/testServer.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....

To Reproduce
Run build.sh

Expected behavior
Build completes without eerror

Provide details about your environment

  • Operating System version: macOS Sonoma 14.4
  • gwhisper --version output: Unable to build
  • gRPC/protobuf version:
  • Compiler version (if related to build): AppleClang 15.0.0.15000309
  • CMake version (if related to build):3.30.3

Additional context
Full log attached. Retried the build with the test server turned off using the command
cmake .. -D GWHISPER_BUILD_TESTSERVER=OFF

This time got another linker error

[100%] Linking CXX static library libcli.a
[100%] Built target cli
[100%] Generating HelpString.h
[100%] Building CXX object src/gwhisper/CMakeFiles/gwhisper.dir/gwhisper.cpp.o
[100%] Linking CXX executable ../../bin/gwhisper
ld: warning: ignoring duplicate libraries: '../../third_party/gRPC_utils/libreflection.a', '../libArgParse/libArgParse.a', '../libCli/libcli.a', '../libLocalDescriptorCache/libDescDbProxy.a'
ld: library 'stdc++fs' not found
clang: error: linker command failed with exit code 1 (use -v to see invocation)
make[2]: *** [bin/gwhisper] Error 1
make[1]: *** [src/gwhisper/CMakeFiles/gwhisper.dir/all] Error 2
make: *** [all] Error 2

Work around:
Commented out stdc++fs in src/libLocalDescriptorCache/CMakeLists.txt and src/utils/CMakeLists.txt to be able to build gwhisper binary.
build.log

@remcg remcg added the bug Something isn't working label Sep 13, 2024
@rainerschoe
Copy link
Member

rainerschoe commented Sep 24, 2024

Thanks for reporting.

Unfortunately I do not have a MacOS test environment. But thanks to your clear error description I see two issues:

  1. Unsupported Linker options when linking gRPC reflection libs. using the official gRPC examples as a reference, I see we need to handle Darwin specially.
  2. An issue around linking standard filesystems library. This is actually only required for old compilers and can be omitted for most modern compilers.

I am working on supporting MacOS based on your information in #157.
@remcg Could you help me by reviewing this PR and verify if this fixes both issues?

@rainerschoe
Copy link
Member

NOTE: I just realized that CI in #157 fails. Obviously it only makes sense to test this on MacOS after CI passes.
I am running out of time for today, so still a work in progress.
If you like to have a look, feel free to, otherwise I will continue on this when I have some more time.

@remcg
Copy link
Author

remcg commented Sep 25, 2024

I was able to build successfully on MacOS with #157 . Both issues are resolved when I run build with the command ./build.sh.
There were some warnings that can be ignored I guess but sharing them anyway in case you want to fix those too.

[100%] Building CXX object tests/testServer/CMakeFiles/testServer.dir/ServiceComplexTypeRpcs.cpp.o
In file included from /Users/XXXXX/github/test/gWhisper/src/libCli/Call.cpp:15:
In file included from /Users/XXXXX/github/test/gWhisper/src/libCli/libCli/Call.hpp:17:
In file included from /Users/XXXXX/github/test/gWhisper/src/libArgParse/libArgParse/ArgParse.hpp:37:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include/c++/v1/memory:898:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include/c++/v1/__memory/shared_ptr.h:31:
/Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include/c++/v1/__memory/unique_ptr.h:68:5: warning: delete called on 'cli::MessageFormatter' that is abstract but has non-virtual destructor [-Wdelete-abstract-non-virtual-dtor]
delete __ptr;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include/c++/v1/__memory/unique_ptr.h:300:7: note: in instantiation of member function 'std::default_deletecli::MessageFormatter::operator()' requested here
_ptr.second()(__tmp);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include/c++/v1/__memory/unique_ptr.h:266:75: note: in instantiation of member function 'std::unique_ptrcli::MessageFormatter::reset' requested here
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); }
^
/Users/XXXXX/github/test/gWhisper/src/libCli/Call.cpp:199:33: note: in instantiation of member function 'std::unique_ptrcli::MessageFormatter::~unique_ptr' requested here
auto messageFormatter = createMessageFormatter(parseTree);
^
In file included from /Users/XXXXX/github/test/gWhisper/src/libCli/Call.cpp:15:
In file included from /Users/XXXXX/github/test/gWhisper/src/libCli/libCli/Call.hpp:17:
In file included from /Users/XXXXX/github/test/gWhisper/src/libArgParse/libArgParse/ArgParse.hpp:37:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include/c++/v1/memory:898:
In file included from /Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include/c++/v1/__memory/shared_ptr.h:31:
/Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include/c++/v1/__memory/unique_ptr.h:68:5: warning: delete called on 'cli::MessageParser' that is abstract but has non-virtual destructor [-Wdelete-abstract-non-virtual-dtor]
delete __ptr;
^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include/c++/v1/__memory/unique_ptr.h:300:7: note: in instantiation of member function 'std::default_deletecli::MessageParser::operator()' requested here
_ptr.second()(__tmp);
^
/Library/Developer/CommandLineTools/SDKs/MacOSX14.4.sdk/usr/include/c++/v1/__memory/unique_ptr.h:266:75: note: in instantiation of member function 'std::unique_ptrcli::MessageParser::reset' requested here
_LIBCPP_INLINE_VISIBILITY _LIBCPP_CONSTEXPR_SINCE_CXX23 ~unique_ptr() { reset(); }
^
/Users/XXXXX/github/test/gWhisper/src/libCli/Call.cpp:200:30: note: in instantiation of member function 'std::unique_ptrcli::MessageParser::~unique_ptr' requested here
auto messageParser = createMessageParser(parseTree);
^
2 warnings generated.

@remcg
Copy link
Author

remcg commented Sep 25, 2024

I looked at the CI build failures and tried to replicate them. I ran these commands to run tests
cmake -B build -DCMAKE_BUILD_TYPE=Release -DGWHISPER_BUILD_TESTS=ON
cmake --build ./build --config Release --parallel 8
ctest -C Release --verbose

Got similar test failures as the CI tests.

The following tests FAILED:
2 - CompletionFunctionTests (Failed)
3 - CompletionFunctionTests_fish (Failed)
4 - RpcExecutionTests (Failed)
5 - SslFunctionTests (Failed)
6 - RpcTimeoutTests (Failed)
7 - CacheTests (Failed)

Attached test log files.
LastTest.log

@rainerschoe
Copy link
Member

Thanks for helping out here.
The warning seems easy enough to fix. Will fix it :-)

The failing tests are all related to testing gWhisper against a test server specifically started for the test.
I think something about starting the server / opening a TCP socket and gWhisper connecting to it does not work the same on mac as it does on linux.

It is kind of hard for me to debug, as I only have the CI to test on, so I am quite happy that you could replicate on your local setup.

Could you maybe try starting the test server manually and run gwhisper with some arbitrary RPCs against it on your setup?
If it is OK for you, we could also schedule a PP session to work together on this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants