Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 647326 - media-libs/freeglut-3.0.0[abi_x86_32] - ld: cannot find -lSM
Summary: media-libs/freeglut-3.0.0[abi_x86_32] - ld: cannot find -lSM
Status: RESOLVED FIXED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: AMD64 Linux
: Normal normal (vote)
Assignee: Gentoo X packagers
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-02-11 19:08 UTC by Andreas Thalhammer
Modified: 2019-04-04 18:02 UTC (History)
1 user (show)

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andreas Thalhammer 2018-02-11 19:08:02 UTC
In order to install a 32-Bit program I had to enable USE=abi_x86_32 on specific packages, which pulled some more dependencies that also needed this change. In the middle of the update process (emerge -DuvN @world=), when compiling freeglut, the 32-Bit build got interrupted due to a missing library:


/usr/bin/x86_64-pc-linux-gnu-gcc -m32 -fPIC -O2 -march=znver1 -pipe -mindirect-branch=thunk -fstack-protector-strong -pie -fPIE -fstack-check=specific -mindirect-branch=thunk -fno-plt -mfunction-return=thunk -Wall -pedantic -Wl,-Ol -Wl,--as-needed -Wl,--sort-common -Wl,--hash-style=both -Wl,-z,relro -Wl,-znow -fstack-protector-strong -pie -fPIE -fstack-check=specific -mindirect-branch=thunk -fno-plt -mfunction-return=thunk -shared -Wl,-soname,libglut.so.3 -o lib/libglut.so.3.10.0 CMakeFiles/freeglut.dir/src/fg_callbacks.c.o CMakeFiles/freeglut.dir/src/fg_cursor.c.o CMakeFiles/freeglut.dir/src/fg_display.c.o CMakeFiles/freeglut.dir/src/fg_ext.c.o CMakeFiles/freeglut.dir/src/fg_font_data.c.o CMakeFiles/freeglut.dir/src/fg_gamemode.c.o CMakeFiles/freeglut.dir/src/fg_geometry.c.o CMakeFiles/freeglut.dir/src/fg_gl2.c.o CMakeFiles/freeglut.dir/src/fg_init.c.o CMakeFiles/freeglut.dir/src/fg_input_devices.c.o CMakeFiles/freeglut.dir/src/fg_joystick.c.o CMakeFiles/freeglut.dir/src/fg_main.c.o CMakeFiles/freeglut.dir/src/fg_misc.c.o CMakeFiles/freeglut.dir/src/fg_overlay.c.o CMakeFiles/freeglut.dir/src/fg_spaceball.c.o CMakeFiles/freeglut.dir/src/fg_state.c.o CMakeFiles/freeglut.dir/src/fg_stroke_mono_roman.c.o CMakeFiles/freeglut.dir/src/fg_stroke_roman.c.o CMakeFiles/freeglut.dir/src/fg_structure.c.o CMakeFiles/freeglut.dir/src/fg_teapot.c.o CMakeFiles/freeglut.dir/src/fg_videoresize.c.o CMakeFiles/freeglut.dir/src/fg_window.c.o CMakeFiles/freeglut.dir/src/fg_font.c.o CMakeFiles/freeglut.dir/src/fg_menu.c.o CMakeFiles/freeglut.dir/src/x11/fg_cursor_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_ext_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_gamemode_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_glutfont_definitions_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_init_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_input_devices_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_joystick_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_main_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_menu_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_spaceball_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_state_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_structure_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_window_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_xinput_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_display_x11_glx.c.o CMakeFiles/freeglut.dir/src/x11/fg_state_x11_glx.c.o CMakeFiles/freeglut.dir/src/x11/fg_window_x11_glx.c.o CMakeFiles/freeglut.dir/src/util/xparsegeometry_repl.c.o -lGL -lm -lSM -lICE -lX11 -lXext -lXrandr -lXxf86vm -lXi 
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lSM
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/freeglut.dir/build.make:1169: lib/libglut.so.3.10.0] Error 1
make[2]: Leaving directory '/var/tmp/portage/media-libs/freeglut-3.0.0/work/freeglut-3.0.0-abi_x86_32.x86'


After adding USE=abi_x86_32 to x11-libs/libSM manually (was not indicated to be necessary by portage) everything works, AFTER manually updating x11-libs/libSM first, because emerge -DuvN @world was still trying to compile freeglut first, which again failed. So: emerge -1v x11-libs/libSM installed the required library in /usr/lib/ and emerge -DuvN @world then successfully installed media-libs/freeglut in both 64- and 32-bit versions.

