What part of my project has a C++ version mismatch while cross-compiling the cpr library and why?

Background info: I am cross-compiling a library called cpr. It compiles and links fine. When I went to use it, I got a C++ version mismatch:

/tmp/[project name]: /usr/lib/libstdc++.so.6: version 'CXXABI_1.3.11' not found (required by /tmp/[project name] 
/tmp/[project name]: /usr/lib/libstdc++.so.6: version 'GLIBCXX_3.4.26' not found (required by /tmp/[project name] 

I have no idea what or why something is trying to use anything in /usr/lib. I have also tried Verbose mode in visualgdb but I cannot trace what is causing this.

cpr depends on curl. Since my build architecture is different than my target architecture, I see that I must also cross-compile curl, and that might be what is causing this problem. Following the directions for cross-compiling, it works fine. I am able to execute an example from the website. I have disabled SSL, ZLIB, and frankly most features just to keep it simple. I have tried to eliminate the need for any dependencies, so the full chain should be project requires cpr requires curl. I built and link to static curl specifically to avoid this problem of relying on .so libraries. I suspect that is what is happening, but I am not sure.

I have tried many different configurations, but this is ultimately what got me the furthest.
though curl works fine, for completeness, here is the curl config:
sudo ./configure --host=arm-linux-gnueabihf --build=x86_64-linux-gnu --without-ssl --disable-ipv6 --without-brotli --without-libpsl --without-nghttp2 --without-ngtcp2 --without-zstd --without-libidn2 --without-librtmp --without-zlib --disable-shared --enable-static --disable-threaded-resolver --disable-pthreads --prefix=/usr/arm-linux-gnueabihf AR=arm-linux-gnueabihf-gcc-ar-9 RANLIB=arm-linux-gnueabihf-gcc-ranlib-9 CC=/usr/bin/arm-linux-gnueabihf-gcc-9 CXX=/usr/bin/arm-linux-gnueabihf-g++ LD=arm-linux-gnueabihf-ld AS=arm-linux-gnueabihf-gcc-as CROSS_COMPILE=arm-linux-gnueabihf CFLAGS=-I/usr/arm-linux-gnueabihf/include LDFLAGS=-L/usr/arm-linux-gnueabihf/lib PATH=$PATH:/usr/arm-linux-gnueabihf/bin
relevant env parameters: LDFLAGS=-L/usr/arm-linux-gnueabihf/lib,CPPFLAGS=-I/usr/arm-linux-gnueabihf/include','PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/usr/arm-linux-gnueabihf/bin:/usr/arm-linux-gnueabihf/bin
and I link directly to /usr/arm-linux-gnueabihf/lib/libcurl.a after building

Now, here is the cpr config:
sudo cmake -DCURL_LIBRARY=/usr/arm-linux-gnueabihf/lib -DCURL_INCLUDE_DIR=/usr/arm-linux-gnueabihf/include -DCMAKE_INSTALL_PREFIX=/usr/arm-linux-gnueabihf -DCMAKE_TOOLCHAIN_FILE=/home/[username]/include/toolchain.cmake -DCPR_ENABLE_SSL=OFF -DCURL_ZLIB=OFF -DCPR_USE_SYSTEM_CURL=ON -DBUILD_SHARED_LIBS:BOOL=OFF --debug-output ..

toolchain file is simple:

set(CMAKE)SYSTEM)NAME Linux)

set(CMAKE_C_COMPILER arm-linux-gnueabihf-gcc-9)
set(CMAKE_CXX_COMPILER arm-linux-gnueabihf-g++)

set(CMAKE_FIND_ROOT_PATH /usr/bin)

I also tried cpr version 1.9.7 because it has a lower C++ requirement, but no dice. It has the exact same error message.
I also tried curl version 7.68.0.

The compilers are located in /usr/bin, which is where my visualGDB toolchain points to. Linker directory is /usr/arm-linux/gnueabihf/lib and I am linking to pthread curl cpr. CFLAGS are -ggdb -ffunction-sections -O0 -DCURL_STATICLIB -I/usr/arm-linux-gnueabihf/include and CXXFLAGS are std=gnu++2a -ggdb -ffunction-sections -O0 -DCURL_STATICLIB -I/usr/arm-linux-gnueabihf/include. I tried many different std versions, including 17, 14, and 11. All have the same result.

A simple Post will cause the error. As long as that line is uncommented, the code will not even run to get to that point. It will compile and link just fine, but when I go to debug it, it launches but then does not execute any code and instead spits out the error mentioned above.

const std::string role;
cpr::Response response = cpr::Post(cpr::Url{"192.168.1.2/login"},cpr::Payload{{role, "password"}});

More info that may be clutter:


I also tried using -static and -Bstatic at the beginning of my flags, as well as -static-libc++. None of them changed the outcome. However, it seems there is no libcstd++.a in /usr/arm-linux-gnueabihf/lib. I got it with apt install g++-arm-linux-gnueabihf.

Further, I tried explicitly linking pthread.a, but that failed (won’t go into detail unless you think it is relevant, already long enough).

Explicitly linking to libcurl.a instead causes a similar issue:

/tmp/[project name]: /usr/lib/libstdc++.so.6: version 'CXXABI_1.3.11' not found (required by /tmp/[project name] 
/tmp/[project name]: /usr/lib/libstdc++.so.6: version 'GLIBCXX_3.4.26' not found (required by /tmp/[project name]
/tmp/[project name]: /lib/libc.so.6: version 'GLIBC2_28' not found (required by /tmp/[project name]

notably this time including GLIBC, and that one in a slightly different directory to boot.

Explicitly linking to libcpr.a causes the same original two errors, notably this time even when cpr functions are commented out still.

Explicitly linking to both libcurl.a and libcpr.a also produces the same three errors, with or without the cpr code commented out

Now for the wildcard, I did a locate libstdc++.a and found one in /usr/lib/gcc-cross/arm-linux-gnueabihf/9/libstdc++.a. It compiles and links, and the only error I get upon debugging is /tmp/[project name]: symbol lookup error: /tmp/[project name]: undefined symbol: curl_mime_type and this only happens when I do not link to libcurl.a but simply add “curl” to library names (effectively -lcurl). This feels like progress, however this feels wrong because I should be linking to static libraries. What should be most correct in my opinion is -lpthread, libcurl.a, and libcpr.a. The logic is that pthread is a system library that comes with the toolchain when I apt install it, whereas the other two I built myself and should need to link to static versions.


There may be a few issues going on here and I am not sure what exactly the problem is.

cpr looks like it would be exactly what I need, but I am just not able to get it to work. Any help would be greatly appreciated.

Last, I was reluctant to post it on the cpr github issues tracker because I feel like it’s a problem with my build process and not a problem with the library, but let me know if I should be posting there instead.

Thanks in advance

New contributor

13372277 is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.

Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa Dịch vụ tổ chức sự kiện 5 sao Thông tin về chúng tôi Dịch vụ sinh nhật bé trai Dịch vụ sinh nhật bé gái Sự kiện trọn gói Các tiết mục giải trí Dịch vụ bổ trợ Tiệc cưới sang trọng Dịch vụ khai trương Tư vấn tổ chức sự kiện Hình ảnh sự kiện Cập nhật tin tức Liên hệ ngay Thuê chú hề chuyên nghiệp Tiệc tất niên cho công ty Trang trí tiệc cuối năm Tiệc tất niên độc đáo Sinh nhật bé Hải Đăng Sinh nhật đáng yêu bé Khánh Vân Sinh nhật sang trọng Bích Ngân Tiệc sinh nhật bé Thanh Trang Dịch vụ ông già Noel Xiếc thú vui nhộn Biểu diễn xiếc quay đĩa Dịch vụ tổ chức tiệc uy tín Khám phá dịch vụ của chúng tôi Tiệc sinh nhật cho bé trai Trang trí tiệc cho bé gái Gói sự kiện chuyên nghiệp Chương trình giải trí hấp dẫn Dịch vụ hỗ trợ sự kiện Trang trí tiệc cưới đẹp Khởi đầu thành công với khai trương Chuyên gia tư vấn sự kiện Xem ảnh các sự kiện đẹp Tin mới về sự kiện Kết nối với đội ngũ chuyên gia Chú hề vui nhộn cho tiệc sinh nhật Ý tưởng tiệc cuối năm Tất niên độc đáo Trang trí tiệc hiện đại Tổ chức sinh nhật cho Hải Đăng Sinh nhật độc quyền Khánh Vân Phong cách tiệc Bích Ngân Trang trí tiệc bé Thanh Trang Thuê dịch vụ ông già Noel chuyên nghiệp Xem xiếc khỉ đặc sắc Xiếc quay đĩa thú vị
Trang chủ Giới thiệu Sinh nhật bé trai Sinh nhật bé gái Tổ chức sự kiện Biểu diễn giải trí Dịch vụ khác Trang trí tiệc cưới Tổ chức khai trương Tư vấn dịch vụ Thư viện ảnh Tin tức - sự kiện Liên hệ Chú hề sinh nhật Trang trí YEAR END PARTY công ty Trang trí tất niên cuối năm Trang trí tất niên xu hướng mới nhất Trang trí sinh nhật bé trai Hải Đăng Trang trí sinh nhật bé Khánh Vân Trang trí sinh nhật Bích Ngân Trang trí sinh nhật bé Thanh Trang Thuê ông già Noel phát quà Biểu diễn xiếc khỉ Xiếc quay đĩa
Thiết kế website Thiết kế website Thiết kế website Cách kháng tài khoản quảng cáo Mua bán Fanpage Facebook Dịch vụ SEO Tổ chức sinh nhật