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

CMake MSYS2 mingw32/mingw64 build is using libreadline.dll.a and not libreadline.a #959

Closed
mcuee opened this issue May 11, 2022 · 6 comments · Fixed by #962
Closed

CMake MSYS2 mingw32/mingw64 build is using libreadline.dll.a and not libreadline.a #959

mcuee opened this issue May 11, 2022 · 6 comments · Fixed by #962
Labels
bug Something isn't working

Comments

@mcuee
Copy link
Collaborator

mcuee commented May 11, 2022

There is a bit of inconsistency in the CMake build. It is using the static libraries for the dependancies like libusb-1.0, libfti1 and hidapi. But somehow it is using the dynamic link library for readline.

Ref: #955 (comment)

cd /C/work/avr/avrdude-7.0_cmake/avrdude-7.0/build/src && /C/msys64/mingw64/bin/gcc.exe -Wl,--whole-archive CMakeFiles/avrdude.dir/objects.a -Wl,--no-whole-archive -o avrdude.exe -Wl,--out-implib,libavrdude.dll.a -Wl,--major-image-version,0,--minor-image-version,0  libavrdude.a /C/msys64/mingw64/lib/libelf.a /C/msys64/mingw64/lib/libusb.a /C/msys64/mingw64/lib/libusb-1.0.a /C/msys64/mingw64/lib/libhid.a /C/msys64/mingw64/lib/libhidapi.a /C/msys64/mingw64/lib/libftdi1.a /C/msys64/mingw64/lib/libreadline.dll.a -lsetupapi -lws2_32 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
@mariusgreuel
Copy link
Contributor

You are really trying to poke holes in my CMake files, aren't you? :-)

But you are right, when libreadline is installed on MSYS2, it is picking up the wrong version. I will prepare a CMake PR that fixes a few issues that were raised by you and others.

@dl8dtl
Copy link
Contributor

dl8dtl commented May 11, 2022

The CMake stuff is your domain anyway, so feel free to integrate that yourself. I don't think there's anything gained if you want me to approve that before :-), my CMake knowledge is close to zero.

@mariusgreuel
Copy link
Contributor

Thanks, I will submit a PR just for the CI checks, and then commit myself.

@mcuee
Copy link
Collaborator Author

mcuee commented May 12, 2022

You are really trying to poke holes in my CMake files, aren't you? :-)

Haha, I play testing/supporting role for the open source projects I am involved (eg: libusb, hidapi, libusb-win32, libusbk, libusbdotnet, pyusb and, libftdi). Other than these projects, I like to use projects like OpenOCD and avrdude to carry out the tests as well as these projects depend on libusb, hidapi and libftdi.

@mcuee
Copy link
Collaborator Author

mcuee commented May 14, 2022

I can confirm that #962 fixed this issue.

 cmake -G "MSYS Makefiles" ..  -DCMAKE_VERBOSE_MAKEFILE="ON"
...
[100%] Linking C executable avrdude.exe
cd /C/work/avr/avrdude_test/avrdude-fork/build/src && /C/msys64/mingw64/bin/cmake.exe -E rm -f CMakeFiles/avrdude.dir/objects.a
cd /C/work/avr/avrdude_test/avrdude-fork/build/src && /C/msys64/mingw64/bin/ar.exe qc CMakeFiles/avrdude.dir/objects.a "CMakeFiles/avrdude.dir/main.c.obj" "CMakeFiles/avrdude.dir/term.c.obj" "CMakeFiles/avrdude.dir/whereami.c.obj" "CMakeFiles/avrdude.dir/windows.rc.obj"
cd /C/work/avr/avrdude_test/avrdude-fork/build/src && /C/msys64/mingw64/bin/gcc.exe -Wl,--whole-archive CMakeFiles/avrdude.dir/objects.a -Wl,--no-whole-archive -o avrdude.exe -Wl,--out-implib,libavrdude.dll.a -Wl,--major-image-version,0,--minor-image-version,0  libavrdude.a -lm /C/msys64/mingw64/lib/libelf.a /C/msys64/mingw64/lib/libusb.a /C/msys64/mingw64/lib/libusb-1.0.a /C/msys64/mingw64/lib/libhid.a /C/msys64/mingw64/lib/libhidapi.a /C/msys64/mingw64/lib/libftdi1.a /C/msys64/mingw64/lib/libreadline.a -lsetupapi -lws2_32 -lkernel32 -luser32 -lgdi32 -lwinspool -lshell32 -lole32 -loleaut32 -luuid -lcomdlg32 -ladvapi32
make[2]: Leaving directory '/c/work/avr/avrdude_test/avrdude-fork/build'
[100%] Built target avrdude


@mcuee
Copy link
Collaborator Author

mcuee commented May 14, 2022

I will close this one as I expected #962 to be merged.

@mcuee mcuee closed this as completed May 14, 2022
@mcuee mcuee added the bug Something isn't working label Jun 20, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants