ousnius / BodySlide-and-Outfit-Studio

BodySlide and Outfit Studio, a tool to convert, create, and customize outfits and bodies for Bethesda games.
GNU General Public License v3.0
286 stars 63 forks source link

Cmake fails on Linux (lib/nifly/src/Animation.cpp not found) #455

Closed Rabcor closed 2 years ago

Rabcor commented 2 years ago

Output of cmake command:

$ cmake -DCMAKE_BUILD_TYPE=Release ..
CMake Warning (dev) at /usr/share/cmake/Modules/FindOpenGL.cmake:315 (message):
  Policy CMP0072 is not set: FindOpenGL prefers GLVND by default when
  available.  Run "cmake --help-policy CMP0072" for policy details.  Use the
  cmake_policy command to set the policy and suppress this warning.

  FindOpenGL found both a legacy GL library:

    OPENGL_gl_LIBRARY: /usr/lib/libGL.so

  and GLVND libraries for OpenGL and GLX:

    OPENGL_opengl_LIBRARY: /usr/lib/libOpenGL.so
    OPENGL_glx_LIBRARY: /usr/lib/libGLX.so

  OpenGL_GL_PREFERENCE has not been set to "GLVND" or "LEGACY", so for
  compatibility with CMake 3.10 and below the legacy GL library will be used.
Call Stack (most recent call first):
  CMakeLists.txt:8 (find_package)
This warning is for project developers.  Use -Wno-dev to suppress it.

-- Configuring done
CMake Error at CMakeLists.txt:97 (add_executable):
  Cannot find source file:

    lib/nifly/src/Animation.cpp

  Tried extensions .c .C .c++ .cc .cpp .cxx .cu .mpp .m .M .mm .ixx .cppm .h
  .hh .h++ .hm .hpp .hxx .in .txx .f .F .for .f77 .f90 .f95 .f03 .hip .ispc

CMake Error at CMakeLists.txt:97 (add_executable):
  No SOURCES given to target: OutfitStudio

CMake Error at CMakeLists.txt:98 (add_executable):
  No SOURCES given to target: BodySlide

CMake Generate step failed.  Build files cannot be regenerated correctly.

This Animation.cpp is indeed missing from the release files; the lib/nifly directory is empty.

Copying the files over from the nifly git fixes it, the files need to be included in the release tarball.

That said, the make command fails after this too, this is a different issue but I didn't feel it deserved a separate post. If I try to build from Release (as suggested in readme) it gives an error about no makefile.

If I try to build from the base directory instead, I get these errors:

$ make -j 8
Consolidate compiler generated dependencies of target BodySlide
Consolidate compiler generated dependencies of target OutfitStudio
[  3%] Building CXX object CMakeFiles/BodySlide.dir/lib/nifly/src/ExtraData.cpp.o
[  3%] Building CXX object CMakeFiles/BodySlide.dir/lib/nifly/src/bhk.cpp.o
[  3%] Building CXX object CMakeFiles/BodySlide.dir/lib/nifly/src/BasicTypes.cpp.o
[  3%] Building CXX object CMakeFiles/BodySlide.dir/lib/nifly/src/Factory.cpp.o
[  3%] Building CXX object CMakeFiles/BodySlide.dir/lib/FSEngine/FSBSA.cpp.o
[  4%] Building CXX object CMakeFiles/BodySlide.dir/lib/nifly/src/Geometry.cpp.o
[  5%] Building CXX object CMakeFiles/BodySlide.dir/lib/nifly/src/NifFile.cpp.o
[  6%] Building CXX object CMakeFiles/OutfitStudio.dir/lib/FSEngine/FSBSA.cpp.o
In file included from /usr/include/wine/windows/windows.h:37,
                 from /usr/include/wine/windows/dxgiformat.h:12,
                 from /home/rabcor/Downloads/BodySlide-and-Outfit-Studio-5.5.2/lib/FSEngine/../DDS.h:22,
                 from /home/rabcor/Downloads/BodySlide-and-Outfit-Studio-5.5.2/lib/FSEngine/FSBSA.cpp:34:
