https://gcc.gnu.org/bugzilla/show_bug.cgi?id=116237

            Bug ID: 116237
           Summary: gcc does not accept -weak_framework without -Wl on
                    macOS
           Product: gcc
           Version: 14.1.0
            Status: UNCONFIRMED
          Severity: normal
          Priority: P3
         Component: target
          Assignee: unassigned at gcc dot gnu.org
          Reporter: vital.had at gmail dot com
                CC: iains at gcc dot gnu.org
  Target Milestone: ---
            Target: *-apple-darwin

gcc does not accept -weak_framework flag passed directly, but that is how MacOS
itself normally uses it.

A random example of the error:

[ 80%] Linking CXX executable rastertobrlaser
/opt/local/bin/cmake -E cmake_link_script
CMakeFiles/rastertobrlaser.dir/link.txt --verbose=ON
/opt/local/bin/g++-mp-14  -Wall -Wno-missing-braces -Wformat
-D_FORTIFY_SOURCE=2 -pipe -Os -DNDEBUG -I/opt/local/include
-D_GLIBCXX_USE_CXX11_ABI=0 -arch ppc -mmacosx-version-min=10.6
-Wl,-search_paths_first -Wl,-headerpad_max_install_names -L/opt/local/lib
-Wl,-headerpad_max_install_names CMakeFiles/rastertobrlaser.dir/src/main.cc.o
CMakeFiles/rastertobrlaser.dir/src/job.cc.o
CMakeFiles/rastertobrlaser.dir/src/line.cc.o
CMakeFiles/rastertobrlaser.dir/src/debug.cc.o -o rastertobrlaser 
-Wl,-rpath,/opt/local/lib -lcupsimage -lcups -weak_framework Kerberos
-framework CoreFoundation -framework Security -lz -lpthread -lresolv -framework
SystemConfiguration -framework CoreFoundation
g++-mp-14: error: unrecognized command-line option '-weak_framework'; did you
mean '-framework'?
make[2]: *** [rastertobrlaser] Error 1

If changed to -Wl,-weak_framework Kerberos, it works as intended. However, this
is problematic, since MacOS components specify flags without -Wl being added.

Related: https://trac.macports.org/ticket/70480
https://github.com/pdewacht/brlaser/issues/214

I have encountered this error elsewhere too, and assumed that -weak_framework
is just not accepted by the linker: this was incorrect, ld accepts it, but gcc
does not.

Reply via email to