Long story short: media-libs/freeglut with USE=abi_x86_32 should also depend on x11-libs/libSM with USE=abi_x86_32.

May be important: I'm on profile default/linux/amd64/17.1/desktop/plasma/systemd.

Reproducible: Always
Comment 1 Chí-Thanh Christopher Nguyễn gentoo-dev 2018-02-12 23:31:13 UTC
freeglut does not use libSM directly afaict, possibly some other package causes -lSM addition to the linker command.
Comment 2 Andreas Thalhammer 2018-02-14 17:11:13 UTC
Is it possible that due to the presence of the 64-bit library libSM it wants to include -lSM also for the 32-bit build? (-- and then finds it missing...)

How can I be of assistance to fix this? Do you need emerge --info? Although this should be very easily reproducable if you install the 64-bit libSM (without abi_x86_32) as a dependence (not in @world AFAIK) and then try to build freeglut with abi_x86_32 on amd64, you should be able to see the same fault.
Comment 3 Alex 2018-04-18 01:27:34 UTC
Interesting. 

Just run into almost same bug. I've set abi_x86_32 on bunch of packets too to have wine installed, and in the middle of emerging freeglut fails:

[ 62%] Linking C shared library lib/libglut.so
/usr/bin/cmake -E cmake_link_script CMakeFiles/freeglut.dir/link.txt --verbose=1
/usr/lib64/ccache/bin/x86_64-pc-linux-gnu-gcc -m32 -fPIC -O2 -pipe -march=native -Wall -pedantic -Wl,-O1 -Wl,--as-needed -shared -Wl,-soname,libglut.so.3 -o lib/libglut.so.3.10.0 CMakeFiles/freeglut.dir/src/fg_callbacks.c.o CMakeFiles/freeglut.dir/src/fg_cursor.c.o CMakeFiles/freeglut.dir/src/fg_display.c.o CMakeFiles/freeglut.dir/src/fg_ext.c.o CMakeFiles/freeglut.dir/src/fg_font_data.c.o CMakeFiles/freeglut.dir/src/fg_gamemode.c.o CMakeFiles/freeglut.dir/src/fg_geometry.c.o CMakeFiles/freeglut.dir/src/fg_gl2.c.o CMakeFiles/freeglut.dir/src/fg_init.c.o CMakeFiles/freeglut.dir/src/fg_input_devices.c.o CMakeFiles/freeglut.dir/src/fg_joystick.c.o CMakeFiles/freeglut.dir/src/fg_main.c.o CMakeFiles/freeglut.dir/src/fg_misc.c.o CMakeFiles/freeglut.dir/src/fg_overlay.c.o CMakeFiles/freeglut.dir/src/fg_spaceball.c.o CMakeFiles/freeglut.dir/src/fg_state.c.o CMakeFiles/freeglut.dir/src/fg_stroke_mono_roman.c.o CMakeFiles/freeglut.dir/src/fg_stroke_roman.c.o CMakeFiles/freeglut.dir/src/fg_structure.c.o CMakeFiles/freeglut.dir/src/fg_teapot.c.o CMakeFiles/freeglut.dir/src/fg_videoresize.c.o CMakeFiles/freeglut.dir/src/fg_window.c.o CMakeFiles/freeglut.dir/src/fg_font.c.o CMakeFiles/freeglut.dir/src/fg_menu.c.o CMakeFiles/freeglut.dir/src/x11/fg_cursor_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_ext_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_gamemode_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_glutfont_definitions_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_init_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_input_devices_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_joystick_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_main_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_menu_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_spaceball_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_state_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_structure_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_window_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_xinput_x11.c.o CMakeFiles/freeglut.dir/src/x11/fg_display_x11_glx.c.o CMakeFiles/freeglut.dir/src/x11/fg_state_x11_glx.c.o CMakeFiles/freeglut.dir/src/x11/fg_window_x11_glx.c.o CMakeFiles/freeglut.dir/src/util/xparsegeometry_repl.c.o -lGL -lm -lSM -lICE -lX11 -lXext -lXrandr -lXxf86vm -lXi 
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: skipping incompatible /usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../libGL.so when searching for -lGL
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: skipping incompatible /usr/lib/libGL.so when searching for -lGL
/usr/lib/gcc/x86_64-pc-linux-gnu/7.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: cannot find -lGL
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/freeglut.dir/build.make:1169: lib/libglut.so.3.10.0] Error 1
make[2]: Leaving directory '/var/tmp/portage/media-libs/freeglut-3.0.0/work/freeglut-3.0.0-abi_x86_32.x86'
make[1]: *** [CMakeFiles/Makefile2:68: CMakeFiles/freeglut.dir/all] Error 2
make[1]: Leaving directory '/var/tmp/portage/media-libs/freeglut-3.0.0/work/freeglut-3.0.0-abi_x86_32.x86'
make: *** [Makefile:130: all] Error 2
 * ERROR: media-libs/freeglut-3.0.0::gentoo failed (compile phase):
 *   emake failed


