diasurgical / devilutionX

Diablo build for modern operating systems
Other
8.1k stars 796 forks source link

linux->windows mingw32 make error #686

Closed arrowgent closed 4 years ago

arrowgent commented 4 years ago

ubuntu 18.04 x64 attempting to compile win32

cmake version 3.10.2 GNU Make 4.1

cmake -DCMAKE_TOOLCHAIN_FILE=../CMake/mingwcc.cmake ..

-- The C compiler identification is GNU 7.3.0
-- The CXX compiler identification is GNU 7.3.0
-- Check for working C compiler: /usr/bin/i686-w64-mingw32-gcc
-- Check for working C compiler: /usr/bin/i686-w64-mingw32-gcc -- works
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Detecting C compile features
-- Detecting C compile features - done
-- Check for working CXX compiler: /usr/bin/i686-w64-mingw32-g++
-- Check for working CXX compiler: /usr/bin/i686-w64-mingw32-g++ -- works
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Looking for pthread.h
-- Looking for pthread.h - found
-- Looking for pthread_create
-- Looking for pthread_create - not found
-- Check if compiler accepts -pthread
-- Check if compiler accepts -pthread - yes
-- Found Threads: TRUE  
-- Found sodium: /usr/i686-w64-mingw32/lib/libsodium.a (found version "1.0.18") 
-- Found SDL2_ttf: /usr/i686-w64-mingw32/bin/SDL2_ttf.dll  
-- Found SDL2: /usr/i686-w64-mingw32/bin/SDL2.dll  
-- Found SDL2_mixer: /usr/i686-w64-mingw32/bin/SDL2_mixer.dll  
-- Configuring done
-- Generating done
-- Build files have been written to: /home/catbox/Downloads/dx/devilutionX-1.0.1/build

make -j$(nproc)

error:

[ 64%] Linking CXX static library libdevilution.a
[ 64%] Built target devilution
CMakeFiles/devilutionx.dir/build.make:1417: *** target pattern contains no '%'.  Stop.
CMakeFiles/Makefile2:256: recipe for target 'CMakeFiles/devilutionx.dir/all' failed
make[1]: *** [CMakeFiles/devilutionx.dir/all] Error 2
Makefile:83: recipe for target 'all' failed
make: *** [all] Error 2

CMakeFiles/devilutionx.dir/build.make:1417

devilutionx.exe: SDL2::SDL2-NOTFOUND

CMakeFiles/Makefile2:256

$(MAKE) -f CMakeFiles/PKWare.dir/build.make CMakeFiles/PKWare.dir/3rdParty/PKWare/implode.cpp.obj

CMakeError.log

Determining if the pthread_create exist failed with the following output:
Change Dir: /home/catbox/Downloads/dx/devilutionX-1.0.1/build/CMakeFiles/CMakeTmp