/usr/include/wx-3.1/wx/stream.h:84:5: error: ‘virtual wxClassInfo* wxStreamBase::GetClassInfoW() const’ marked ‘override’, but does not override
   84 |     wxDECLARE_ABSTRACT_CLASS(wxStreamBase);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/wx-3.1/wx/stream.h:375:5: error: ‘virtual wxClassInfo* wxFilterClassFactoryBase::GetClassInfoW() const’ marked ‘override’, but does not override
  375 |     wxDECLARE_ABSTRACT_CLASS(wxFilterClassFactoryBase);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/OutfitStudio.dir/build.make:76: CMakeFiles/OutfitStudio.dir/lib/FSEngine/FSBSA.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/OutfitStudio.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
[  7%] Building CXX object CMakeFiles/BodySlide.dir/lib/nifly/src/Nodes.cpp.o
In file included from /usr/include/wine/windows/windows.h:37,
                 from /usr/include/wine/windows/dxgiformat.h:12,
                 from /home/rabcor/Downloads/BodySlide-and-Outfit-Studio-5.5.2/lib/FSEngine/../DDS.h:22,
                 from /home/rabcor/Downloads/BodySlide-and-Outfit-Studio-5.5.2/lib/FSEngine/FSBSA.cpp:34:
/usr/include/wx-3.1/wx/stream.h:84:5: error: ‘virtual wxClassInfo* wxStreamBase::GetClassInfoW() const’ marked ‘override’, but does not override
   84 |     wxDECLARE_ABSTRACT_CLASS(wxStreamBase);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/wx-3.1/wx/stream.h:375:5: error: ‘virtual wxClassInfo* wxFilterClassFactoryBase::GetClassInfoW() const’ marked ‘override’, but does not override
  375 |     wxDECLARE_ABSTRACT_CLASS(wxFilterClassFactoryBase);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/BodySlide.dir/build.make:76: CMakeFiles/BodySlide.dir/lib/FSEngine/FSBSA.cpp.o] Error 1
