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

Some 32-bit platforms need explicit linking to libatomic for 8-byte atomics support #999

Closed
barracuda156 opened this issue Feb 5, 2024 · 9 comments · Fixed by #1000
Closed

Comments

@barracuda156
Copy link

Some 32-bit platforms (ppc, arm, likely mips) need explicit linking to libatomic here:

[100%] Linking CXX executable FuzzFailTest
cd /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_CLI11/CLI11/work/build/tests && /opt/local/bin/cmake -E cmake_link_script CMakeFiles/FuzzFailTest.dir/link.txt --verbose=ON
/opt/local/bin/g++-mp-13 -pipe -Os -DNDEBUG -I/opt/local/include -D_GLIBCXX_USE_CXX11_ABI=0 -mmacosx-version-min=10.6 -Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/opt/local/lib -Wl,-headerpad_max_install_names CMakeFiles/FuzzFailTest.dir/FuzzFailTest.cpp.o CMakeFiles/FuzzFailTest.dir/__/fuzz/fuzzApp.cpp.o -o FuzzFailTest  -Wl,-rpath,/opt/local/lib /opt/local/lib/libCatch2Main.a /opt/local/lib/libCatch2.a 
Undefined symbols:
  "___atomic_store_8", referenced from:
      __ZNSt17_Function_handlerIFbRKSt6vectorISsSaISsEEEZN3CLI3App8add_flagISt6atomicIdELNS6_6detail7enablerE0EEEPNS6_6OptionESsRT_SsEUlS4_E_E9_M_invokeERKSt9_Any_dataS4_ in fuzzApp.cpp.o
      __ZNSt17_Function_handlerIFbRKSt6vectorISsSaISsEEEZN3CLI3App10add_optionISt6atomicIxESA_LNS6_6detail7enablerE0EEEPNS6_6OptionESsRT_SsEUlS4_E_E9_M_invokeERKSt9_Any_dataS4_ in fuzzApp.cpp.o
      __ZNSt17_Function_handlerIFbRKSt6vectorISsSaISsEEEZN3CLI3App10add_optionISt6atomicIyESA_LNS6_6detail7enablerE0EEEPNS6_6OptionESsRT_SsEUlS4_E_E9_M_invokeERKSt9_Any_dataS4_ in fuzzApp.cpp.o
  "___atomic_load_8", referenced from:
      __ZNSt17_Function_handlerIFSsvEZN3CLI3App10add_optionISt6atomicIxES5_LNS1_6detail7enablerE0EEEPNS1_6OptionESsRT_SsEUlvE_E9_M_invokeERKSt9_Any_data in fuzzApp.cpp.o
      __ZNSt17_Function_handlerIFSsvEZN3CLI3App10add_optionISt6atomicIyES5_LNS1_6detail7enablerE0EEEPNS1_6OptionESsRT_SsEUlvE_E9_M_invokeERKSt9_Any_data in fuzzApp.cpp.o
ld: symbol(s) not found
collect2: error: ld returned 1 exit status
make[2]: *** [tests/FuzzFailTest] Error 1
@henryiii
Copy link
Collaborator

henryiii commented Feb 5, 2024

Is this only happening on the new fuzzing test?

@barracuda156
Copy link
Author

Is this only happening on the new fuzzing test?

Looks like yes, at least on my system.

@henryiii
Copy link
Collaborator

henryiii commented Feb 5, 2024

OK, that should be pretty easy to fix.

@barracuda156
Copy link
Author

@henryiii That would be great.

@barracuda156
Copy link
Author

Passing -latomic locally via configure.cxxflags-append -Wl,-latomic (for some reason a more standard configure.ldflags-append -latomic failed in this case) fixed the build.
All tests pass:

--->  Testing CLI11
Executing:  cd "/opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_CLI11/CLI11/work/build" && /usr/bin/make test 
Running tests...
/opt/local/bin/ctest --force-new-ctest-process 
Test project /opt/local/var/macports/build/_opt_PPCSnowLeopardPorts_devel_CLI11/CLI11/work/build

CLI11 information:
  C++ standard: 11
  __has_include: yes
  No optional library found

      Start  1: HelpersTest
 1/21 Test  #1: HelpersTest ......................   Passed    0.03 sec
      Start  2: ConfigFileTest
 2/21 Test  #2: ConfigFileTest ...................   Passed    0.10 sec
      Start  3: OptionTypeTest
 3/21 Test  #3: OptionTypeTest ...................   Passed    0.05 sec
      Start  4: SimpleTest
 4/21 Test  #4: SimpleTest .......................   Passed    0.02 sec
      Start  5: AppTest
 5/21 Test  #5: AppTest ..........................   Passed    0.09 sec
      Start  6: SetTest
 6/21 Test  #6: SetTest ..........................   Passed    0.03 sec
      Start  7: TransformTest
 7/21 Test  #7: TransformTest ....................   Passed    0.03 sec
      Start  8: CreationTest
 8/21 Test  #8: CreationTest .....................   Passed    0.03 sec
      Start  9: SubcommandTest
 9/21 Test  #9: SubcommandTest ...................   Passed    0.05 sec
      Start 10: HelpTest
10/21 Test #10: HelpTest .........................   Passed    0.04 sec
      Start 11: FormatterTest
11/21 Test #11: FormatterTest ....................   Passed    0.02 sec
      Start 12: NewParseTest
12/21 Test #12: NewParseTest .....................   Passed    0.02 sec
      Start 13: OptionalTest
13/21 Test #13: OptionalTest .....................   Passed    0.01 sec
      Start 14: DeprecatedTest
14/21 Test #14: DeprecatedTest ...................   Passed    0.01 sec
      Start 15: StringParseTest
15/21 Test #15: StringParseTest ..................   Passed    0.02 sec
      Start 16: ComplexTypeTest
16/21 Test #16: ComplexTypeTest ..................   Passed    0.04 sec
      Start 17: TrueFalseTest
17/21 Test #17: TrueFalseTest ....................   Passed    0.02 sec
      Start 18: OptionGroupTest
18/21 Test #18: OptionGroupTest ..................   Passed    0.04 sec
      Start 19: EncodingTest
19/21 Test #19: EncodingTest .....................   Passed    0.01 sec
      Start 20: TimerTest
20/21 Test #20: TimerTest ........................   Passed    0.24 sec
      Start 21: link_test_2
21/21 Test #21: link_test_2 ......................   Passed    0.01 sec

100% tests passed, 0 tests failed out of 21

Total Test time (real) =   0.91 sec

@henryiii
Copy link
Collaborator

henryiii commented Feb 5, 2024

Could you see if #1000 works?

@barracuda156
Copy link
Author

@henryiii Apparently yes, it builds with this patch without manual flag passing.

@barracuda156
Copy link
Author

@henryiii Is it possible to make a minor release incorporating recent fixes? At least 30ead5d (but it will be nice to have libatomic one too).
I have been asked by the port maintainer about that.

@henryiii
Copy link
Collaborator

henryiii commented Feb 6, 2024

Yes, planned.

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

Successfully merging a pull request may close this issue.

2 participants