-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Cannot seem to compile for Windows 32-bit (x86) #3313
Comments
That's very interesting. As I know there is no any dependency to iconv, so I have no idea why does it want to build... (I don't even have any installed iconv package on my servers). But because the issue is the iconv, I'm afraid there is no any ModSecurity problem here. |
Well this is very strange then because i have already successfully compiled LibModSecurity when specifying "vcbuild.bat Release x86_64" it compiled fine. I also attempted to compile the x86 (32-bit) inside the docker image which also failed with libiconv errors. But again when compiling the x64 version iconv does not show up? |
Unfortunately I have no idea. May be @eduar-hte knows the answer... |
The x86 (32-bit) build of libModSecurity should only require using the appropriate Visual Studio environment. That is, for a command-line build, in addition to specifying If the 64-bit version of the library has been previously built, as mentioned in the Windows build notes, I'd suggest cleaning up the previous build before starting the 32-bit build, with the following steps:
The Additionally, a GitHub fork of the repository should be able to build the x86 version of the library by adding/replacing a platform entry in - {label: "x86", arch: "x86"} For the sake of reference, I've just succesfully done a build of the x86 configurations of libModSecurity in my fork of the repository after updating The x86 (32-bit) build is not included in the Disclaimer, I mostly focused and worked on the 64-bit build of libModSecurity during the port, so x86 (32-bit) testing and development was minimal and only included because it was simple to add support to build it and passes all the available tests. |
Ok so run conan from a vcvars32.bat after specifying x86 is there anything else I need to update or fix first? |
As I mentioned before, I suggest resetting the build directory and removing recipes/packages from the Conan cache when switching between build configurations (be that debug/release, x64/x86, using ASAN, etc.) Then, just set up the appropriate environment variables (either through vcvarsXX.bat or using the VS provided shortcuts) and launch That should be it :-) |
Hey i literally downloaded latest modsecurity zip, extracted it, copied over the libinjection and mbedTLS folder, ran these commands and i still get libiconv errors: ** Visual Studio 2022 Developer Command Prompt v17.12.3 C:\Program Files\Microsoft Visual Studio\2022\Community>cd /d C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build>vcvars32.bat x86 ** Visual Studio 2022 Developer Command Prompt v17.12.3 [vcvarsall.bat] Environment initialized for: 'x86' C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\VC\Auxiliary\Build>cd /d I:\WebServerHoster\ModSecurity-32-bit I:\WebServerHoster\ModSecurity-32-bit>vcbuild.bat Release x86 ======== Input profiles ======== Profile build: ======== Computing dependency graph ======== ======== Computing necessary packages ======== ======== Installing packages ======== -------- Downloading 3 packages -------- -------- Installing package bzip2/1.0.8 (1 of 22) -------- Update the VERSION argument value or use a ... suffix to tell -- Using Conan toolchain: C:/Users/Elevations/.conan2/p/b/bzip2be24d18ea9a5b/b/build/generators/conan_toolchain.cmake bzip2/1.0.8: Running CMake.build() 1>Checking Build System bzip2/1.0.8: Package '6b8a1fe8cfc7e56f5e35dc6072cbcfba1dfdb27a' built bzip2/1.0.8: package(): Packaged 1 '.exe' file: bzip2.exe -------- Installing package expat/2.6.3 (3 of 22) --------
|
LibIconv is being pulled in because of LibXML2 and it requires iconv, Once i took LibXML2 out of the conanfile.txt it compiled for 32-bit fine.. Thanks for the help guys but Ya not really... The solution was to remove LibXML2 to avoid the libiconv problem entirely, Now if you can help me address how to fix this libiconv problem... that would be better than removing it and again this libiconv problem only happened when compiling the 32-bit version and NOT the 64bit version. As it currently stands i have no idea why libiconv is spitting errors or how to fix them and every other package compiles without problems but its directly related to libXML2 I have posted my entire console output above so please don't just disregard it and actually look into these issues. I did also have to turn LIBXML2 to "OFF" in the cmake flags aswell and here is my FINAL CONSOLE output of a successfully compiled 32-bit dll without LIBXML2
|
???
To be prceise it's indirectly related to libXML2, it's a problem building libiconv in your environment, but we now that already. Turning off the feature doesn't really address the issue. Given that it compiles in GitHub (with the GitHub runner image) using the same version of the libiconv library, I'd assume there's an incompatible tool in the environment used to build the library. I guess you installed Conan 2.2.2 following the Win32 build instructions, but I recommend you update to the latest version, 2.10.1 (and repeat the instructions to clear the build directory and Conan cache). NOTE: The versions in the Win32 build instructions and the Dockerfile worked with the VS2022 Microsoft had available at the time the Windows port was developed, but it doesn't provide a link to reference that specific version, but always the latest one. If you search the web, you'll find that newer versions of VS2022 require updating Conan for compatibility reasons. Let's see if that solves the libiconv for you... |
The Dockerfile using Conan 2.2.2 and doing an x86 build (after updating the vcvars line suitably) reproduces the issue in libiconv. Updating the Conan version in the Dockerfile to 2.10.1, libiconv builds successfully. |
Its great that upgrading conan version worked for you however.. it didnt solve the problem for me: libiconv/1.17: Unzipping libiconv-1.17.tar.gz to . -------- Installing package libiconv/1.17 (15 of 22) -------- libiconv/1.17: ERROR: ".." CMake Error: The source directory "I:/WebServerHoster/ModSecurity-32-bit/build" does not appear to contain CMakeLists.txt. I:\WebServerHoster\ModSecurity-32-bit>conan --version I:\WebServerHoster\ModSecurity-32-bit> |
I had to run:
again after installing latest conan version and NOW its working i think.. |
Glad you managed to sort out your environment to build libiconv (and thus libModSecurity) in the x86 (32-bit) configuration after upgrading Conan to the latest version.
That makes sense. It wasn't necessary when I found the issue in the Docker environment, as the Docker image is built from scratch. Feel free to generate a PR to update the Win32 build information and Dockerfile to give back and contribute to the project by keeping the build instructions current. |
Yep can confirm after updating conan to latest version and running |
For the sake of reference, this could have been addressed sooner by searching with Google with the log output:
The first match is actually conan-io/conan#16239 which describes the Conan 2 incompatibiilty issue with a newer version of VS2022 back in May. This seems to have been addressed in conan-io/conan#15588 for Conan 2.3.1. |
I cannot seem to compile LibModSecurity for windows 32-bit i have tried to no avail, i did manage to compile x64 with no problems through conan, but my application requires 32-bit libs
When i try doing "vcbuild.bat Release x86" I run into these errors:
It mentions something about not being able to find VC Build tools v14.3 even though i have the latest installed and the x64 bit version works fine and compiles without problems
======== Installing packages ========
bzip2/1.0.8: Already installed! (1 of 21)
dirent/1.24: Already installed! (2 of 21)
expat/2.6.3: Already installed! (3 of 21)
libmaxminddb/1.9.1: Already installed! (4 of 21)
lmdb/0.9.31: Already installed! (5 of 21)
lmdb/0.9.31: Appending PATH environment variable: C:\Users\Elevations.conan2\p\b\lmdbfe02eaf431446\p\bin
lua/5.4.6: Already installed! (6 of 21)
lz4/1.9.4: Already installed! (7 of 21)
msys2/cci.latest: Already installed! (8 of 21)
sqlite3/3.45.0: Already installed! (9 of 21)
strawberryperl/5.32.1.1: Already installed! (10 of 21)
zlib/1.3.1: Already installed! (11 of 21)
zstd/1.5.5: Already installed! (12 of 21)
nasm/2.16.01: Already installed! (13 of 21)
-------- Installing package libiconv/1.17 (14 of 21) --------
libiconv/1.17: Building from source
libiconv/1.17: Package libiconv/1.17:8419bdd2579514d415d70db8caf4318ede661647
libiconv/1.17: Copying sources to build folder
libiconv/1.17: Building your package in C:\Users\Elevations.conan2\p\b\libic21f5ed995160d\b
libiconv/1.17: Calling generate()
libiconv/1.17: Generators folder: C:\Users\Elevations.conan2\p\b\libic21f5ed995160d\b\build-release\conan
libiconv/1.17: Generating aggregated env files
libiconv/1.17: Generated aggregated env files: ['conanbuild.sh', 'conanbuild.bat', 'conanrun.bat']
libiconv/1.17: Calling build()
libiconv/1.17: apply_conandata_patches(): No patches defined in conandata
libiconv/1.17: Applying x86 resource patch: C:\Users\Elevations.conan2\p\b\libic21f5ed995160d\b\src\windows\windres-options
libiconv/1.17: Calling:
libiconv/1.17: ERROR:
Package '8419bdd2579514d415d70db8caf4318ede661647' build failed
libiconv/1.17: WARN: Build folder C:\Users\Elevations.conan2\p\b\libic21f5ed995160d\b\build-release
ERROR: libiconv/1.17: Error in build() method, line 146
autotools.configure()
ConanException: Error 1 while executing
The system cannot find the path specified.
CMake Warning:
Ignoring extra path from command line:
".."
CMake Error: The source directory "I:/WebServerHoster/ModSecurity-3-master/build" does not appear to contain CMakeLists.txt.
Specify --help for usage, or press the help button on the CMake GUI.
Error: could not load cache
The text was updated successfully, but these errors were encountered: