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

Compilation errors on gcc 14.1.1 #9359

Open
moneroexamples opened this issue Jun 11, 2024 · 11 comments · May be fixed by #9367
Open

Compilation errors on gcc 14.1.1 #9359

moneroexamples opened this issue Jun 11, 2024 · 11 comments · May be fixed by #9367
Assignees
Labels

Comments

@moneroexamples
Copy link
Contributor

Regarding:

error: implicit declaration of function ‘strdup’; did you mean ‘strcmp’? [-Wimplicit-function-declaration]

and

error: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]

/home/mwo/monero/external/miniupnp/miniupnpc/listdevices.c: In function ‘add_device’:
/home/mwo/monero/external/miniupnp/miniupnpc/listdevices.c:60:24: error: implicit declaration of function ‘strdup’; did you mean ‘strcmp’? [-Wimplicit-function-declaration]
   60 |         elt->descURL = strdup(dev->descURL);
      |                        ^~~~~~
      |                        strcmp
/home/mwo/monero/external/miniupnp/miniupnpc/listdevices.c:60:22: error: assignment to ‘char *’ from ‘int’ makes pointer from integer without a cast [-Wint-conversion]
   60 |         elt->descURL = strdup(dev->descURL);
      |                      ^
make[3]: *** [external/miniupnp/miniupnpc/CMakeFiles/listdevices.dir/build.make:76: external/miniupnp/miniupnpc/CMakeFiles/listdevices.dir/listdevices.c.o] Error 1
make[2]: *** [CMakeFiles/Makefile2:1307: external/miniupnp/miniupnpc/CMakeFiles/listdevices.dir/all] Error 2
make[1]: *** [Makefile:146: all] Error 2
make[1]: Leaving directory '/home/mwo/monero/build/release'
make: *** [Makefile:103: release-all] Error 2
@SyntheticBird45
Copy link
Contributor

Confirm, same issue on updated Arch Linux

@SyntheticBird45
Copy link
Contributor

@selsta Applied pastebin modifications.
Failed at 24%:

[scrubbed]/monero/external/miniupnp/miniupnpc/src/minihttptestserver.c:299:25: error: implicit declaration of function 'usleep'; did you mean 'sleep'? [-Wimplicit-function-declaration]
  299 |                         usleep(10000); /* 10ms */
      |                         ^~~~~~
      |                         sleep
make[2]: *** [external/miniupnp/miniupnpc/CMakeFiles/minihttptestserver.dir/build.make:76: external/miniupnp/miniupnpc/CMakeFiles/minihttptestserver.dir/src/minihttptestserver.c.o] Error 1
make[1]: *** [CMakeFiles/Makefile2:1341: external/miniupnp/miniupnpc/CMakeFiles/minihttptestserver.dir/all] Error 2

@SyntheticBird45
Copy link
Contributor

Compiled successfully from https://github.com/selsta/monero/tree/miniupnpc-2.2.8

@0xFFFC0000 0xFFFC0000 self-assigned this Jun 11, 2024
@0xFFFC0000 0xFFFC0000 added the bug label Jun 11, 2024
@0xFFFC0000
Copy link
Collaborator

0xFFFC0000 commented Jun 11, 2024

After adding a small print to src/p2p/CMakeLists.txt :

get_cmake_property(_variableNames VARIABLES)
list (SORT _variableNames)
foreach (_variableName ${_variableNames})
    message(STATUS "${_variableName}=${${_variableName}}")
endforeach()

get_target_property(dirs miniupnpc::miniupnpc INCLUDE_DIRECTORIES)
foreach(dir ${dirs})
  message(STATUS "miniupnpc::miniupnpc INCLUDE_DIRECTORIES='${dir}'")
endforeach()

get_target_property(dirs miniupnpc::miniupnpc INTERFACE_INCLUDE_DIRECTORIES)
foreach(dir ${dirs})
  message(STATUS "miniupnpc::miniupnpc INTERFACE_INCLUDE_DIRECTORIES='${dir}'")
endforeach()

message(WARNING "p2p:")
get_target_property(dirs p2p INCLUDE_DIRECTORIES)
foreach(dir ${dirs})
  message(STATUS "p2p INCLUDE_DIRECTORIES='${dir}'")
endforeach()
get_target_property(dirs p2p INTERFACE_INCLUDE_DIRECTORIES)
foreach(dir ${dirs})
  message(STATUS "p2p INTERFACE_INCLUDE_DIRECTORIES='${dir}'")
endforeach()

you can see this output (even if you add miniupnpc::miniupnpc to p2p as dependency):