Run Build Command:"/usr/bin/make" "cmTC_743a3/fast"
/usr/bin/make -f CMakeFiles/cmTC_743a3.dir/build.make CMakeFiles/cmTC_743a3.dir/build
make[1]: Entering directory '/home/catbox/Downloads/dx/devilutionX-1.0.1/build/CMakeFiles/CMakeTmp'
Building C object CMakeFiles/cmTC_743a3.dir/CheckSymbolExists.c.obj
/usr/bin/i686-w64-mingw32-gcc    -o CMakeFiles/cmTC_743a3.dir/CheckSymbolExists.c.obj   -c /home/catbox/Downloads/dx/devilutionX-1.0.1/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c
Linking C executable cmTC_743a3.exe
/usr/bin/cmake -E cmake_link_script CMakeFiles/cmTC_743a3.dir/link.txt --verbose=1
/usr/bin/cmake -E remove -f CMakeFiles/cmTC_743a3.dir/objects.a
/usr/bin/i686-w64-mingw32-ar cr CMakeFiles/cmTC_743a3.dir/objects.a @CMakeFiles/cmTC_743a3.dir/objects1.rsp
/usr/bin/i686-w64-mingw32-gcc      -Wl,--whole-archive CMakeFiles/cmTC_743a3.dir/objects.a -Wl,--no-whole-archive  -o cmTC_743a3.exe -Wl,--out-implib,libcmTC_743a3.dll.a -Wl,--major-image-version,0,--minor-image-version,0 @CMakeFiles/cmTC_743a3.dir/linklibs.rsp
CMakeFiles/cmTC_743a3.dir/objects.a(CheckSymbolExists.c.obj):CheckSymbolExists.c:(.text+0x12): undefined reference to `pthread_create'
collect2: error: ld returned 1 exit status
CMakeFiles/cmTC_743a3.dir/build.make:99: recipe for target 'cmTC_743a3.exe' failed
make[1]: *** [cmTC_743a3.exe] Error 1
make[1]: Leaving directory '/home/catbox/Downloads/dx/devilutionX-1.0.1/build/CMakeFiles/CMakeTmp'
Makefile:126: recipe for target 'cmTC_743a3/fast' failed
make: *** [cmTC_743a3/fast] Error 2

File /home/catbox/Downloads/dx/devilutionX-1.0.1/build/CMakeFiles/CMakeTmp/CheckSymbolExists.c:
/* */
#include <pthread.h>

int main(int argc, char** argv)
{
  (void)argv;
#ifndef pthread_create
  return ((int*)(&pthread_create))[argc];
#else
  (void)argc;
  return 0;
#endif
}

compile for linux version completes fine

AJenbo commented 4 years ago

Did you download the SDL2 source and place it in a folder where the compiler can find it?

Maybe perform the steps that the build bot does when setting up the env and compiling: https://github.com/diasurgical/devilutionX/blob/master/.circleci/config.yml#L62

arrowgent commented 4 years ago

Did you download the SDL2 source and place it in a folder where the compiler can find it?

-- Found sodium: /usr/i686-w64-mingw32/lib/libsodium.a (found version "1.0.18") 
-- Found SDL2_ttf: /usr/i686-w64-mingw32/bin/SDL2_ttf.dll  
-- Found SDL2: /usr/i686-w64-mingw32/bin/SDL2.dll  
-- Found SDL2_mixer: /usr/i686-w64-mingw32/bin/SDL2_mixer.dll  
arrowgent commented 4 years ago

Maybe perform the steps that the build bot does when setting up the env and compiling: https://github.com/diasurgical/devilutionX/blob/master/.circleci/config.yml#L62

same issue

Performing Test CMAKE_HAVE_LIBC_PTHREAD - Failed seems to be what is failing, researching how to fix this ?? no idea

however, versions your nightly pulls are different from the latest versions

SDL2-devel-2.0.9-mingw.tar.gz vs SDL2-devel-2.0.12-mingw.tar.gz

and

libsodium-1.0.17-mingw.tar.gz vs libsodium-1.0.18-mingw.tar.gz

i will download those versions...

arrowgent commented 4 years ago

confirmed

versions your nightly pulls are different from the latest versions

SDL2-devel-2.0.9-mingw.tar.gz vs SDL2-devel-2.0.12-mingw.tar.gz

and

libsodium-1.0.17-mingw.tar.gz vs libsodium-1.0.18-mingw.tar.gz

new issue:

[100%] Linking CXX executable devilutionx.exe
/usr/i686-w64-mingw32/lib/libSDL2main.a(SDL_windows_main.o): In function `main_getcmdline':
/Users/valve/release/SDL/SDL2-2.0.9-source/foo-x86/../src/main/windows/SDL_windows_main.c:172: undefined reference to `SDL_SetMainReady'
collect2: error: ld returned 1 exit status
CMakeFiles/devilutionx.dir/build.make:888: recipe for target 'devilutionx.exe' failed
make[2]: *** [devilutionx.exe] Error 1
CMakeFiles/Makefile2:241: recipe for target 'CMakeFiles/devilutionx.dir/all' failed
make[1]: *** [CMakeFiles/devilutionx.dir/all] Error 2
Makefile:100: recipe for target 'all' failed
make: *** [all] Error 2
arrowgent commented 4 years ago

CmakeLists.txt move SDL2main before other libraries instead of the end

    target_link_libraries(${target} PRIVATE
      SDL2::SDL2main
      SDL2::SDL2_ttf
      SDL2::SDL2_mixer)

[100%] Linking CXX executable devilutionx.exe [100%] Built target devilutionx

AJenbo commented 4 years ago

I'm not sure if you figured out the issue on your end, but if there are changes required please send a PR. You are also welcome to update the library versions that it fetches. However, we aren't using any featuers from the latest versions and they are forwards compatible.

arrowgent commented 4 years ago

sorry, im new to doing github work. i am learning

thanks for your help

arrowgent commented 4 years ago

I'm not sure if you figured out the issue on your end, but if there are changes required please send a PR. You are also welcome to update the library versions that it fetches. However, we aren't using any featuers from the latest versions and they are forwards compatible.

yes, it compiled correctly and runs on windows flawlessly.

AJenbo commented 4 years ago

thanks