make[2]: *** Waiting for unfinished jobs....
make[1]: *** [CMakeFiles/Makefile2:111: CMakeFiles/BodySlide.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

It's clearly an issue with wxwidgets/wxgtk, but beyond that I'm kinda clueless, when I try with wxgtk2 I get: fatal error: wx/setup.h: No such file or directory

ousnius commented 2 years ago

Unfortunately I have no experience with wxWidgets on Linux, so I can't help with that. @sts1skj might be able to, as he builds and uses it successfully on Linux.

As for the "missing" lib/nifly files - nifly is a Git submodule that you need to pull, which is why the files aren't there initially. Manually copying over the files works initially, but is the wrong thing to do. You should read about how to pull and work with Git submodules

sts1skj commented 2 years ago

@Rabcor:

  1. The cmake warning about OpenGL versions and policy CMP0072 was fixed in commit 94555ac. So you're not using the latest source code.
  2. You're not using the latest source code. Judging from your source code directory name "BodySlide-and-Outfit-Studio-5.5.2", I would guess you're using the 5.5.2 release source code, which is quite out of date. Use the latest source code. Note that ousnius occasionally makes changes to the source code that break building on Linux, and I don't always get around to fixing it right away, so, if you want source code that builds on Linux, you should pick a commit where I've clearly been contributing lately. (For example, ousnius broke Linux building with commit ed7611d on April 3, 2022, and I didn't get around to fixing it until commit 94555ac on April 15.)
  3. As ousnius points out, the cmake error about not finding Animation.cpp is because you didn't grab the BS&OS source code correctly. If you're using git, you need to use the option to grab submodules. (I don't remember the name of the option.) According to my git notes, you can make git grab the nifly submodule later (if you didn't do it right the first time) by doing: git submodule update --init --recursive
  4. If make gives the error "No targets specified and no makefile found." when you run it in the Release directory, that means you didn't run cmake successfully in that directory. The current directory must be the Release directory when you run cmake. Do not run make or cmake from the base BS&OS directory.
  5. BS&OS uses C++-2017, so you need to use a recent version of gcc. On my OpenSuse 15.3 system, the default compiler is gcc 7, which is far too old. I have to set it manually to use the latest version (gcc 10) by setting the environment variables CC and CXX before running cmake.
  6. If you need to change any aspect of the cmake configuration, including changing the compiler, changing the build options, or changing the wxWidgets version, you must run cmake from a completely empty directory. I do "rm -rf *" before running cmake, every time.
  7. I don't know what's causing your wxWidgets errors. I'll need more information if you want me to figure out what's causing them. Could you post the results of the commands "wx-config --selected-config" and "wx-config --version"? I'm using wxWidgets 3.1.3 gtk2 that I built myself, so it's in /usr/local, and not the distribution-provided packages. Here's what I get when I run those two commands:
    $ wx-config --selected-config
    gtk2-unicode-3.1
    $ wx-config --version
    3.1.3
Rabcor commented 2 years ago
$ wx-config --selected-config
gtk3-unicode-3.1
$ wx-config --version
3.1.6

I cloned the repo this time instead of downloading the release, used the command you suggested to fetch nifty, ran cmake as suggested which worked, then make which failed more or less the same way as before:

$ make
[  1%] Building CXX object CMakeFiles/OutfitStudio.dir/lib/FSEngine/FSBSA.cpp.o
In file included from /usr/include/wine/windows/windows.h:37,
                 from /usr/include/wine/windows/dxgiformat.h:12,
                 from /home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/lib/FSEngine/../DDS.h:22,
                 from /home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/lib/FSEngine/FSBSA.cpp:34:
/usr/include/wx-3.1/wx/stream.h:84:5: error: ‘virtual wxClassInfo* wxStreamBase::GetClassInfoW() const’ marked ‘override’, but does not override
   84 |     wxDECLARE_ABSTRACT_CLASS(wxStreamBase);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
/usr/include/wx-3.1/wx/stream.h:375:5: error: ‘virtual wxClassInfo* wxFilterClassFactoryBase::GetClassInfoW() const’ marked ‘override’, but does not override
  375 |     wxDECLARE_ABSTRACT_CLASS(wxFilterClassFactoryBase);
      |     ^~~~~~~~~~~~~~~~~~~~~~~~
make[2]: *** [CMakeFiles/OutfitStudio.dir/build.make:76: CMakeFiles/OutfitStudio.dir/lib/FSEngine/FSBSA.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/OutfitStudio.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

I am running manjaro, I'm using GCC 11.

$ gcc --version
gcc (GCC) 11.2.0

I'd like to get this working, but I'm pretty clueless how to troubleshoot these kinds of things, I'm not much of a developer and as you noticed, not a particularly skilled git user either.

Reason I went for the release build rather than cloning the repo for istance is that usually releases are packaged in such a way that they're ready for the hands of noobs like myself, hell, sometimes they're even precompiled. This time I suppose it was the wrong move to go for the latest release build, but going for a more recent build still didn't solve my issue sadly.

The only thing I can think of rn is to try different versions of WxWidgets.

sts1skj commented 2 years ago

I'll try compiling with the gtk3 version of wxWidgets when I have time. In the meantime, I suggest trying the gtk2 version of wxWidgets, since that's what I use. Maybe that will make things work.

Rabcor commented 2 years ago

I tried with wxgtk2 instead of wxgtk3, but I just got the exact same error.

However I manged to get my hands on wxgtk2 3.1.4.

That worked significantly better, but still eventually failed:

[ 51%] Building CXX object CMakeFiles/OutfitStudio.dir/src/program/OutfitStudio.cpp.o
In file included from /home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/lib/gli/./core/../load_dds.hpp:27,
                 from /home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/lib/gli/./core/load.inl:1,
                 from /home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/lib/gli/load.hpp:27,
                 from /home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/lib/gli/gli.hpp:69,
                 from /home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/../render/../files/ResourceLoader.h:16,
                 from /home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/../render/GLMaterial.h:6,
                 from /home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/../render/GLSurface.h:8,
                 from /home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.h:25,
                 from /home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp:18:
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/lib/gli/./core/.././core/load_dds.inl: In function ‘gli::texture gli::load_dds(const char*, std::size_t)’:
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/lib/gli/./core/.././core/load_dds.inl:295:35: warning: unused variable ‘SourceSize’ [-Wunused-variable]
  295 |                 std::size_t const SourceSize = Offset + Texture.size();
      |                                   ^~~~~~~~~~
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp: In member function ‘void OutfitStudio::GetArchiveFiles(std::vector<std::__cxx11::basic_string<char> >&)’:
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp:920:43: error: conversion from ‘wxString’ to non-scalar type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} requested
  920 |         std::string cp = "GameDataFiles/" + TargetGames[targ];
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp: In member function ‘void OutfitStudioFrame::OnLoadOutfit(wxCommandEvent&)’:
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp:3674:84: error: conversion from ‘wxString’ to non-scalar type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} requested
 3674 |         std::string outfitName = XRCCTRL(dlg, "npOutfitName", wxTextCtrl)->GetValue();
      |                                                                                    ^
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp: In member function ‘void OutfitStudioFrame::OnExportTRIHead(wxCommandEvent&)’:
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp:4640:71: error: conversion from ‘wxString’ to non-scalar type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} requested
 4640 |                 std::string fn = dir + PathSepStr + shape->name.get() + ".tri";
      |                                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp: In member function ‘void OutfitStudioFrame::OnBoneSelect(wxTreeEvent&)’:
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp:5032:55: error: conversion from ‘wxString’ to non-scalar type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} requested
 5032 |         std::string selBone = outfitBones->GetItemText(item);
      |                               ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp:5036:73: error: conversion from ‘wxString’ to non-scalar type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} requested
 5036 |                         std::string frontBone = outfitBones->GetItemText(selected.front());
      |                                                 ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp: In member function ‘void OutfitStudioFrame::OnSliderCheckBox(wxCommandEvent&)’:
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp:6101:53: error: conversion from ‘wxString’ to non-scalar type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} requested
 6101 |         std::string name = box->GetName().BeforeLast('|');
      |                            ~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp: In member function ‘void OutfitStudioFrame::OnAddBone(wxCommandEvent&)’:
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp:9135:65: error: conversion from ‘wxString’ to non-scalar type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} requested
 9135 |                         std::string bone = boneTree->GetItemText(sel[i]);
      |                                            ~~~~~~~~~~~~~~~~~~~~~^~~~~~~~
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp: In member function ‘void OutfitStudioFrame::OnDeleteBone(wxCommandEvent&)’:
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp:9308:60: error: conversion from ‘wxString’ to non-scalar type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} requested
 9308 |                 std::string bone = outfitBones->GetItemText(selItems[i]);
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp: In member function ‘void OutfitStudioFrame::OnDeleteBoneFromSelected(wxCommandEvent&)’:
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp:9331:60: error: conversion from ‘wxString’ to non-scalar type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} requested
 9331 |                 std::string bone = outfitBones->GetItemText(selItems[i]);
      |                                    ~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp: In member function ‘void OutfitStudioFrame::OnNPWizChangeSliderSetFile(wxFileDirPickerEvent&)’:
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp:10280:39: error: conversion from ‘wxString’ to non-scalar type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} requested
10280 |         std::string fn = event.GetPath();
      |                          ~~~~~~~~~~~~~^~
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp: In member function ‘void OutfitStudioFrame::OnNPWizChangeSetNameChoice(wxCommandEvent&)’:
/home/rabcor/Downloads/BS/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp:10330:39: error: conversion from ‘wxString’ to non-scalar type ‘std::string’ {aka ‘std::__cxx11::basic_string<char>’} requested
10330 |         std::string fn = file->GetPath();
      |                          ~~~~~~~~~~~~~^~
