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

Building c-shared library fails #343

Closed
Wieku opened this issue Oct 2, 2024 · 1 comment
Closed

Building c-shared library fails #343

Wieku opened this issue Oct 2, 2024 · 1 comment
Labels
documentation Improvements or additions to documentation

Comments

@Wieku
Copy link
Contributor

Wieku commented Oct 2, 2024

I'm trying to build a Linux version of my app, which first compiles it into a shared library that's loaded from executables. It builds fine on Windows, but I get this error on Linux:

/usr/bin/g++ -m64 -s -Wl,-z,relro -shared -Wl,-z,nodelete -Wl,-Bsymbolic -o a.out -rdynamic -Wl,--compress-debug-sections=zlib /tmp/go-link-3837878212/go.o /tmp/go-link-3837878212/000000.o /tmp/go-link-3837878212/000001.o /tmp/go-link-3837878212/000002.o /tmp/go-link-3837878212/000003.o /tmp/go-link-3837878212/000004.o /tmp/go-link-3837878212/000005.o /tmp/go-link-3837878212/000006.o /tmp/go-link-3837878212/000007.o /tmp/go-link-3837878212/000008.o /tmp/go-link-3837878212/000009.o /tmp/go-link-3837878212/000010.o /tmp/go-link-3837878212/000011.o /tmp/go-link-3837878212/000012.o /tmp/go-link-3837878212/000013.o /tmp/go-link-3837878212/000014.o /tmp/go-link-3837878212/000015.o /tmp/go-link-3837878212/000016.o /tmp/go-link-3837878212/000017.o /tmp/go-link-3837878212/000018.o /tmp/go-link-3837878212/000019.o /tmp/go-link-3837878212/000020.o /tmp/go-link-3837878212/000021.o /tmp/go-link-3837878212/000022.o /tmp/go-link-3837878212/000023.o /tmp/go-link-3837878212/000024.o /tmp/go-link-3837878212/000025.o /tmp/go-link-3837878212/000026.o /tmp/go-link-3837878212/000027.o /tmp/go-link-3837878212/000028.o /tmp/go-link-3837878212/000029.o /tmp/go-link-3837878212/000030.o /tmp/go-link-3837878212/000031.o /tmp/go-link-3837878212/000032.o /tmp/go-link-3837878212/000033.o /tmp/go-link-3837878212/000034.o /tmp/go-link-3837878212/000035.o /tmp/go-link-3837878212/000036.o /tmp/go-link-3837878212/000037.o /tmp/go-link-3837878212/000038.o /tmp/go-link-3837878212/000039.o /tmp/go-link-3837878212/000040.o /tmp/go-link-3837878212/000041.o /tmp/go-link-3837878212/000042.o /tmp/go-link-3837878212/000043.o /tmp/go-link-3837878212/000044.o /tmp/go-link-3837878212/000045.o /tmp/go-link-3837878212/000046.o /tmp/go-link-3837878212/000047.o /tmp/go-link-3837878212/000048.o /tmp/go-link-3837878212/000049.o /tmp/go-link-3837878212/000050.o /tmp/go-link-3837878212/000051.o /tmp/go-link-3837878212/000052.o /tmp/go-link-3837878212/000053.o /tmp/go-link-3837878212/000054.o /tmp/go-link-3837878212/000055.o /tmp/go-link-3837878212/000056.o /tmp/go-link-3837878212/000057.o /tmp/go-link-3837878212/000058.o /tmp/go-link-3837878212/000059.o /tmp/go-link-3837878212/000060.o /tmp/go-link-3837878212/000061.o /tmp/go-link-3837878212/000062.o /tmp/go-link-3837878212/000063.o /tmp/go-link-3837878212/000064.o /tmp/go-link-3837878212/000065.o /tmp/go-link-3837878212/000066.o /tmp/go-link-3837878212/000067.o /tmp/go-link-3837878212/000068.o /tmp/go-link-3837878212/000069.o /tmp/go-link-3837878212/000070.o /tmp/go-link-3837878212/000071.o /tmp/go-link-3837878212/000072.o /tmp/go-link-3837878212/000073.o /tmp/go-link-3837878212/000074.o /tmp/go-link-3837878212/000075.o /tmp/go-link-3837878212/000076.o /tmp/go-link-3837878212/000077.o /tmp/go-link-3837878212/000078.o /tmp/go-link-3837878212/000079.o /tmp/go-link-3837878212/000080.o /tmp/go-link-3837878212/000081.o /tmp/go-link-3837878212/000082.o /tmp/go-link-3837878212/000083.o /tmp/go-link-3837878212/000084.o /tmp/go-link-3837878212/000085.o /tmp/go-link-3837878212/000086.o /tmp/go-link-3837878212/000087.o /tmp/go-link-3837878212/000088.o /tmp/go-link-3837878212/000089.o /tmp/go-link-3837878212/000090.o /tmp/go-link-3837878212/000091.o /tmp/go-link-3837878212/000092.o /tmp/go-link-3837878212/000093.o /tmp/go-link-3837878212/000094.o /tmp/go-link-3837878212/000095.o /tmp/go-link-3837878212/000096.o /tmp/go-link-3837878212/000097.o /tmp/go-link-3837878212/000098.o /tmp/go-link-3837878212/000099.o /tmp/go-link-3837878212/000100.o -O2 -g -O2 -g -lpthread -O2 -g -O2 -g -O2 -g -L/usr/lib/x86_64-linux-gnu -lGL -O2 -g -lGL -lX11 -lXrandr -lXxf86vm -lXi -lXcursor -lm -lXinerama -ldl -lrt -O2 -g -Wl,-rpath,$ORIGIN -L/home/runner/work/danser-go/danser-go/framework/bass -L/home/runner/work/danser-go/danser-go/framework/bass/../../ -L/usr/lib/danser -L/usr/lib -lbass -lbass_fx -lbassmix -O2 -g -O2 -g -O2 -g /home/runner/go/pkg/mod/github.com/!allen!dang/[email protected]/imgui/../lib/linux/x64/cimgui.a -O2 -g -lX11 -L/usr/lib/x86_64-linux-gnu -lgtk-3 -lgdk-3 -lpangocairo-1.0 -lpango-1.0 -lharfbuzz -latk-1.0 -lcairo-gobject -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lgobject-2.0 -lglib-2.0 -O2 -g -lm -O2 -g -ldl -O2 -g -Wl,-rpath,$ORIGIN -L/home/runner/work/danser-go/danser-go/framework/util/pixconv -L/home/runner/work/danser-go/danser-go/framework/util/pixconv/../../../ -L/usr/lib/danser -L/usr/lib -lyuv -O2 -g -O2 -g -lresolv
/usr/bin/ld: /home/runner/work/danser-go/danser-go/framework/bass/../..//libbass.so: .dynsym local symbol at index 2 (>= sh_info of 2)
/usr/bin/ld: /home/runner/work/danser-go/danser-go/framework/bass/../..//libbass.so: .dynsym local symbol at index 3 (>= sh_info of 2)
/usr/bin/ld: /home/runner/work/danser-go/danser-go/framework/bass/../..//libbass.so: .dynsym local symbol at index 4 (>= sh_info of 2)
/usr/bin/ld: /home/runner/work/danser-go/danser-go/framework/bass/../..//libbassmix.so: .dynsym local symbol at index 2 (>= sh_info of 2)
/usr/bin/ld: /home/runner/work/danser-go/danser-go/framework/bass/../..//libbassmix.so: .dynsym local symbol at index 3 (>= sh_info of 2)
/usr/bin/ld: /home/runner/work/danser-go/danser-go/framework/bass/../..//libbassmix.so: .dynsym local symbol at index 4 (>= sh_info of 2)
/usr/bin/ld: /home/runner/go/pkg/mod/github.com/!allen!dang/[email protected]/imgui/../lib/linux/x64/cimgui.a(imgui.cpp.o): relocation R_X86_64_PC32 against symbol `stdout@@GLIBC_2.2.5' can not be used when making a shared object; recompile with -fPIC
/usr/bin/ld: final link failed: bad value
collect2: error: ld returned 1 exit status

From what I've read, PIC static libraries have worse performance, so I guess it's not desirable for cimgui-go. I will probably create a fork just for my program with PIC cimgui.a, just wanted to put it there as a warning to others.

I guess another con of having a statically build cimgui 😅

@gucio321
Copy link
Collaborator

gucio321 commented Oct 13, 2024

I guess another con of having a statically build cimgui 😅

Can't find any better way for now...

let me close this and put documentation label. Please put your fork's URL here when you create it.

EDIT (sidenote) there is already an issue for auto-building cimgui-go #157

@gucio321 gucio321 added the documentation Improvements or additions to documentation label Oct 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation
Projects
None yet
Development

No branches or pull requests

2 participants