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

Weird build errors #392

Closed
v1993 opened this issue Mar 19, 2019 · 6 comments
Assignees
Labels

Comments

@v1993
Copy link

@v1993 v1993 commented Mar 19, 2019

Please fill out this form:

Expected behavior

VBA-M builds normally using CMake and clang.

Actual behavior

v@v-xubuntu:~/compile/visualboyadvance-m/build$ cmake .. -GNinja -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_C_COMPILER=clang -DCMAKE_INSTALL_PREFIX=/home/v/.local
… (Runs fine)
v@v-xubuntu:~/compile/visualboyadvance-m/build$ ninja -j8
… (Compilation with a lot of warnings about register spec deprecation)
[185/185] Linking CXX executable visualboyadvance-m
FAILED: visualboyadvance-m
: && ccache /usr/bin/clang++  -pthread -O3 -DNDEBUG  -rdynamic src/wx/CMakeFiles/visualboyadvance-m.dir/wxvbam.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/guiinit.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/viewers.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/gfxviewers.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/cmdevents.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/opts.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/sys.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/panel.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/viewsupt.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/wayland.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/strutils.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/widgets/keyedit.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/widgets/joyedit.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/widgets/sdljoy.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/widgets/wxmisc.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/__/sdl/text.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/widgets/checkedlistctrl.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/cmdtab.cpp.o  -o visualboyadvance-m -L/home/v/compile/visualboyadvance-m/build -Wl,-rpath,/home/v/compile/visualboyadvance-m/build libvbamcore.a fex/libfex.a -Wl,-Bstatic -lSDL2main -Wl,-Bdynamic -lSDL2 -lpthread -lsfml-network -lsfml-system -lGL -lGLU -lz -lpng -lrt -lpthread -L/usr/lib/x86_64-linux-gnu -pthread -lwx_gtk2u_xrc-3.0 -lwx_baseu_xml-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_adv-3.0 -lwx_baseu_net-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu-3.0 -lwx_gtk2u_gl-3.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype  -pipe -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -feliminate-unused-debug-types -fPIC -mfpmath=sse -msse2 -O2 -fomit-frame-pointer -flto -mtune=generic -Wno-error  && :
/usr/bin/ld: libvbamcore.a: error adding symbols: archive has no index; run ranlib to add one
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
(Normal build failed, below is how I fix it manually)
v@v-xubuntu:~/compile/visualboyadvance-m/build$ llvm-ranlib libvbamcore.a
v@v-xubuntu:~/compile/visualboyadvance-m/build$ ninja -j8
[1/1] Linking CXX executable visualboyadvance-m
FAILED: visualboyadvance-m
: && ccache /usr/bin/clang++  -pthread -O3 -DNDEBUG  -rdynamic src/wx/CMakeFiles/visualboyadvance-m.dir/wxvbam.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/guiinit.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/viewers.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/gfxviewers.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/cmdevents.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/opts.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/sys.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/panel.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/viewsupt.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/wayland.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/strutils.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/widgets/keyedit.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/widgets/joyedit.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/widgets/sdljoy.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/widgets/wxmisc.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/__/sdl/text.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/widgets/checkedlistctrl.cpp.o src/wx/CMakeFiles/visualboyadvance-m.dir/cmdtab.cpp.o  -o visualboyadvance-m -L/home/v/compile/visualboyadvance-m/build -Wl,-rpath,/home/v/compile/visualboyadvance-m/build libvbamcore.a fex/libfex.a -Wl,-Bstatic -lSDL2main -Wl,-Bdynamic -lSDL2 -lpthread -lsfml-network -lsfml-system -lGL -lGLU -lz -lpng -lrt -lpthread -L/usr/lib/x86_64-linux-gnu -pthread -lwx_gtk2u_xrc-3.0 -lwx_baseu_xml-3.0 -lwx_gtk2u_html-3.0 -lwx_gtk2u_adv-3.0 -lwx_baseu_net-3.0 -lwx_gtk2u_core-3.0 -lwx_baseu-3.0 -lwx_gtk2u_gl-3.0 -lgtk-x11-2.0 -lgdk-x11-2.0 -lpangocairo-1.0 -latk-1.0 -lcairo -lgdk_pixbuf-2.0 -lgio-2.0 -lpangoft2-1.0 -lpango-1.0 -lgobject-2.0 -lglib-2.0 -lfontconfig -lfreetype  -pipe -Wformat -Wformat-security -D_FORTIFY_SOURCE=2 -feliminate-unused-debug-types -fPIC -mfpmath=sse -msse2 -O2 -fomit-frame-pointer -flto -mtune=generic -Wno-error  && :
/usr/bin/ld: fex/libfex.a: error adding symbols: archive has no index; run ranlib to add one
clang: error: linker command failed with exit code 1 (use -v to see invocation)
ninja: build stopped: subcommand failed.
(Great, another lib to fix)
v@v-xubuntu:~/compile/visualboyadvance-m/build$ llvm-ranlib fex/libfex.a
v@v-xubuntu:~/compile/visualboyadvance-m/build$ ninja -j8
[1/1] Linking CXX executable visualboyadvance-m
(And now we're fine)

Steps to reproduce the behavior

I guess that this can be reproduced using commands from previous section. You'll need ninja build tool and clang/llvm. All the stuff is done on Ubuntu 18.10.

Crash bugs

If this is a crash bug, and it is not one.

ROM details

Which games are affected by the issue (please state if GBA or GB game): pretty much all of them because it prevents emulator from building and running.

Which games, if any, are NOT affected by the issue (please state if GBA or GB game):

Include screenshots of ROM Information (File > ROM Information):

Build details

Operating System (Windows, Mac, Linux (state distribution), etc.): Ubuntu 18.10

If using Linux, specify if using xorg or Wayland: XOrg, but who cares at this step.

Version of code (pre-built binary version, or commit ref, or just "master"): git master (commit c714ff8)

Hardware details:

Nothing related to problem.

@rkitover

This comment has been minimized.

Copy link
Collaborator

@rkitover rkitover commented Mar 19, 2019

So if the issue is that cmake is supposed to use llvm-ranlib and not regular ranlib, how is it supposed to know this? Is there perhaps a toolchain file for clang you are supposed to use?

@rkitover

This comment has been minimized.

Copy link
Collaborator

@rkitover rkitover commented Mar 19, 2019

Another option is to use a bin/ directory in your path, with symlinks to all the tools you want, e.g. ranlib -> llvm-ranlib, cc -> clang, c++ -> clang++.

rkitover added a commit that referenced this issue Mar 20, 2019
Use `clang -print-prog-path=<tool>` to find the locations of llvm
toolchain utilities such as `llvm-ranlib` and set the appropriate cmake
variables to the resultant paths.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
@rkitover

This comment has been minimized.

Copy link
Collaborator

@rkitover rkitover commented Mar 20, 2019

Fixed in master btw, at least for this project, you will have this problem with other projects.

@rkitover rkitover self-assigned this Mar 20, 2019
@rkitover rkitover closed this Mar 20, 2019
@v1993

This comment has been minimized.

Copy link
Author

@v1993 v1993 commented Mar 21, 2019

I've used clang for a lot of other projects (including ones where static libs are built first and then linked together), never met any errors. That's weird part for me.

I'll try git master, thanks.

@v1993

This comment has been minimized.

Copy link
Author

@v1993 v1993 commented Mar 21, 2019

As a sidenote, is VBA-M using SDL (not SDL2) for joysticks? Because it's probably only one place where they act like uncalibrated ones.

@rkitover

This comment has been minimized.

Copy link
Collaborator

@rkitover rkitover commented Mar 21, 2019

Yes SDL2 is used for joystick, if there is a better thing we can use I could switch.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.