make[2]: *** [CMakeFiles/OutfitStudio.dir/build.make:1028: CMakeFiles/OutfitStudio.dir/src/program/OutfitStudio.cpp.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/OutfitStudio.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

I also tried 3.0.5 but that failed even more spectacularly than my first attempt.

sts1skj commented 2 years ago

If I recall correctly, the error message "conversion from ‘wxString’ to non-scalar type ‘std::string’" disappears if you build wxWidgets with the "--enable-stl" option. So I'm pretty sure your build of wxgtk2 is missing this critical build option.

Alternatively, we could make that error message go away by changing every single line where it occurs. I think all you would have to do is replace "blah" with "(blah).ToStdString()" for each implicit conversion. So, for example, the line: std::string cp = "GameDataFiles/" + TargetGames[targ]; would become: std::string cp = ("GameDataFiles/" + TargetGames[targ]).ToStdString();

When I was getting all of this to work two years ago, however, I felt it was easier to just specify the "--enable-stl" option when building wxWidgets.

I still haven't tried building the latest BS&OS with wxWidgets-gtk3 and seeing if I get the errors you reported in your first message. I know I tried it two years ago and didn't like the visual result, so I stuck with wxWidgets-gtk2. I'll get around to trying wxWidgets-gtk3 soon. I think I may also need to try a newer version of wxWidgets.

sts1skj commented 2 years ago

@ousnius What version of wxWidgets do you use? The latest version is 3.1.6. I've been using 3.1.3 the past two years.

sts1skj commented 2 years ago

@Rabcor I just found something puzzling: the string "GetClassInfoW" only appears in one place in wxWidgets, both 3.1.3 and 3.1.6: in include/wx/msw/winundef.h. In that file, it undefines "GetClassInfo" which is apparently defined as a macro for "GetClassInfoW" by some Windows API header file.

On line 84 of wx/stream.h, a member function of wxStreamBase is declared named GetClassInfo. But your error message from this file mentions GetClassInfoW, not GetClassInfo. That means the Windows-API-header-file macro is in effect. So somehow you're getting some Windows-API header file included in your build. (I don't mean the Wine header files. Those are different.)