but it can't find -lGL instead of -lSM!
as mesa required abi_x86_32 too it was just rebuilt, but I checked it's files anyway:

# qlist mesa|grep libGL.so                                                                                                                                                                                     
/usr/lib32/libGL.so.1                                                                                                                                                                                                         
/usr/lib32/libGL.so.1.2.0                                                                                                                                                                                                     
/usr/lib64/libGL.so                                                                                                                                                                                                           
/usr/lib64/libGL.so.1                                                                                                                                                                                                         
/usr/lib64/libGL.so.1.2.0 

looks all right. except there is no symlink libGL.so in lib32 directory!
# ln -s libGL.so.1.2.0 /usr/lib32/libGL.so
and freeglut builds just fine.

now I want to know why my mesa got built like this.
can provide emerge --info too, but I doubt that will help.
Comment 4 Andreas Thalhammer 2018-04-18 16:44:09 UTC
(In reply to Alex from comment #3)
> now I want to know why my mesa got built like this.
> can provide emerge --info too, but I doubt that will help.

Is is possible that "eselect mesa" does the symlinking? If so, what does "eselect mesa list" output? I don't know if it also selects 32-bit libraries, but "linux32" should run it in 32-bit mode...

I cannot fully understand /usr/share/eselect/modules/mesa.eselect so I have to guess.

On my system both the 32-bit and the 64-bit symlinks libGL.so are present. BTW, I have /usr/lib64 and /usr/lib, not /usr/lib32 on my system. I think this is the preferred way now, see https://wiki.gentoo.org/wiki/Project:AMD64/Multilib_layout
Comment 5 Alex 2018-04-24 20:05:28 UTC
`eselect mesa/opengl list` shows asterisks in proper places. after rebuilding mesa everything was fine.

It could be just my issue - I accidently whole /etc/portage/package.keywords and had to re-create it from old backup and guesswork.

Then again, portage tried to emerge 32bit freeglut before emerging 32bit mesa, it started working after I did that by hand.
Comment 6 Matt Turner gentoo-dev 2018-06-11 04:37:42 UTC
I'm thinking both of these problems are eselect-mesa being incompatible with the 17.1 profile. eselect-mesa is gone from mesa-18.1.1-r1, and I'm not planning to touch eselect-mesa except to remove it.

I guess I'll mark as WONTFIX...
Comment 7 Andreas Thalhammer 2018-06-15 14:25:11 UTC
(In reply to Matt Turner from comment #6)
> I'm thinking both of these problems are eselect-mesa being incompatible with
> the 17.1 profile. eselect-mesa is gone from mesa-18.1.1-r1, and I'm not
> planning to touch eselect-mesa except to remove it.
> 
> I guess I'll mark as WONTFIX...

How is media-libs/freeglut[abi_x86_32] NOT depending on abi_x86_32? (x11-libs/libSM[abi_x86_32] related to eselect-mesa?
Comment 8 Larry the Git Cow gentoo-dev 2019-03-27 19:54:29 UTC
The bug has been closed via the following commit(s):

https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=27083133bfb71b4fe269d35b4158e553859d81fe

commit 27083133bfb71b4fe269d35b4158e553859d81fe
Author:     Matt Turner <mattst88@gentoo.org>
AuthorDate: 2019-03-27 19:36:24 +0000
Commit:     Matt Turner <mattst88@gentoo.org>
CommitDate: 2019-03-27 19:54:01 +0000

    media-libs/freeglut: Drop linking with unnecessary X11 libs
    
    Many thanks go to Christian <christian@ch-sc.de> for tracking down and
    fixing the bug!
    
    Closes: https://bugs.gentoo.org/557286
    Closes: https://bugs.gentoo.org/647326
    Closes: https://bugs.gentoo.org/658936
    Signed-off-by: Matt Turner <mattst88@gentoo.org>

 .../freeglut-3.0.0-drop-unnecessary-x11-libs.patch | 30 ++++++++++++++++++++++
 media-libs/freeglut/freeglut-3.0.0.ebuild          |  4 +++
 2 files changed, 34 insertions(+)
Comment 9 Andreas Thalhammer 2019-04-04 18:02:27 UTC
Thanks!