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

Can't build shlib using ucrt64 #26

Open
Morilli opened this issue Jun 23, 2024 · 0 comments
Open

Can't build shlib using ucrt64 #26

Morilli opened this issue Jun 23, 2024 · 0 comments

Comments

@Morilli
Copy link

Morilli commented Jun 23, 2024

I'm trying to build the shlib target from source, and it fails with the following error message:

$ ./scripts/build_shlib.sh 
cd libgambatte && scons shlib 
scons: Reading SConscript files ...
Checking for C header file zlib.h... no

scons: *** Two environments with different actions were specified for the same target: src\bitmap_font.obj
(action 1: cl /Fobitmap_font.obj /c bitmap_font.cpp -Wall -Wextra -O2 -fomit-frame-pointer -fno-exceptions -fno-rtti -std=c++11 -DHAVE_STDINT_H /nologo)
(action 2: cl /Fobitmap_font.obj /c bitmap_font.cpp -Wall -Wextra -O2 -fomit-frame-pointer -fno-exceptions -fno-rtti -std=c++11 -DHAVE_STDINT_H -DSHLIB -DREVISION=830 /nologo)
File "D:\GitHub\BizHawk\submodules\gambatte\libgambatte\SConstruct", line 101, in <module>

Apparently, cl is detected and preferred over gcc, even though cl isn't on path and gcc is (thanks scons).
The documentation specifies the following: On Windows systems which identify as win32, scons searches in order for the Microsoft Visual C++ tools, the MinGW tool chain, the Intel compiler tools, and the PharLap ETS compiler. On Windows system which identify as cygwin (that is, if scons is invoked from a cygwin shell), the order changes to prefer the GCC toolchain over the MSVC tools.
Clearly, cygwin != msys so scons tries to use cl.

To force mingw(-ish) compilers to be used, the following diff can be applied:

diff --git a/libgambatte/SConstruct b/libgambatte/SConstruct
index 6204abd0..64f75734 100644
--- a/libgambatte/SConstruct
+++ b/libgambatte/SConstruct
@@ -7,6 +7,7 @@ vars.Add('CXX')

 import os
 env = Environment(ENV = os.environ,
+                  tools = ['mingw'],
                   CPPPATH = ['src', 'include', '../common'],
                   CFLAGS = global_cflags + global_defines,
                   CXXFLAGS = global_cxxflags + global_defines,

However, building with that still gives me a similar error, just with g++ instead of cl:

$ ./scripts/build_shlib.sh 
cd libgambatte && scons shlib 
scons: Reading SConscript files ...
Checking for C header file zlib.h... yes

scons: *** Two environments with different actions were specified for the same target: src\bitmap_font.o
(action 1: g++ -o bitmap_font.o -c -Wall -Wextra -O2 -fomit-frame-pointer -fno-exceptions -fno-rtti -std=c++11 -DHAVE_STDINT_H -DHAVE_ZLIB_H bitmap_font.cpp)
(action 2: g++ -o bitmap_font.o -c -Wall -Wextra -O2 -fomit-frame-pointer -fno-exceptions -fno-rtti -std=c++11 -DHAVE_STDINT_H -DSHLIB -DREVISION=830 -DHAVE_ZLIB_H bitmap_font.cpp)
File "D:\GitHub\BizHawk\submodules\gambatte\libgambatte\SConstruct", line 102, in <module>
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

No branches or pull requests

1 participant