On my computer, the string "GetClassInfoW" appears in just two places: /usr/include/wine/windows/winuser.h /home/progmisc/wxWidgets-3.1.x/include/wx/msw/winundef.h In neither place is GetClassInfo declared as a macro for GetClassInfoW.

Could you please search /usr/include on your computer for every file that includes the string "GetClassInfoW"? For each, could you tell me the file name and the name of the package that installed that file? (On my computer, you can get the package name for a file "blah" by doing "rpm -q -f blah".)

(I'm guessing that you have something installed that has genuine Microsoft Windows API header files, which generally should not be in the Linux system directories. The Wine header files are okay.)

~~Here's another puzzling thing. According to your error message, the error occurs in wx/stream.h, and this file is included on line 37 of /usr/include/wine/windows/windows.h. But line 37 of windows.h on my computer is: #include <windef.h> "windef.h" is not the same as "wx/stream.h". Could you check line 37 of /usr/include/wine/windows/windows.h on your computer to see if it's the same as mine?~~

(On my computer, /usr/include/wine/windows/windows.h is installed by the package wine-devel-7.7. I wonder if you have something different.)

sts1skj commented 2 years ago

I've built wxWidgets 3.1.6 with both gtk3 and gtk2, with no configure options, and built BS&OS with each. I got a weird GLEW error with gtk3 that I didn't get before; apparently this is a problem with newer versions of wxWidgets. I also got lots of wxString-to-std::string conversion errors, of course.

I fixed the string conversion errors by adding ToStdString in about a dozen places. I added code to ignore the weird GLEW error. These fixes are in pull request #456 .

@Rabcor I suspect the reason you got "GetClassInfoW" build errors is because your distribution's wxWidgets development package is broken. I recommend building wxWidgets yourself.

Here's the sequence of commands I used to build and install wxWidgets gtk3:

$ cd wxWidgets-3.1.6
$ mkdir build-gtk3
$ cd build-gtk3
$ ../configure --with-gtk=3
$ make -j 4
$ sudo make install
$ sudo ldconfig

Building for gtk2 was the same except with '2' instead of '3'.

I still think the gtk2 build of Outfit Studio looks better than the gtk3 build, so I'll continue to use the gtk2 build for now except when someone needs me to fix something that only happens with gtk3.

ousnius commented 2 years ago

@sts1skj I use the latest master, because there's been PRs merged into wxWidgets that I made that are required for some functionality to work.

chriku commented 2 years ago

On my computer, the string "GetClassInfoW" appears in just two places:

Get the same error (also virtual wxClassInfo* wxStreamBase::GetClassInfoW() const’ marked ‘override’, but does not override just in /usr/include/wine-development/wine/windows/winuser.h:3772:60)

The collision occurs for me on debian using libwine-development-dev version 6.23~repack-1:

WINUSERAPI BOOL        WINAPI GetClassInfoA(HINSTANCE,LPCSTR,WNDCLASSA *);
WINUSERAPI BOOL        WINAPI GetClassInfoW(HINSTANCE,LPCWSTR,WNDCLASSW *);
#define                       GetClassInfo WINELIB_NAME_AW(GetClassInfo)

Will fix this for me by ripping wine to shreds, but maybe this helps for any of you

sts1skj commented 2 years ago

@chriku You're right: I misread the code in winuser.h. It does define GetClassInfo as a macro for GetClassInfoW. That's bad.

winuser.h is included by windows.h. windows.h is included by dxgiformat.h. dxgiformat.h is included by BS&OS's lib/DDS.h. lib/DDS.h is included by lib/FSEngine/FSBSA.cpp, which is the source file being compiled that generates the error.

So maybe the reason the GetClassInfoW error occurs is because some wxWidgets header files are included after winuser.h. Stopping the error might be as simple as reordering the #include lines so that the #include <wx/whatever.h> lines are before the #include "../DDS.h" line in FSBSA.cpp.

@Rabcor Could you try building again with the version of wxWidgets you used originally, the one that generates the GetClassInfoW error? Make sure you still get the error. Then change lib/FSEngine/FSBSA.cpp so that the #include "../DDS.h" line is the last #include line instead of the second. Please tell us if this fixes it, so the GetClassInfoW error doesn't happen.

I have no idea why I'm not getting this error, or why Ousnius doesn't get this error when he builds on Windows.

sts1skj commented 2 years ago

@Rabcor Ousnius has merged PR #456 as commit b106b78. I suggest you update your source to this commit, as it fixes the "conversion from ‘wxString’ to non-scalar type ‘std::string’" errors that you were getting in your wxWidgets 3.1.4 build. Here's the sequence I use to update:

$ git fetch
$ git checkout origin/dev
$ cd lib/nifly
$ git fetch
$ git checkout origin/main

I'm not sure if this is the right way to do things, or the most efficient, but it works.

talkingkittycat commented 2 years ago

I had a similer expierence to OP, expierencing most of the same problems they had, with the mostly same solutions working (including putting #include "../DDS.h" last) , though now I'm getting an error I assume is related to nifly:

[ 99%] Linking CXX executable BodySlide
In file included from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/./core/../load_dds.hpp:27,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/./core/load.inl:1,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/load.hpp:27,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/gli.hpp:69,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/../render/../files/ResourceLoader.h:16,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/../render/GLMaterial.h:6,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/../render/GLSurface.h:8,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.h:25,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.cpp:18:
/home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/./core/.././core/load_dds.inl: In function ‘gli::texture gli::load_dds(const char*, std::size_t)’:
/home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/./core/.././core/load_dds.inl:295:35: warning: unused variable ‘SourceSize’ [-Wunused-variable]
  295 |                 std::size_t const SourceSize = Offset + Texture.size();
      |                                   ^~~~~~~~~~
/usr/bin/ld: CMakeFiles/BodySlide.dir/src/components/Anim.cpp.o: in function `AnimBone::AddToNif(nifly::NifFile*) const':
Anim.cpp:(.text+0x79d): undefined reference to `nifly::NiNode* nifly::NifFile::FindBlockByName<nifly::NiNode>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: CMakeFiles/BodySlide.dir/src/components/Anim.cpp.o: in function `AnimSkeleton::LoadFromNif(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
Anim.cpp:(.text+0x315c): undefined reference to `nifly::NiNode* nifly::NifFile::FindBlockByName<nifly::NiNode>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: CMakeFiles/BodySlide.dir/src/components/Anim.cpp.o: in function `AnimSkeleton::LoadCustomBoneFromNif(nifly::NifFile*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
Anim.cpp:(.text+0x76ae): undefined reference to `nifly::NiNode* nifly::NifFile::FindBlockByName<nifly::NiNode>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: CMakeFiles/BodySlide.dir/src/components/Anim.cpp.o: in function `AnimInfo::WriteToNif(nifly::NifFile*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
Anim.cpp:(.text+0x9f90): undefined reference to `nifly::NiNode* nifly::NifFile::FindBlockByName<nifly::NiNode>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: Anim.cpp:(.text+0xa01d): undefined reference to `nifly::NiNode* nifly::NifFile::FindBlockByName<nifly::NiNode>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: CMakeFiles/BodySlide.dir/src/components/Anim.cpp.o:Anim.cpp:(.text+0xa3ef): more undefined references to `nifly::NiNode* nifly::NifFile::FindBlockByName<nifly::NiNode>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const' follow
In file included from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/./core/../load_dds.hpp:27,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/./core/load.inl:1,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/load.hpp:27,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/gli.hpp:69,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/../render/../files/ResourceLoader.h:16,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/../render/GLMaterial.h:6,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/../render/GLSurface.h:8,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.h:25,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/ShapeProperties.h:8,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/ShapeProperties.cpp:6:
/home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/./core/.././core/load_dds.inl: In function ‘gli::texture gli::load_dds(const char*, std::size_t)’:
/home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/./core/.././core/load_dds.inl:295:35: warning: unused variable ‘SourceSize’ [-Wunused-variable]
  295 |                 std::size_t const SourceSize = Offset + Texture.size();
      |                                   ^~~~~~~~~~
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/BodySlide.dir/build.make:1077: BodySlide] Error 1
make[1]: *** [CMakeFiles/Makefile2:111: CMakeFiles/BodySlide.dir/all] Error 2
make[1]: *** Waiting for unfinished jobs....
In file included from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/./core/../load_dds.hpp:27,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/./core/load.inl:1,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/load.hpp:27,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/gli.hpp:69,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/../render/../files/ResourceLoader.h:16,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/../render/GLMaterial.h:6,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/../render/GLSurface.h:8,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.h:25,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/ShapeProperties.h:8,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/SliderDataImportDialog.h:8,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/SliderDataImportDialog.cpp:6:
/home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/./core/.././core/load_dds.inl: In function ‘gli::texture gli::load_dds(const char*, std::size_t)’:
/home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/./core/.././core/load_dds.inl:295:35: warning: unused variable ‘SourceSize’ [-Wunused-variable]
  295 |                 std::size_t const SourceSize = Offset + Texture.size();
      |                                   ^~~~~~~~~~
In file included from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/./core/../load_dds.hpp:27,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/./core/load.inl:1,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/load.hpp:27,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/gli.hpp:69,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/../render/../files/ResourceLoader.h:16,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/../render/GLMaterial.h:6,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/../render/GLSurface.h:8,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/OutfitStudio.h:25,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/OutfitProject.h:11,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/ConvertBodyReferenceDialog.h:11,
                 from /home/tkc/Downloads/BodySlide-and-Outfit-Studio/src/program/ConvertBodyReferenceDialog.cpp:6:
/home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/./core/.././core/load_dds.inl: In function ‘gli::texture gli::load_dds(const char*, std::size_t)’:
/home/tkc/Downloads/BodySlide-and-Outfit-Studio/lib/gli/./core/.././core/load_dds.inl:295:35: warning: unused variable ‘SourceSize’ [-Wunused-variable]
  295 |                 std::size_t const SourceSize = Offset + Texture.size();
      |                                   ^~~~~~~~~~
[100%] Linking CXX executable OutfitStudio
/usr/bin/ld: CMakeFiles/OutfitStudio.dir/src/components/Anim.cpp.o: in function `AnimBone::AddToNif(nifly::NifFile*) const':
Anim.cpp:(.text+0x79d): undefined reference to `nifly::NiNode* nifly::NifFile::FindBlockByName<nifly::NiNode>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: CMakeFiles/OutfitStudio.dir/src/components/Anim.cpp.o: in function `AnimSkeleton::LoadFromNif(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
Anim.cpp:(.text+0x315c): undefined reference to `nifly::NiNode* nifly::NifFile::FindBlockByName<nifly::NiNode>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: CMakeFiles/OutfitStudio.dir/src/components/Anim.cpp.o: in function `AnimSkeleton::LoadCustomBoneFromNif(nifly::NifFile*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
Anim.cpp:(.text+0x76ae): undefined reference to `nifly::NiNode* nifly::NifFile::FindBlockByName<nifly::NiNode>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: CMakeFiles/OutfitStudio.dir/src/components/Anim.cpp.o: in function `AnimInfo::WriteToNif(nifly::NifFile*, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&)':
Anim.cpp:(.text+0x9f90): undefined reference to `nifly::NiNode* nifly::NifFile::FindBlockByName<nifly::NiNode>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: Anim.cpp:(.text+0xa01d): undefined reference to `nifly::NiNode* nifly::NifFile::FindBlockByName<nifly::NiNode>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const'
/usr/bin/ld: CMakeFiles/OutfitStudio.dir/src/components/Anim.cpp.o:Anim.cpp:(.text+0xa3ef): more undefined references to `nifly::NiNode* nifly::NifFile::FindBlockByName<nifly::NiNode>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char> > const&) const' follow
collect2: error: ld returned 1 exit status
make[2]: *** [CMakeFiles/OutfitStudio.dir/build.make:1238: OutfitStudio] Error 1
make[1]: *** [CMakeFiles/Makefile2:85: CMakeFiles/OutfitStudio.dir/all] Error 2
make: *** [Makefile:91: all] Error 2