-- miniupnpc::miniupnpc INCLUDE_DIRECTORIES='/home/0xfffc/developments/monero/external/rapidjson/include'
-- miniupnpc::miniupnpc INCLUDE_DIRECTORIES='/home/0xfffc/developments/monero/external/easylogging++'
-- miniupnpc::miniupnpc INCLUDE_DIRECTORIES='/home/0xfffc/developments/monero/src'
-- miniupnpc::miniupnpc INCLUDE_DIRECTORIES='/home/0xfffc/developments/monero/contrib/epee/include'
-- miniupnpc::miniupnpc INCLUDE_DIRECTORIES='/home/0xfffc/developments/monero/external'
-- miniupnpc::miniupnpc INCLUDE_DIRECTORIES='/home/0xfffc/developments/monero/external/supercop/include'
-- miniupnpc::miniupnpc INCLUDE_DIRECTORIES='/opt/monero/build-release/x86_64-pc-linux-gnu/include'
-- miniupnpc::miniupnpc INCLUDE_DIRECTORIES='/home/0xfffc/developments/monero/build-release/generated_include'
-- miniupnpc::miniupnpc INCLUDE_DIRECTORIES='/home/0xfffc/developments/monero/build-release/translations'
-- miniupnpc::miniupnpc INCLUDE_DIRECTORIES='$<BUILD_INTERFACE:/home/0xfffc/developments/monero/external/miniupnp/miniupnpc/include>'
-- miniupnpc::miniupnpc INCLUDE_DIRECTORIES='$<INSTALL_INTERFACE:include/miniupnpc>'
-- miniupnpc::miniupnpc INTERFACE_INCLUDE_DIRECTORIES='$<BUILD_INTERFACE:/home/0xfffc/developments/monero/external/miniupnp/miniupnpc/include>'
-- miniupnpc::miniupnpc INTERFACE_INCLUDE_DIRECTORIES='$<INSTALL_INTERFACE:include/miniupnpc>'
-- miniupnpc::miniupnpc INTERFACE_INCLUDE_DIRECTORIES='$<INSTALL_INTERFACE:include>'
CMake Warning at src/p2p/CMakeLists.txt:71 (message):
  p2p:
-- p2p INCLUDE_DIRECTORIES='/home/0xfffc/developments/monero/external/rapidjson/include'
-- p2p INCLUDE_DIRECTORIES='/home/0xfffc/developments/monero/external/easylogging++'
-- p2p INCLUDE_DIRECTORIES='/home/0xfffc/developments/monero/src'
-- p2p INCLUDE_DIRECTORIES='/home/0xfffc/developments/monero/contrib/epee/include'
-- p2p INCLUDE_DIRECTORIES='/home/0xfffc/developments/monero/external'
-- p2p INCLUDE_DIRECTORIES='/home/0xfffc/developments/monero/external/supercop/include'
-- p2p INCLUDE_DIRECTORIES='/opt/monero/build-release/x86_64-pc-linux-gnu/include'
-- p2p INCLUDE_DIRECTORIES='/home/0xfffc/developments/monero/build-release/generated_include'
-- p2p INCLUDE_DIRECTORIES='/home/0xfffc/developments/monero/build-release/translations'
-- p2p INCLUDE_DIRECTORIES='/opt/monero/build-release/x86_64-pc-linux-gnu/include'
-- p2p INCLUDE_DIRECTORIES='/home/0xfffc/developments/monero/external/db_drivers/liblmdb'
-- p2p INCLUDE_DIRECTORIES='/opt/monero/build-release/x86_64-pc-linux-gnu/include/hidapi'
-- p2p INCLUDE_DIRECTORIES='/opt/monero/build-release/x86_64-pc-linux-gnu/include'
-- p2p INCLUDE_DIRECTORIES='/opt/monero/build-release/x86_64-pc-linux-gnu/include/libusb-1.0'
-- p2p INCLUDE_DIRECTORIES='/opt/monero/build-release/x86_64-pc-linux-gnu/include'
-- p2p INTERFACE_INCLUDE_DIRECTORIES='dirs-NOTFOUND'

It is obvious for some reason the include path from miniupnpc::miniupnpc does not propagate to the p2p target.

And this is the PR causing it: miniupnp/miniupnp#559

@0xFFFC0000
Copy link
Collaborator

In case you want to take a look at early PR, this one is a complete fix, other than a few minor issues I expect it to work without issue 0xFFFC0000#23

Once it passed all the tests, I will submit a PR.

@SyntheticBird45
Copy link
Contributor

@0xFFFC0000 testing

@SyntheticBird45
Copy link
Contributor

@0xFFFC0000 unable to compile from your branch. Still have error: external/miniupnp/miniupnpc/src/minihttptestserver.c:299:25: error: implicit declaration of function 'usleep'; did you mean 'sleep'? [-Wimplicit-function-declaration]

What I did:

$ git clone https://github.com/0xFFFC0000/monero -b dev/0xfffc/new-miniupnpc && cd monero/
$ git submodule update --init --force
$ make -j 8

@0xFFFC0000
Copy link
Collaborator

Yes. That is their error. Not ours. Even if you compile miniupnpc in separate environment with same compiler, you will hit it. ( in your spare time please try it if possible and let me know )

Let me double check though, I will find a workaround.

@0xFFFC0000
Copy link
Collaborator

@0xFFFC0000 unable to compile from your branch. Still have error: external/miniupnp/miniupnpc/src/minihttptestserver.c:299:25: error: implicit declaration of function 'usleep'; did you mean 'sleep'? [-Wimplicit-function-declaration]

What I did:

$ git clone https://github.com/0xFFFC0000/monero -b dev/0xfffc/new-miniupnpc && cd monero/
$ git submodule update --init --force
$ make -j 8

Do you use Element? or IRC?

@0xFFFC0000
Copy link
Collaborator

if(NOT MSVC)              
  add_compile_options(-D_GNU_SOURCE)
endif()

Fixed the issue. Now we have updated miniupnpc and fixed this compilation issue.

@gus4rs
Copy link

gus4rs commented Aug 25, 2024

A workaround to compile Monero on Fedora 40 (that ships with gcc 14.x):

dnf install -y gcc13-c++
CC="gcc-13" CXX="g++-13" make -j8 release

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants