mirror of
https://github.com/jmcnamara/libxlsxwriter.git
synced 2026-05-15 14:15:54 -06:00
[GH-ISSUE #79] Building 32-bit version of libxlsxwriter with MSYS2 and Mingw-w64 #66
Labels
No labels
awaiting user feedback
bug
cmake
cmake
docs
feature request
in progress
long term
medium term
medium term
pull-request
question
question
ready to close
short term
under investigation
wontfix
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/libxlsxwriter#66
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @Z3ROQL on GitHub (Nov 20, 2016).
Original GitHub issue: https://github.com/jmcnamara/libxlsxwriter/issues/79
Originally assigned to: @jmcnamara on GitHub.
Hello. I successfully built my first application using MSYS2 and Mingw-64. Now I want to build a 32-bit version of it, so I installed the 32-bit version of gcc from MSYS2, opened up the MINGW32 shell and ran the usual command:
gcc example.cpp -o example -lxlsxwriter -lz. The problem is that the linker cannot find the library. Here's the error:So I thought: "Should I remove my already existing library and
makeit again?". So I did it: I ranmakeandmake install, but nothing changed.UPDATE: I also tried to use
CFLAGS='-m32' makeandCFLAGS='-m32' make install, but nothing changed.@jmcnamara commented on GitHub (Nov 20, 2016):
Hi @Z3ROQL,
Did
make installwork correctly?Either way you can try this fallback from the Libxlsxwriter installation guide :
See also this online documentation on HOWTO Specify the Location of Libraries for use with MinGW.
@Z3ROQL commented on GitHub (Nov 20, 2016):
make installworked correctly. I executed this command --->cc main.cpp -o main -I c:/msys64/home/z3roql/libxlsxwriter/include \c:/msys64/home/z3roql/libxlsxwriter/lib/libxlsxwriter.a -lzand now it gives me this error --->C:\msys64\tmp\ccUeeXG4.o:main.cpp:(.text+0x16): undefined reference to 'workbook_new'(for every function inmain.cpp).@jmcnamara commented on GitHub (Nov 21, 2016):
What happen if you do
make examples?@jmcnamara commented on GitHub (Nov 21, 2016):
Also is it correct that the lib path is escaped:
\c:/msys64/home/...@Z3ROQL commented on GitHub (Nov 21, 2016):
If I do
make examplesit gives me a bunch ofundefined reference to [...]errors --->make[1]: entering directory "/home/z3roql/libxlsxwriter/examples" C:\msys64\tmp\ccSMi9UL.o: In function 'write_worksheet_data': C:\msys64\home\z3roql\libxlsxwriter\examples/chart_scatter.c:26: undefined reference to 'lxw_name_to_col' [...]Yes, I think it's correct since it doesn't output any syntax error.
@jmcnamara commented on GitHub (Nov 22, 2016):
I'm afraid I can't help you with this. I retested with MSYS2 32bit using the latest installer: http://repo.msys2.org/distrib/i686/msys2-i686-20161025.exe
Then I ran the installation instructions from the docs:
Everything worked fine as did
make examplesandmake test_unit.I think that you should verify that all of that works for you first.
@Z3ROQL commented on GitHub (Nov 22, 2016):
I'll try to download and install again MSYS2. Thank you for answering. I'll post a comment here when I'm done.
@Z3ROQL commented on GitHub (Nov 22, 2016):
Ok. I downloaded and installed everything again. Now it compiles without any problem, but it gives me this error code when I try to execute it:
0xc000007b.@jmcnamara commented on GitHub (Nov 22, 2016):
What gives an error code? What are you running?
Do you get the same error if you run the following from the shell after the commands above:
The issue may be that you don't have admin rights to write to the Windows TEMP. You can try run in Admin mode or use a different TEMP folder as explained here in the docs: http://libxlsxwriter.github.io/getting_started.html#gsg_tmpdir
Make sure the dir in
.tmpdir = "C:\\Temp"is writable by you/your application.@Z3ROQL commented on GitHub (Nov 22, 2016):
I'm running my test program.
EDIT: I don't get any error, but I also don't get any
.xlsxfile. If I try to double-click on the binary, it gives me the0xc000007berror.I tried running my program as Administrator but with same results. Also, I don't think that the TEMP directory is a problem since it works perfectly with the other 64-bit program I made before.
UPDATE: Ok... This is REALLY strange. For some reason if I run the program from the MSYS2 shell using this command --->
./main.exeeverything works. However, if I try to double-click on the binary to execute it, it gives me the aforementioned error. I'm confused...@jmcnamara commented on GitHub (Nov 23, 2016):
Maybe the issue is that you are trying to run a 32bit application in a 64bit version of Windows.
There are some suggestion here on fixing the 0xc000007b error code: http://www.techcrises.com/how-to/how-to-fix-error-code-0xc000007b-in-windows-7-8-8-1/
I'd suggest "Method 4 : Fix Compatibility Issue Between System and Application".
@jmcnamara commented on GitHub (Nov 23, 2016):
Here is another link that suggests the issue is mixing 32bit code and 64bit dlls (or vice versa): https://msoos.wordpress.com/2010/09/11/0xc000007b-error-solution/
@Z3ROQL commented on GitHub (Nov 23, 2016):
YES! Finally! I love you! I used Dependency Walker as you suggested and replaced
msys-2.0.dll,msys-gcc_s-1.dllandmsys-z.dllfrom my project folder (they were 64-bit instead of 32-bit) and now everything works again! 💃