I'm using the latest git of wxWidgets compiled with GTK3 and gcc 11. Any help would be greatly appreciated.

sts1skj commented 2 years ago

@talkingkittycat The error "undefined reference to FindBlockByName<NiNode>" should be easy to fix: just move the definition of FindBlockByName from lib/nifly/src/NifFile.cpp to lib/nifly/include/NifFile.h (stick it before the } // namespace nifly line at the end). Could you please try this and tell me if it works?

If this fix does work, I'll submit a pull request for nifly. Or maybe Ousnius will fix it.

Normally, template functions should be defined in header files, not source files. But sometimes it works even if you put the definition in a source file, if all the variants are instantiated there. I imagine MSVC and gcc 10 (the compilers Ousnius and I use) are keeping the instantiation of FindBlockByName<NiNode> globally visible, while gcc 11 is hiding it from the rest of the build. It's legal for gcc 11 to do so (I think), though it's also surprising since it's a change to how the compiler works.

@ousnius Would it be all right if we changed lib/FSEngine/FSBSA.cpp to move the line #include "../DDS.h" so it's the last include line rather than the second?

ousnius commented 2 years ago

@sts1skj As long as it compiles, I couldn't care less about which include line is where within the same file.

sts1skj commented 2 years ago

PR #459 should fix the GetClassInfoW build errors. Ousnius has merged it as commit 17eb631.

@Rabcor @talkingkittycat Please let me know if commit 17eb631 fixes the GetClassInfoW error.

talkingkittycat commented 2 years ago

@sts1skj Tried with a clean git, and GetClassInfoW was indeed fixed. moving FindBlockByName<NiNode> also fixed the problem and I was able to compile BS&OS successfully. Thank you very much!

sts1skj commented 2 years ago

Nifly PR 35 (https://github.com/ousnius/nifly/pull/35) moves the definition of FindBlockByName from the source file to the header.

That should be the last of the errors. Let me know if you have any more problems.

talkingkittycat commented 2 years ago

After compiling I did get another issue. I moved the executables to my Skyrim's CalienteTools, and when I run it I get an error saying "Failed to load Setup.xrc file", although I do have it. I have tried doing a clean reinstall of bodyslide and have ran vanilla Skyrim to make sure I have the proper files. I have also tried compiling with GTK3 and GTK2 based wxWidgets and I get the same problem with both.

sts1skj commented 2 years ago

@talkingkittycat The directory "res" has to be copied from the BS&OS source directory into Skyrim/Data/CalienteTools/BodySlide, not just the executable.

(I did mention this in the file Readme-linux.txt, but perhaps my explanation there was not clear.)

sts1skj commented 2 years ago

Ousnius has merged nifly PR 35 as commit 763c5c9 (https://github.com/ousnius/nifly/commit/763c5c92364cc352068c14cb6d59086fac954e2c). The res-directory instructions in Readme-linux.txt have also been updated in BS&OS PR #460, commit af03cdd.

I'm closing this issue. Feel free to re-open it if any further issues with Linux building and running are found.

Rabcor commented 2 years ago

I'm sorry for just starting the thread and disappearing like this, I managed to make bodyslide work in proton (wasn't hard either), kept modding, kinda forgot about this issue while playing hehe...

I'll try to build it just to see if my issue is resolved though, now that i'm here again.

Built it successfully with

git clone https://github.com/ousnius/BodySlide-and-Outfit-Studio
cd BodySlide-and-Outfit-Studio
git submodule update --init --recursive
mkdir build
cd build
cmake ..
make -j8

Failed to actually launch it though.

$ ./BodySlide 
./src/unix/dir.cpp(284): assert ""IsOpened()"" failed in GetNext(): must wxDir::Open() first
Trace/breakpoint trap (core dumped)

But it might have if I tried it with another wx version, however I already managed to use bodyslide for what I needed it for and since this is a separate issue anyways I won't bother reporting it/troubleshooting it.

Thanks for your work guys!